| com.sleepycat.je.test.TxnTestCase com.sleepycat.je.test.MultiKeyTxnTestCase com.sleepycat.je.test.SecondaryDirtyReadTest
SecondaryDirtyReadTest | public class SecondaryDirtyReadTest extends MultiKeyTxnTestCase (Code) | | Tests for multithreading problems when using read-uncommitted with
secondaries. If a primary record is updated while performing a
read-uncommitted (in between reading the secondary and the primary), we need
to be sure that we don't return inconsistent results to the user. For
example, we should not return a primary data value that no longer contains
the secondary key. We also need to ensure that deleting a primary record in
the middle of a secondary read does not appear as a corrupt secondary. In
both of these cases it should appear that the record does not exist, from
the viewpoint of an application using a cursor.
These tests create two threads, one reading and the other deleting or
updating. The intention is for reading thread and the delete/update thread
to race in operating on the same key (nextKey). If the reading thread reads
the secondary, then the other thread deletes the primary, then the reading
thread tries to read the primary, we've accomplished our goal. Prior to
when we handled that case in SecondaryCursor, that situation would cause a
"secondary corrupt" exception.
|
Method Summary | |
public void | doTest(String method1, String method2) Runs two threads for the given method names, after populating the
database. | public void | runPrimaryDelete() Deletes the key that is being read by the other thread. | public void | runPrimaryUpdate() Updates the record for the key that is being read by the other thread,
changing the datum to -1 so it will cause the secondary key record to
be deleted. | public void | runReadUncommittedByKey() Does a read-uncommitted by key, retrying until it is deleted by the
delete/update thread, then moves to the next key. | public void | runReadUncommittedScan() Does a read-uncommitted scan through the whole key range, but moves
forward only after the key is deleted by the delete/update thread. | public static Test | suite() | public void | tearDown() Closes databases, then calls the super.tearDown to close the env. | public void | testDeleteWhileReadingByKey() Tests that deleting primary records does not cause secondary
read-uncommitted to throw a "secondary corrupt" exception. | public void | testDeleteWhileScanning() Same as testDeleteWhileReadingByKey but does a scan. | public void | testUpdateWhileReadingByKey() Tests that updating primary records, to cause deletion of the secondary
key record, does not cause secondary read-uncommitted to return
inconsistent data (a primary datum without a secondary key value). | public void | testUpdateWhileScanning() Same as testUpdateWhileReadingByKey but does a scan. |
doTest | public void doTest(String method1, String method2) throws Throwable(Code) | | Runs two threads for the given method names, after populating the
database.
|
runPrimaryDelete | public void runPrimaryDelete() throws DatabaseException(Code) | | Deletes the key that is being read by the other thread.
|
runPrimaryUpdate | public void runPrimaryUpdate() throws DatabaseException(Code) | | Updates the record for the key that is being read by the other thread,
changing the datum to -1 so it will cause the secondary key record to
be deleted.
|
runReadUncommittedByKey | public void runReadUncommittedByKey() throws DatabaseException(Code) | | Does a read-uncommitted by key, retrying until it is deleted by the
delete/update thread, then moves to the next key. We shouldn't get an
exception, just a NOTFOUND when it is deleted.
|
runReadUncommittedScan | public void runReadUncommittedScan() throws DatabaseException(Code) | | Does a read-uncommitted scan through the whole key range, but moves
forward only after the key is deleted by the delete/update thread. We
shouldn't get an exception or a NOTFOUND, but we may skip values when a
key is deleted.
|
suite | public static Test suite()(Code) | | |
tearDown | public void tearDown() throws Exception(Code) | | Closes databases, then calls the super.tearDown to close the env.
|
testDeleteWhileReadingByKey | public void testDeleteWhileReadingByKey() throws Throwable(Code) | | Tests that deleting primary records does not cause secondary
read-uncommitted to throw a "secondary corrupt" exception.
|
testDeleteWhileScanning | public void testDeleteWhileScanning() throws Throwable(Code) | | Same as testDeleteWhileReadingByKey but does a scan. Read-uncommitted
for scan and keyed reads are implemented differently, since scanning
moves to the next record when a deletion is detected while a keyed read
returns NOTFOUND.
|
testUpdateWhileReadingByKey | public void testUpdateWhileReadingByKey() throws Throwable(Code) | | Tests that updating primary records, to cause deletion of the secondary
key record, does not cause secondary read-uncommitted to return
inconsistent data (a primary datum without a secondary key value).
|
testUpdateWhileScanning | public void testUpdateWhileScanning() throws Throwable(Code) | | Same as testUpdateWhileReadingByKey but does a scan.
|
Fields inherited from com.sleepycat.je.test.MultiKeyTxnTestCase | boolean useMultiKey(Code)(Java Doc)
|
|
|