diff --git a/fdbclient/SystemData.cpp b/fdbclient/SystemData.cpp index ed9beda715..c2d0ebee84 100644 --- a/fdbclient/SystemData.cpp +++ b/fdbclient/SystemData.cpp @@ -625,3 +625,8 @@ std::pair<Key,Version> decodeHealthyZoneValue( ValueRef const& value) { reader >> version; return std::make_pair(zoneId, version); } + +const KeyRangeRef testOnlyTxnStateStorePrefixRange( + LiteralStringRef("\xff/TESTONLYtxnStateStore/"), + LiteralStringRef("\xff/TESTONLYtxnStateStore0") +); diff --git a/fdbclient/SystemData.h b/fdbclient/SystemData.h index a4e15f76f9..bb79ac7f36 100644 --- a/fdbclient/SystemData.h +++ b/fdbclient/SystemData.h @@ -283,4 +283,8 @@ extern const KeyRef healthyZoneKey; const Value healthyZoneValue( StringRef const& zoneId, Version version ); std::pair<Key,Version> decodeHealthyZoneValue( ValueRef const& ); +// All mutations done to this range are blindly copied into txnStateStore. +// Used to create artifically large txnStateStore instances in testing. +extern const KeyRangeRef testOnlyTxnStateStorePrefixRange; + #endif diff --git a/fdbserver/ApplyMetadataMutation.h b/fdbserver/ApplyMetadataMutation.h index 1c5ffda43e..6756f15a3e 100644 --- a/fdbserver/ApplyMetadataMutation.h +++ b/fdbserver/ApplyMetadataMutation.h @@ -179,7 +179,7 @@ static void applyMetadataMutations(UID const& dbgid, Arena &arena, VectorRef<Mut } } } else if( m.param1 == databaseLockedKey || m.param1 == metadataVersionKey || m.param1 == mustContainSystemMutationsKey || m.param1.startsWith(applyMutationsBeginRange.begin) || - m.param1.startsWith(applyMutationsAddPrefixRange.begin) || m.param1.startsWith(applyMutationsRemovePrefixRange.begin) || m.param1.startsWith(tagLocalityListPrefix) || m.param1.startsWith(serverTagHistoryPrefix) ) { + m.param1.startsWith(applyMutationsAddPrefixRange.begin) || m.param1.startsWith(applyMutationsRemovePrefixRange.begin) || m.param1.startsWith(tagLocalityListPrefix) || m.param1.startsWith(serverTagHistoryPrefix) || m.param1.startsWith(testOnlyTxnStateStorePrefixRange.begin) ) { if(!initialCommit) txnStateStore->set(KeyValueRef(m.param1, m.param2)); } else if (m.param1.startsWith(applyMutationsEndRange.begin)) { @@ -352,6 +352,9 @@ static void applyMetadataMutations(UID const& dbgid, Arena &arena, VectorRef<Mut if (range.contains(mustContainSystemMutationsKey)) { if(!initialCommit) txnStateStore->clear(singleKeyRange(mustContainSystemMutationsKey)); } + if (range.intersects(testOnlyTxnStateStorePrefixRange)) { + if(!initialCommit) txnStateStore->clear(range & testOnlyTxnStateStorePrefixRange); + } if(range.intersects(applyMutationsEndRange)) { KeyRangeRef commonEndRange(range & applyMutationsEndRange); if(!initialCommit) txnStateStore->clear(commonEndRange); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index af7fe413c8..a4965e8aa8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -111,6 +111,7 @@ add_fdb_test(TEST_FILES fast/SwizzledRollbackSideband.txt) add_fdb_test(TEST_FILES fast/SystemRebootTestCycle.txt) add_fdb_test(TEST_FILES fast/TaskBucketCorrectness.txt) add_fdb_test(TEST_FILES fast/TimeKeeperCorrectness.txt) +add_fdb_test(TEST_FILES fast/TxnStateStoreCycleTest.txt) add_fdb_test(TEST_FILES fast/Unreadable.txt) add_fdb_test(TEST_FILES fast/VersionStamp.txt) add_fdb_test(TEST_FILES fast/Watches.txt) diff --git a/tests/fast/TxnStateStoreCycleTest.txt b/tests/fast/TxnStateStoreCycleTest.txt new file mode 100644 index 0000000000..66b55c935d --- /dev/null +++ b/tests/fast/TxnStateStoreCycleTest.txt @@ -0,0 +1,32 @@ +testTitle=Clogged + testName=Cycle + transactionsPerSecond=2500.0 + testDuration=10.0 + expectedRate=0 + keyPrefix=\xff/TESTONLYtxnStateStore/ + + testName=RandomClogging + testDuration=10.0 + + testName=Rollback + meanDelay=10.0 + testDuration=10.0 + + testName=Attrition + machinesToKill=10 + machinesToLeave=3 + reboot=true + testDuration=10.0 + + testName=Attrition + machinesToKill=10 + machinesToLeave=3 + reboot=true + testDuration=10.0 + +testTitle=Unclogged + testName=Cycle + transactionsPerSecond=250.0 + testDuration=10.0 + expectedRate=0.80 + keyPrefix=\xff/TESTONLYtxnStateStore/