public class TestLockManager
extends junit.framework.TestCase
implements com.bigdata.testutil.ExperimentDriver.IComparisonTest
LockManager
.
Goals:
1. higher concurrency of unisolated operations on the ds/journal with group commit. this only requires a "lock" per writable named index, e.g., an operation will lock exactly one resource. show consistency of the data in a suite of stress tests with varying #s of threads, tasks, and resources. Each task will lock exactly one resource - the unisolated named index on which it would write. DO THIS W/O the TxDAG first and get group commit debugged before trying to work through the tx commit stuff, which requires the WAITS_FOR graph support.
2. transaction processing integrated with unisolated operations. since a transaction MAY write on more than one index this requires a TxDAG and a queue of resources waiting to get into the granted group (which will always be a singleton since writes on unisolated named indices require exclusive locks). show that concurrency control never deadlocks in a suite of stress tests with varying #s of threads, tasks, resources, and resource locked per task. Again, a resource is a unisolated named index.
Modifier and Type | Class and Description |
---|---|
static class |
TestLockManager.Generate
Generates an XML file that can be used to (re-)run the concurrency
control tests.
|
static class |
TestLockManager.TestOptions
Options for
doComparisonTest(Properties) . |
static class |
TestLockManager.Wait10ResourceTask
Waits 10ms once it acquires its locks.
|
Constructor and Description |
---|
TestLockManager() |
TestLockManager(String name) |
Modifier and Type | Method and Description |
---|---|
com.bigdata.testutil.ExperimentDriver.Result |
doComparisonTest(Properties properties)
Test driver.
|
void |
setUpComparisonTest(Properties properties) |
void |
tearDownComparisonTest() |
void |
test_multipleResourceLocking_resources10_locktries10_predeclareLocks()
Test where each operation locks one or more resources.
|
void |
test_multipleResourceLocking_resources10_locktries10()
Test where each operation locks one or more resources.
|
void |
test_multipleResourceLocking_resources3_locktries_3()
Test where each operation locks one or more resources.
|
void |
test_noResourcesDoesNotWait() |
void |
test_singleResourceLocking_defaultConcurrency20()
Test where each operation locks only a single resource (default concurrency).
|
void |
test_singleResourceLocking_highConcurrency100()
Test where each operation locks only a single resource (high concurrency).
|
void |
test_singleResourceLocking_lowConcurrency5()
Test where each operation locks only a single resource (low concurrency
condition w/ 5 threads).
|
void |
test_singleResourceLocking_serialized_highConcurrency_lockTimeout()
Test where each operation locks only a single resource and there is only
one resource to be locked so that all operations MUST be serialized with
a non-zero lock timeout.
|
void |
test_singleResourceLocking_serialized_highConcurrency()
Test where each operation locks only a single resource and there is only
one resource to be locked so that all operations MUST be serialized.
|
void |
test_singleResourceLocking_serialized_lowConcurrency2()
Test where each operation locks only a single resource and there is only one
resource to be locked so that all operations MUST be serialized.
|
void |
test_singleResourceLocking_serialized_lowConcurrency5_withTaskDeath()
Test where each operation locks only a single resource and there is only
one resource to be locked so that all operations MUST be serialized and
where 10% of all tasks die a horrid death.
|
void |
test_singleResourceLocking_serialized_lowConcurrency5()
Test where each operation locks only a single resource and there is only
one resource to be locked so that all operations MUST be serialized.
|
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, runBare, runTest, setName, setUp, tearDown, toString
public TestLockManager()
public TestLockManager(String name)
public com.bigdata.testutil.ExperimentDriver.Result doComparisonTest(Properties properties) throws Exception
Note: A "resource" is a named index (partition), so set nresources based on your expectations for the #of index partitions on a journal or federation.
Note: The likelihood of deadlock increases as (a) more locks are requested per task; and (b) fewer resources are available to be locked. When minLocks==maxLocks==nresources then tasks will be serialized since each task requires all resources in order to proceed.
Note: At minLocks==maxLocks==1 this test can be used to explore the
behavior of tasks that lock only a single resource, eg., unisolated
operations on the DataService
.
doComparisonTest
in interface com.bigdata.testutil.ExperimentDriver.IComparisonTest
Exception
public void setUpComparisonTest(Properties properties) throws Exception
setUpComparisonTest
in interface com.bigdata.testutil.ExperimentDriver.IComparisonTest
Exception
public void tearDownComparisonTest() throws Exception
tearDownComparisonTest
in interface com.bigdata.testutil.ExperimentDriver.IComparisonTest
Exception
public void test_noResourcesDoesNotWait() throws Exception
Exception
public void test_singleResourceLocking_lowConcurrency5() throws Exception
Exception
public void test_singleResourceLocking_defaultConcurrency20() throws Exception
Exception
public void test_singleResourceLocking_highConcurrency100() throws Exception
Exception
public void test_singleResourceLocking_serialized_lowConcurrency2() throws Exception
Exception
public void test_singleResourceLocking_serialized_lowConcurrency5() throws Exception
Exception
public void test_singleResourceLocking_serialized_lowConcurrency5_withTaskDeath() throws Exception
Exception
public void test_singleResourceLocking_serialized_highConcurrency() throws Exception
Exception
public void test_singleResourceLocking_serialized_highConcurrency_lockTimeout() throws Exception
Exception
public void test_multipleResourceLocking_resources3_locktries_3() throws Exception
Note: This condition provides the basis for deadlocks.
Exception
public void test_multipleResourceLocking_resources10_locktries10_predeclareLocks() throws Exception
Note: This condition provides the basis for deadlocks. In fact, since we have 10 resource locks for each operation and only 100 operations the chances of a deadlock on any given operation are extremely high. However, since we are predeclaring our locks and the lock requests are being sorted NO deadlocks should result.
public void test_multipleResourceLocking_resources10_locktries10() throws Exception
Note: This condition provides the basis for deadlocks. In fact, since we have 10 resource locks for each operation and only 100 operations the chances of a deadlock on any given operation are extremely high. However, since we are predeclaring our locks and the lock requests are being sorted NO deadlocks should result.
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.