public class TestDurabilityProperty
extends java.lang.Object
When set, the system will not do any syncs, the cases namely - no sync of the log file at each commit - no sync of the log file before data page is forced to disk - no sync of page allocation when file is grown - no sync of data writes during checkpoint
That means, when this property is set to 'test', - a commit no longer guarantees that the transaction's modification will survive a system crash or JVM termination - the database may not recover successfully upon restart - a near full disk at runtime may cause unexpected errors - database may be in an inconsistent state This program tests for 1. setting the derby.system.durability=test is actually not doing the syncs by timing inserts 2. check if a warning message exists in derby.log 3. read log.ctrl file and check if the flag is set or not 4. check if the log.ctrl file flag is not overwritten for the case when database booted with derby.system.durability=test set, then shutdown and database booted without derby.system.durability=test
Constructor and Description |
---|
TestDurabilityProperty() |
Modifier and Type | Method and Description |
---|---|
static long |
doInserts(java.sql.Connection conn,
boolean autoCommit)
Note doing inserts in autocommit mode is probably the worst case scenario
in terms of performance as each commit will involve a flush/sync to disk
but in case of the derby.system.durability=test mode, the syncs dont
happen.
|
static boolean |
isMessageInDerbyLog(java.lang.String derbyHome)
When derby.system.durability is set, a warning message is written out to
derby.log indicating that the property is set and that it does not
guarantee recoverability This test tests if a message is written out to
derby.log or not
|
static void |
main(java.lang.String[] args) |
static void |
markerInControlFile(java.lang.String derbyHome)
if database is booted with derby.system.durability=test,
a marker is written out into log control
file to recognize that the database was previously booted in this mode
Test if the marker byte is set correctly or not.
|
static void |
markerNotOverwritten(java.lang.String derbyHome)
Test for case when database is booted without derby.system.durability=test
but previously has been booted with the derby.system.durability=test.
|
static void |
report(java.lang.String msg)
print message
|
static void |
testNoSyncs(java.lang.String[] args)
Test if derby.system.durability=test property is broken or not.
|
static long |
timeTakenToInsert(java.lang.String mode,
boolean create,
boolean autoCommit)
time inserts
|
public static void main(java.lang.String[] args)
public static long timeTakenToInsert(java.lang.String mode, boolean create, boolean autoCommit) throws java.lang.Exception
mode
- value for derby.system.durability propertycreate
- should table be created or notautoCommit
- whether inserts should happen in autocommit mode or notjava.lang.Exception
public static long doInserts(java.sql.Connection conn, boolean autoCommit) throws java.lang.Exception
java.lang.Exception
public static boolean isMessageInDerbyLog(java.lang.String derbyHome) throws java.lang.Exception
java.lang.Exception
public static void markerInControlFile(java.lang.String derbyHome) throws java.lang.Exception
java.lang.Exception
public static void markerNotOverwritten(java.lang.String derbyHome) throws java.lang.Exception
derbyHome
- value of derby.system.home where the database isjava.lang.Exception
public static void report(java.lang.String msg)
msg
- to print outpublic static void testNoSyncs(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.