diff --git a/fdbrpc/FlowTransport.actor.cpp b/fdbrpc/FlowTransport.actor.cpp index 27f34e22f1..1fd5ede75a 100644 --- a/fdbrpc/FlowTransport.actor.cpp +++ b/fdbrpc/FlowTransport.actor.cpp @@ -492,7 +492,7 @@ static void scanPackets( TransportData* transport, uint8_t*& unprocessed_begin, if (checksumEnabled) { bool isBuggifyEnabled = false; - if(g_network->isSimulated() && g_network->now() - g_simulator.lastConnectionFailure > g_simulator.connectionFailuresDisableDuration && BUGGIFY_WITH_PROB(0.001)) { + if(g_network->isSimulated() && g_network->now() - g_simulator.lastConnectionFailure > g_simulator.connectionFailuresDisableDuration && BUGGIFY_WITH_PROB(0.0001)) { g_simulator.lastConnectionFailure = g_network->now(); isBuggifyEnabled = true; TraceEvent(SevInfo, "BitsFlip"); diff --git a/fdbserver/fdbserver.vcxproj b/fdbserver/fdbserver.vcxproj index ec89c2276d..9d11c4e630 100644 --- a/fdbserver/fdbserver.vcxproj +++ b/fdbserver/fdbserver.vcxproj @@ -1,4 +1,4 @@ - + @@ -92,7 +92,7 @@ - + @@ -113,6 +113,7 @@ + @@ -296,4 +297,4 @@ - \ No newline at end of file + diff --git a/fdbserver/fdbserver.vcxproj.filters b/fdbserver/fdbserver.vcxproj.filters index 486d5387b8..2086792875 100644 --- a/fdbserver/fdbserver.vcxproj.filters +++ b/fdbserver/fdbserver.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -240,6 +240,9 @@ workloads + + workloads + workloads @@ -345,4 +348,4 @@ {de5e282f-8d97-4054-b795-0a75b772326f} - \ No newline at end of file + diff --git a/fdbserver/workloads/BackupToDBAbort.actor.cpp b/fdbserver/workloads/BackupToDBAbort.actor.cpp new file mode 100644 index 0000000000..d7791e7754 --- /dev/null +++ b/fdbserver/workloads/BackupToDBAbort.actor.cpp @@ -0,0 +1,113 @@ +/* + * BackupToDBAbort.actor.cpp + * + * This source file is part of the FoundationDB open source project + * + * Copyright 2013-2018 Apple Inc. and the FoundationDB project authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "flow/actorcompiler.h" +#include "fdbclient/BackupAgent.h" +#include "fdbclient/ManagementAPI.h" +#include "fdbclient/NativeAPI.h" +#include "workloads.h" + +struct BackupToDBAbort : TestWorkload { + double abortDelay; + Database extraDB; + Standalone> backupRanges; + UID lockid; + + explicit BackupToDBAbort(const WorkloadContext& wcx) + : TestWorkload(wcx) { + abortDelay = getOption(options, LiteralStringRef("abortDelay"), 50.0); + + backupRanges.push_back_deep(backupRanges.arena(), normalKeys); + + Reference extraFile(new ClusterConnectionFile(*g_simulator.extraDB)); + Reference extraCluster = Cluster::createCluster(extraFile, -1); + extraDB = extraCluster->createDatabase(LiteralStringRef("DB")).get(); + + lockid = UID(0xbeeffeed, 0xdecaf00d); + } + + virtual std::string description() override { + return "BackupToDBAbort"; + } + + virtual Future setup(const Database& cx) override { + if (clientId != 0) return Void(); + return _setup(this, cx); + } + + ACTOR static Future _setup(BackupToDBAbort* self, Database cx) { + state DatabaseBackupAgent backupAgent(cx); + state Future disabler = disableConnectionFailuresAfter(300, "BackupToDBAbort"); + try { + TraceEvent("BDBA_Submit1"); + Void _ = wait( backupAgent.submitBackup(self->extraDB, BackupAgentBase::getDefaultTag(), self->backupRanges, false, StringRef(), StringRef(), true) ); + TraceEvent("BDBA_Submit2"); + } catch( Error &e ) { + if( e.code() != error_code_backup_duplicate ) + throw; + } + return Void(); + } + + virtual Future start(Database const& cx) override { + if (clientId != 0) return Void(); + return _start(this, cx); + } + + ACTOR static Future _start(BackupToDBAbort* self, Database cx) { + state DatabaseBackupAgent backupAgent(cx); + state Future disabler = disableConnectionFailuresAfter(300, "BackupToDBAbort"); + + TraceEvent("BDBA_Start").detail("delay", self->abortDelay); + Void _ = wait(delay(self->abortDelay)); + TraceEvent("BDBA_Wait"); + int _ = wait( backupAgent.waitBackup(self->extraDB, BackupAgentBase::getDefaultTag(), false) ); + TraceEvent("BDBA_Lock"); + Void _ = wait(lockDatabase(cx, self->lockid)); + TraceEvent("BDBA_Abort"); + Void _ = wait(backupAgent.abortBackup(self->extraDB, BackupAgentBase::getDefaultTag())); + TraceEvent("BDBA_Unlock"); + Void _ = wait(backupAgent.unlockBackup(self->extraDB, BackupAgentBase::getDefaultTag())); + TraceEvent("BDBA_End"); + + // SOMEDAY: Remove after backup agents can exist quiescently + if (g_simulator.backupAgents == ISimulator::BackupToDB) { + g_simulator.backupAgents = ISimulator::NoBackupAgents; + } + + return Void(); + } + + ACTOR static Future _check(BackupToDBAbort* self, Database cx) { + TraceEvent("BDBA_UnlockPrimary"); + // Too much of the tester framework expects the primary database to be unlocked, so we unlock it + // once all of the workloads have finished. + Void _ = wait(unlockDatabase(cx, self->lockid)); + return true; + } + + virtual Future check(const Database& cx) override { + return _check(this, cx); + } + + virtual void getMetrics(vector& m) {} +}; + +REGISTER_WORKLOAD(BackupToDBAbort); diff --git a/fdbserver/workloads/BackupToDBCorrectness.actor.cpp b/fdbserver/workloads/BackupToDBCorrectness.actor.cpp index 40265e987c..3bd6aa028d 100644 --- a/fdbserver/workloads/BackupToDBCorrectness.actor.cpp +++ b/fdbserver/workloads/BackupToDBCorrectness.actor.cpp @@ -380,7 +380,7 @@ struct BackupToDBCorrectnessWorkload : TestWorkload { Standalone logValues = wait(tr->getRange(KeyRange(KeyRangeRef(backupLogValuesKey, strinc(backupLogValuesKey))), 100)); - // Error if the log/mutation keyspace for the backup tag is not empty + // Error if the log/mutation keyspace for the backup tag is not empty if (logValues.size() > 0) { displaySystemKeys++; printf("BackupCorrectnessLeftOverLogKeys: (%d) %s\n", logValues.size(), printable(backupLogValuesKey).c_str()); diff --git a/fdbserver/workloads/workloads.h b/fdbserver/workloads/workloads.h index 663c2f03c5..f9155e2897 100644 --- a/fdbserver/workloads/workloads.h +++ b/fdbserver/workloads/workloads.h @@ -133,6 +133,8 @@ struct WorkloadFactory : IWorkloadFactory { } }; +#define REGISTER_WORKLOAD(classname) WorkloadFactory classname##WorkloadFactory( #classname ) + struct DistributedTestResults { vector metrics; int successes, failures;