bug fixes in SnapTest

Earlier the test was checking for the following condition:
durable version of storage > min version of tlog, but the
check has been modified to:
durable version of storage >= min version of tlog - 1.

Ensure that the pre-snap validate keys are exactly 1000 in
the case of commit retires.
This commit is contained in:
sramamoorthy 2019-04-02 04:26:26 -07:00 committed by Alex Miller
parent f129d996fe
commit c4d27ac9d2
1 changed files with 10 additions and 5 deletions

View File

@ -158,13 +158,17 @@ public: // workload functions
ACTOR Future<Void> _create_keys(Database cx, std::string prefix, bool even = true) { ACTOR Future<Void> _create_keys(Database cx, std::string prefix, bool even = true) {
state Transaction tr(cx); state Transaction tr(cx);
state vector<int64_t> keys;
for (int i = 0; i < 1000; i++) {
keys.push_back(g_random->randomInt64(0, INT64_MAX - 2));
}
state int retry = 0; state int retry = 0;
loop { loop {
tr.reset(); tr.reset();
try { try {
for (int i = 0; i < 1000; i++) { for (auto id : keys) {
int64_t id = g_random->randomInt64(0, INT64_MAX - 2);
if (even) { if (even) {
if (id % 2 != 0) { if (id % 2 != 0) {
id++; id++;
@ -264,6 +268,7 @@ public: // workload functions
begin = firstGreaterThan(kvRange.end()[-1].key); begin = firstGreaterThan(kvRange.end()[-1].key);
} catch (Error& e) { } catch (Error& e) {
wait(tr.onError(e)); wait(tr.onError(e));
cnt = 0;
} }
} }
TraceEvent("VerifyCntValue").detail("Value", cnt); TraceEvent("VerifyCntValue").detail("Value", cnt);
@ -376,7 +381,7 @@ public: // workload functions
for (auto const& worker : workers) { for (auto const& worker : workers) {
address_workers[worker.interf.address()] = worker.interf; address_workers[worker.interf.address()] = worker.interf;
} }
vector<TLogInterface> tLogServers = self->dbInfo->get().logSystemConfig.allPresentLogs(); vector<TLogInterface> tLogServers = self->dbInfo->get().logSystemConfig.allLocalLogs();
for (auto s : tLogServers) { for (auto s : tLogServers) {
auto it = address_workers.find(s.address()); auto it = address_workers.find(s.address());
@ -385,7 +390,7 @@ public: // workload functions
TraceEvent("TLogWorker") TraceEvent("TLogWorker")
.detail("Address", s.address()) .detail("Address", s.address())
.detail("Id", s.id()) .detail("Id", s.id())
.detail("Localit", s.locality.toString()); .detail("Locality", s.locality.toString());
} }
} }
@ -620,7 +625,7 @@ public: // workload functions
ASSERT(tLogMessages[k].get().toString() != emptyStr); ASSERT(tLogMessages[k].get().toString() != emptyStr);
getMinAndMaxTLogVersions(tLogMessages[k].get(), execVersion, tag, minTLogVersion, maxTLogVersion); getMinAndMaxTLogVersions(tLogMessages[k].get(), execVersion, tag, minTLogVersion, maxTLogVersion);
if (minTLogVersion != -1 && maxTLogVersion != -1) { if (minTLogVersion != -1 && maxTLogVersion != -1) {
if ((durableVersion > minTLogVersion) && (durableVersion < maxTLogVersion)) { if ((durableVersion >= minTLogVersion - 1) && (durableVersion < maxTLogVersion)) {
++numDurableVersionChecks; ++numDurableVersionChecks;
TraceEvent("Successs!!!"); TraceEvent("Successs!!!");
} }