public class IndexSplitDeadlockTest extends BaseJDBCTestCase
Modifier and Type | Class and Description |
---|---|
private static interface |
IndexSplitDeadlockTest.AsyncTask
Interface that should be implemented by classes that define a
database task that is to be executed asynchronously in a separate
transaction.
|
private class |
IndexSplitDeadlockTest.AsyncThread
Class that executes an
AsyncTask object. |
Modifier and Type | Field and Description |
---|---|
private java.util.List<IndexSplitDeadlockTest.AsyncThread> |
threads
List of threads (AsyncThread objects) to wait for after running the test.
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
IndexSplitDeadlockTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private int |
numlocks()
Get the number of locks in the lock table
|
private void |
obstruct(java.lang.String sql,
long blockMillis)
In a separate thread, and in a separate transaction, execute the
SQL text and wait for the specified period of time, before the
transaction is rolled back.
|
static junit.framework.Test |
suite() |
protected void |
tearDown()
Tear down this fixture, sub-classes should call
super.tearDown().
|
void |
testBTreeForwardScan_fetchRows_resumeAfterSplit()
Test first call to reposition() in BTreeForwardScan.fetchRows().
|
void |
testBTreeForwardScan_fetchRows_resumeAfterWait_nonUnique_split()
Test that BTreeForwardScan.fetchRows() can reposition after releasing
latches because it had to wait for a lock, and the leaf page on which
the scan is positioned has been split.
|
void |
testBTreeForwardScan_fetchRows_resumeAfterWait_nonUnique()
Test that BTreeForwardScan.fetchRows() can reposition after releasing
latches because it had to wait for a lock.
|
void |
testBTreeForwardScan_fetchRows_resumeAfterWait_unique_split()
Test that BTreeForwardScan.fetchRows() can reposition after releasing
latches because it had to wait for a lock, and the leaf page on which
the scan is positioned has been split.
|
void |
testBTreeForwardScan_fetchRows_resumeAfterWait_unique()
Test that BTreeForwardScan.fetchRows() can reposition after releasing
latches because it had to wait for a lock.
|
void |
testBTreeForwardScan_fetchRows_resumeScanAfterCommitAndSplit()
Test that we can reposition on a holdable cursor after a commit and
a split on the leaf page of the current position.
|
void |
testBTreeForwardScan_fetchRows_resumeScanAfterCompress()
Test that we can reposition on a holdable cursor after a commit and
a compress that removes the leaf page of the current position.
|
void |
testBTreeMaxScan_fetchMaxRowFromBeginning() |
void |
testMultipleLastKeyWaitsInMaxScan()
Test that a max scan works when it needs to wait more than once in order
to lock the last record in the index.
|
void |
testMultiplePrevKeyWaitsInForwardScan()
Test that a forward scan works even in the case that it has to wait
for the previous key lock more than once.
|
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, setUp, toString
private java.util.List<IndexSplitDeadlockTest.AsyncThread> threads
public static junit.framework.Test suite()
protected void tearDown() throws java.lang.Exception
BaseJDBCTestCase
tearDown
in class BaseJDBCTestCase
java.lang.Exception
public void testBTreeMaxScan_fetchMaxRowFromBeginning() throws java.lang.Exception
java.lang.Exception
public void testBTreeForwardScan_fetchRows_resumeAfterSplit() throws java.sql.SQLException
java.sql.SQLException
public void testBTreeForwardScan_fetchRows_resumeScanAfterCommitAndSplit() throws java.sql.SQLException
java.sql.SQLException
public void testBTreeForwardScan_fetchRows_resumeScanAfterCompress() throws java.lang.Exception
java.lang.Exception
public void testBTreeForwardScan_fetchRows_resumeAfterWait_unique() throws java.lang.Exception
java.lang.Exception
public void testBTreeForwardScan_fetchRows_resumeAfterWait_unique_split() throws java.lang.Exception
java.lang.Exception
public void testBTreeForwardScan_fetchRows_resumeAfterWait_nonUnique() throws java.lang.Exception
java.lang.Exception
public void testBTreeForwardScan_fetchRows_resumeAfterWait_nonUnique_split() throws java.lang.Exception
java.lang.Exception
public void testMultipleLastKeyWaitsInMaxScan() throws java.lang.Exception
java.lang.Exception
private int numlocks() throws java.sql.SQLException
java.sql.SQLException
public void testMultiplePrevKeyWaitsInForwardScan() throws java.lang.Exception
java.lang.Exception
private void obstruct(java.lang.String sql, long blockMillis)
In a separate thread, and in a separate transaction, execute the SQL text and wait for the specified period of time, before the transaction is rolled back. This method can be used to hold locks and thereby block the main thread for a certain amount of time.
If an exception is thrown while executing the SQL, the exception is stored and rethrown from the tearDown() method in the main execution thread, so that it is detected by the JUnit framework.
sql
- the SQL text to executeblockMillis
- how many milliseconds to wait until the transaction
is rolled backApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.