Fix a test timeout (#8488)
* Fix a test timeout due to buggified knob MAX_WRITE_TRANSACTION_LIFE_VERSIONS The buggified knob MAX_WRITE_TRANSACTION_LIFE_VERSIONS can be only 1M. In some tests, this transaction always end up commitVersion - readVersion is a little above 1M, thus always getting transaction_too_old error. * Change MAX_COMMIT_BATCH_INTERVAL instead So that the master may give out versions fast enough. * Fix an assertion failure in a unit test 48125>>8 = 187, 48125 = 0xbbfd 48128>>8 = 188, 48128 = 0xbc00 So if 48125 is chosen as the index, 48128 changes the higher order byte. 48125 & 0xff7f = 47997 = 0xbb7d. Thus +5 won't change the higher order byte.
This commit is contained in:
parent
cda6202a26
commit
0872cbfb2f
|
@ -122,6 +122,7 @@ IdempotencyIdRef generate(Arena& arena) {
|
|||
TEST_CASE("/fdbclient/IdempotencyId/basic") {
|
||||
Arena arena;
|
||||
uint16_t firstBatchIndex = deterministicRandom()->randomUInt32();
|
||||
firstBatchIndex &= 0xff7f; // ensure firstBatchIndex+5 won't change the higher order byte
|
||||
uint16_t batchIndex = firstBatchIndex;
|
||||
Version commitVersion = deterministicRandom()->randomInt64(0, std::numeric_limits<Version>::max());
|
||||
std::vector<IdempotencyIdRef> idVector; // Reference
|
||||
|
|
|
@ -39,11 +39,12 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
|
|||
init( ENABLE_VERSION_VECTOR, false );
|
||||
init( ENABLE_VERSION_VECTOR_TLOG_UNICAST, false );
|
||||
|
||||
bool buggifyShortReadWindow = randomize && BUGGIFY && !ENABLE_VERSION_VECTOR;
|
||||
bool buggifyShortReadWindow = randomize && BUGGIFY && !ENABLE_VERSION_VECTOR;
|
||||
init( MAX_READ_TRANSACTION_LIFE_VERSIONS, 5 * VERSIONS_PER_SECOND ); if (randomize && BUGGIFY) MAX_READ_TRANSACTION_LIFE_VERSIONS = VERSIONS_PER_SECOND; else if (buggifyShortReadWindow) MAX_READ_TRANSACTION_LIFE_VERSIONS = std::max<int>(1, 0.1 * VERSIONS_PER_SECOND); else if( randomize && BUGGIFY ) MAX_READ_TRANSACTION_LIFE_VERSIONS = 10 * VERSIONS_PER_SECOND;
|
||||
init( MAX_WRITE_TRANSACTION_LIFE_VERSIONS, 5 * VERSIONS_PER_SECOND ); if (randomize && BUGGIFY) MAX_WRITE_TRANSACTION_LIFE_VERSIONS=std::max<int>(1, 1 * VERSIONS_PER_SECOND);
|
||||
init( MAX_COMMIT_BATCH_INTERVAL, 2.0 ); if( randomize && BUGGIFY ) MAX_COMMIT_BATCH_INTERVAL = 0.5; // Each commit proxy generates a CommitTransactionBatchRequest at least this often, so that versions always advance smoothly
|
||||
MAX_COMMIT_BATCH_INTERVAL = std::min(MAX_COMMIT_BATCH_INTERVAL, MAX_READ_TRANSACTION_LIFE_VERSIONS/double(2*VERSIONS_PER_SECOND)); // Ensure that the proxy commits 2 times every MAX_READ_TRANSACTION_LIFE_VERSIONS, otherwise the master will not give out versions fast enough
|
||||
MAX_COMMIT_BATCH_INTERVAL = std::min(MAX_COMMIT_BATCH_INTERVAL, MAX_WRITE_TRANSACTION_LIFE_VERSIONS/double(2*VERSIONS_PER_SECOND)); // Ensure that the proxy commits 2 times every MAX_WRITE_TRANSACTION_LIFE_VERSIONS, otherwise the master will not give out versions fast enough
|
||||
init( MAX_VERSION_RATE_MODIFIER, 0.1 );
|
||||
init( MAX_VERSION_RATE_OFFSET, VERSIONS_PER_SECOND ); // If the calculated version is more than this amount away from the expected version, it will be clamped to this value. This prevents huge version jumps.
|
||||
init( ENABLE_VERSION_VECTOR_HA_OPTIMIZATION, false );
|
||||
|
|
|
@ -838,21 +838,25 @@ ACTOR Future<Void> testerServerCore(TesterInterface interf,
|
|||
ACTOR Future<Void> clearData(Database cx) {
|
||||
state Transaction tr(cx);
|
||||
state UID debugID = debugRandom()->randomUniqueID();
|
||||
TraceEvent("TesterClearingDatabaseStart", debugID).log();
|
||||
tr.debugTransaction(debugID);
|
||||
|
||||
loop {
|
||||
try {
|
||||
TraceEvent("TesterClearingDatabaseStart", debugID).log();
|
||||
// This transaction needs to be self-conflicting, but not conflict consistently with
|
||||
// any other transactions
|
||||
tr.clear(normalKeys);
|
||||
tr.makeSelfConflicting();
|
||||
wait(success(tr.getReadVersion())); // required since we use addReadConflictRange but not get
|
||||
Version rv = wait(tr.getReadVersion()); // required since we use addReadConflictRange but not get
|
||||
TraceEvent("TesterClearingDatabaseRV", debugID).detail("RV", rv);
|
||||
wait(tr.commit());
|
||||
TraceEvent("TesterClearingDatabase", debugID).detail("AtVersion", tr.getCommittedVersion());
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
TraceEvent(SevWarn, "TesterClearingDatabaseError", debugID).error(e);
|
||||
wait(tr.onError(e));
|
||||
debugID = debugRandom()->randomUniqueID();
|
||||
tr.debugTransaction(debugID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue