Various test fixes to work with tenants.

This commit is contained in:
A.J. Beamon 2022-03-02 10:10:37 -08:00
parent 4b521b38cb
commit 81e8c7c362
6 changed files with 22 additions and 12 deletions

View File

@ -300,6 +300,8 @@ public:
stderrSeverity, machineCount, processesPerMachine, coordinators;
Optional<std::string> config;
bool allowDefaultTenant = true;
ConfigDBType getConfigDBType() const { return configDBType; }
bool tomlKeyPresent(const toml::value& data, std::string key) {
@ -350,7 +352,8 @@ public:
.add("processesPerMachine", &processesPerMachine)
.add("coordinators", &coordinators)
.add("configDB", &configDBType)
.add("extraMachineCountDC", &extraMachineCountDC);
.add("extraMachineCountDC", &extraMachineCountDC)
.add("allowDefaultTenant", &allowDefaultTenant);
try {
auto file = toml::parse(testFile);
if (file.contains("configuration") && toml::find(file, "configuration").is_table()) {
@ -2272,11 +2275,12 @@ ACTOR void setupAndRun(std::string dataFolder,
state Standalone<StringRef> startingConfiguration;
state int testerCount = 1;
state TestConfig testConfig;
state bool allowDefaultTenant = true;
testConfig.readFromConfig(testFile);
g_simulator.hasDiffProtocolProcess = testConfig.startIncompatibleProcess;
g_simulator.setDiffProtocol = false;
state bool allowDefaultTenant = testConfig.allowDefaultTenant;
// The RocksDB storage engine does not support the restarting tests because you cannot consistently get a clean
// snapshot of the storage engine without a snapshotting file system.
// https://github.com/apple/foundationdb/issues/5155
@ -2298,8 +2302,7 @@ ACTOR void setupAndRun(std::string dataFolder,
// Disable the default tenant in backup and DR tests for now. This is because backup does not currently duplicate
// the tenant map and related state.
// TODO: reenable when backup/DR supports tenants.
if (std::string_view(testFile).find("Backup") != std::string_view::npos ||
std::string_view(testFile).find("Switchover") != std::string_view::npos) {
if (std::string_view(testFile).find("Backup") != std::string_view::npos || testConfig.extraDB != 0) {
allowDefaultTenant = false;
}

View File

@ -177,7 +177,6 @@ struct ConflictRangeWorkload : TestWorkload {
if (self->testReadYourWrites) {
trRYOW.setVersion(readVersion);
trRYOW.setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
} else
tr3.setVersion(readVersion);
@ -262,7 +261,8 @@ struct ConflictRangeWorkload : TestWorkload {
throw not_committed();
}
if (originalResults[originalResults.size() - 1].key >= LiteralStringRef("\xff")) {
if (originalResults[originalResults.size() - 1].key >= LiteralStringRef("\xff") ||
originalResults.readThroughEnd) {
// Results go into server keyspace, so if a key selector does not fully resolve offset, a
// change won't effect results
throw not_committed();
@ -316,7 +316,7 @@ struct ConflictRangeWorkload : TestWorkload {
allKeyEntries += printable(res[i].key) + " ";
}
TraceEvent("ConflictRangeDump").detail("Keys", allKeyEntries);
TraceEvent("ConflictRangeDump").setMaxFieldLength(10000).detail("Keys", allKeyEntries);
}
throw not_committed();
} else {

View File

@ -18,6 +18,7 @@
* limitations under the License.
*/
#include "fdbclient/FDBOptions.g.h"
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/CoordinationInterface.h"
#include "fdbserver/TesterInterface.actor.h"
@ -48,6 +49,7 @@ ACTOR Future<bool> ignoreSSFailuresForDuration(Database cx, double duration) {
loop {
try {
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr.clear(healthyZoneKey);
wait(tr.commit());
TraceEvent("IgnoreSSFailureComplete").log();

View File

@ -118,8 +118,6 @@ struct SelectorCorrectnessWorkload : TestWorkload {
state Transaction tr(cx);
state ReadYourWritesTransaction trRYOW(cx);
trRYOW.setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
if (self->testReadYourWrites) {
myValue = StringRef(format("%010d", deterministicRandom()->randomInt(0, 10000000)));
for (int i = 2; i < self->maxKeySpace; i += 4)

View File

@ -42,6 +42,7 @@ struct VersionStampWorkload : TestWorkload {
std::map<Key, std::vector<std::pair<Version, Standalone<StringRef>>>> versionStampKey_commit;
int apiVersion;
bool soleOwnerOfMetadataVersionKey;
bool allowMetadataVersionKey;
VersionStampWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) {
testDuration = getOption(options, LiteralStringRef("testDuration"), 60.0);
@ -74,6 +75,12 @@ struct VersionStampWorkload : TestWorkload {
apiVersion = Database::API_VERSION_LATEST;
}
TraceEvent("VersionStampApiVersion").detail("ApiVersion", apiVersion);
allowMetadataVersionKey = apiVersion >= 610 || apiVersion == Database::API_VERSION_LATEST;
// TODO: change this once metadata versions are supported for tenants
allowMetadataVersionKey = allowMetadataVersionKey && !cx->defaultTenant.present();
cx->apiVersion = apiVersion;
if (clientId == 0)
return _start(cx, this, 1 / transactionsPerSecond);
@ -81,7 +88,7 @@ struct VersionStampWorkload : TestWorkload {
}
Key keyForIndex(uint64_t index) {
if ((apiVersion >= 610 || apiVersion == Database::API_VERSION_LATEST) && index == 0) {
if (allowMetadataVersionKey && index == 0) {
return metadataVersionKey;
}
@ -191,8 +198,7 @@ struct VersionStampWorkload : TestWorkload {
RangeResult result_ = wait(tr.getRange(
KeyRangeRef(self->vsValuePrefix, endOfRange(self->vsValuePrefix)), self->nodeCount + 1));
result = result_;
if ((self->apiVersion >= 610 || self->apiVersion == Database::API_VERSION_LATEST) &&
self->key_commit.count(metadataVersionKey)) {
if (self->allowMetadataVersionKey && self->key_commit.count(metadataVersionKey)) {
Optional<Value> mVal = wait(tr.get(metadataVersionKey));
if (mVal.present()) {
result.push_back_deep(result.arena(), KeyValueRef(metadataVersionKey, mVal.get()));

View File

@ -1,5 +1,6 @@
[configuration]
StderrSeverity = 30
allowDefaultTenant = false
[[test]]
testTitle = 'WriteDuringReadTest'