extract KeyBackedConfig, StorageWiggleData class; solve template resolution problem; solve MV txn and native api conflict by splitting RunTransaction file

This commit is contained in:
Xiaoxi Wang 2023-01-02 23:34:39 -08:00
parent ba43de6a87
commit bbcb3cc018
39 changed files with 388 additions and 357 deletions

View File

@ -45,7 +45,7 @@
#include "fdbclient/ClusterConnectionFile.h"
#include "fdbclient/KeyBackedTypes.h"
#include "fdbclient/IKnobCollection.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/S3BlobStore.h"
#include "fdbclient/SystemData.h"
#include "fdbclient/json_spirit/json_spirit_writer_template.h"

View File

@ -47,7 +47,7 @@
#include "fdbclient/SystemData.h"
#include "fdbclient/ReadYourWrites.h"
#include "fdbclient/KeyBackedTypes.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include <algorithm>
#include <cinttypes>
#include <time.h>

View File

@ -154,10 +154,10 @@ KeyBackedTag::KeyBackedTag(std::string tagName, StringRef tagMapPrefix)
: KeyBackedProperty<UidAndAbortedFlagT>(TagUidMap(tagMapPrefix).getProperty(tagName)), tagName(tagName),
tagMapPrefix(tagMapPrefix) {}
class RestoreConfig : public KeyBackedConfig {
class RestoreConfig : public KeyBackedTaskConfig {
public:
RestoreConfig(UID uid = UID()) : KeyBackedConfig(fileRestorePrefixRange.begin, uid) {}
RestoreConfig(Reference<Task> task) : KeyBackedConfig(fileRestorePrefixRange.begin, task) {}
RestoreConfig(UID uid = UID()) : KeyBackedTaskConfig(fileRestorePrefixRange.begin, uid) {}
RestoreConfig(Reference<Task> task) : KeyBackedTaskConfig(fileRestorePrefixRange.begin, task) {}
KeyBackedProperty<ERestoreState> stateEnum() { return configSpace.pack(__FUNCTION__sr); }
Future<StringRef> stateText(Reference<ReadYourWritesTransaction> tr) {
@ -1284,7 +1284,7 @@ ACTOR Future<Void> checkTaskVersion(Database cx, Reference<Task> task, StringRef
.detail("TaskVersion", taskVersion)
.detail("Name", name)
.detail("Version", version);
if (KeyBackedConfig::TaskParams.uid().exists(task)) {
if (KeyBackedTaskConfig::TaskParams.uid().exists(task)) {
std::string msg = format("%s task version `%lu' is greater than supported version `%lu'",
task->params[Task::reservedTaskParamKeyType].toString().c_str(),
(unsigned long)taskVersion,

View File

@ -8647,9 +8647,10 @@ Future<Version> DatabaseContext::verifyBlobRange(const KeyRange& range,
ACTOR Future<std::vector<std::pair<UID, StorageWiggleValue>>> readStorageWiggleValues(Database cx,
bool primary,
bool use_system_priority) {
state const Key readKey = perpetualStorageWigglePrefixFor(primary, PerpetualWigglePrefixType::STORAGE_ID);
state KeyBackedObjectMap<UID, StorageWiggleValue, decltype(IncludeVersion())> metadataMap(readKey,
IncludeVersion());
state StorageWiggleData wiggleState;
state KeyBackedObjectMap<UID, StorageWiggleValue, decltype(IncludeVersion())> metadataMap =
wiggleState.wigglingStorageServer(PrimaryRegion(primary));
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
state KeyBackedRangeResult<std::pair<UID, StorageWiggleValue>> res;

View File

@ -21,7 +21,6 @@
#include "fdbclient/SystemData.h"
#include "fdbclient/BlobGranuleCommon.h"
#include "fdbclient/FDBTypes.h"
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/StorageServerInterface.h"
#include "flow/Arena.h"
#include "flow/TDMetric.actor.h"
@ -872,29 +871,8 @@ const KeyRef perpetualStorageWiggleLocalityKey("\xff/conf/perpetual_storage_wigg
// format "\xff/storageWiggle/[primary | remote]/[fieldName]"
const KeyRef perpetualStorageWiggleIDPrefix("\xff/storageWiggleID/"_sr); // withSuffix /primary/ or /remote/
const KeyRef perpetualStorageWiggleStatsPrefix("\xff/storageWiggleStats/"_sr); // withSuffix /primary or /remote
// "\xff/storageWiggle/[primary | remote]/[fieldName]"
const KeyRef perpetualStorageWigglePrefix("\xff/storageWiggle/"_sr);
// the final char is "/"
const Key perpetualStorageWigglePrefixFor(bool primaryDc, PerpetualWigglePrefixType type) {
if (type == PerpetualWigglePrefixType::STORAGE_ID)
return perpetualStorageWiggleIDPrefix.withSuffix(primaryDc ? "primary/"_sr : "remote/"_sr);
ASSERT(false);
return ""_sr;
}
const Key perpetualStorageWiggleKeyFor(bool primaryDc, PerpetualWiggleKeyType type) {
if (type == PerpetualWiggleKeyType::WIGGLE_STATS)
return perpetualStorageWiggleStatsPrefix.withSuffix(primaryDc ? "primary"_sr : "remote"_sr);
Key result = perpetualStorageWigglePrefix.withSuffix(primaryDc ? "primary/"_sr : "remote/"_sr);
if (type == PerpetualWiggleKeyType::WIGGLE_DELAY)
return result.withSuffix("wiggleDelay"_sr);
ASSERT(false);
return ""_sr;
}
const KeyRef triggerDDTeamInfoPrintKey("\xff/triggerDDTeamInfoPrint"_sr);
const KeyRef consistencyScanInfoKey = "\xff/consistencyScanInfo"_sr;

View File

@ -55,7 +55,106 @@ FDB_DECLARE_BOOLEAN_PARAM(WaitForDestUID);
FDB_DECLARE_BOOLEAN_PARAM(CheckBackupUID);
FDB_DECLARE_BOOLEAN_PARAM(DeleteData);
FDB_DECLARE_BOOLEAN_PARAM(PartialBackup);
FDB_DECLARE_BOOLEAN_PARAM(SetValidation);
// Key backed tags are a single-key slice of the TagUidMap, defined below.
// The Value type of the key is a UidAndAbortedFlagT which is a pair of {UID, aborted_flag}
// All tasks on the UID will have a validation key/value that requires aborted_flag to be
// false, so changing that value, such as changing the UID or setting aborted_flag to true,
// will kill all of the active tasks on that backup/restore UID.
typedef std::pair<UID, bool> UidAndAbortedFlagT;
class KeyBackedTag : public KeyBackedProperty<UidAndAbortedFlagT> {
public:
KeyBackedTag() : KeyBackedProperty(StringRef()) {}
KeyBackedTag(std::string tagName, StringRef tagMapPrefix);
Future<Void> cancel(Reference<ReadYourWritesTransaction> tr) {
std::string tag = tagName;
Key _tagMapPrefix = tagMapPrefix;
return map(get(tr), [tag, _tagMapPrefix, tr](Optional<UidAndAbortedFlagT> up) -> Void {
if (up.present()) {
// Set aborted flag to true
up.get().second = true;
KeyBackedTag(tag, _tagMapPrefix).set(tr, up.get());
}
return Void();
});
}
std::string tagName;
Key tagMapPrefix;
};
typedef KeyBackedMap<std::string, UidAndAbortedFlagT> TagMap;
// Map of tagName to {UID, aborted_flag} located in the fileRestorePrefixRange keyspace.
class TagUidMap : public KeyBackedMap<std::string, UidAndAbortedFlagT> {
ACTOR static Future<std::vector<KeyBackedTag>> getAll_impl(TagUidMap* tagsMap,
Reference<ReadYourWritesTransaction> tr,
Snapshot snapshot);
public:
TagUidMap(const StringRef& prefix) : TagMap("tag->uid/"_sr.withPrefix(prefix)), prefix(prefix) {}
Future<std::vector<KeyBackedTag>> getAll(Reference<ReadYourWritesTransaction> tr,
Snapshot snapshot = Snapshot::False) {
return getAll_impl(this, tr, snapshot);
}
Key prefix;
};
class KeyBackedTaskConfig : public KeyBackedConfig {
public:
static struct {
static TaskParam<UID> uid() { return __FUNCTION__sr; }
} TaskParams;
KeyBackedTaskConfig(StringRef prefix, UID uid = UID()) : KeyBackedConfig(prefix, uid) {}
KeyBackedTaskConfig(StringRef prefix, Reference<Task> task) : KeyBackedConfig(prefix, TaskParams.uid().get(task)) {}
Future<Void> toTask(Reference<ReadYourWritesTransaction> tr,
Reference<Task> task,
SetValidation setValidation = SetValidation::True) {
// Set the uid task parameter
TaskParams.uid().set(task, uid);
if (!setValidation) {
return Void();
}
// Set the validation condition for the task which is that the restore uid's tag's uid is the same as the
// restore uid. Get this uid's tag, then get the KEY for the tag's uid but don't read it. That becomes the
// validation key which TaskBucket will check, and its value must be this restore config's uid.
UID u = uid; // 'this' could be invalid in lambda
Key p = prefix;
return map(tag().get(tr), [u, p, task](Optional<std::string> const& tag) -> Void {
if (!tag.present())
throw restore_error();
// Validation contition is that the uidPair key must be exactly {u, false}
TaskBucket::setValidationCondition(
task, KeyBackedTag(tag.get(), p).key, TupleCodec<UidAndAbortedFlagT>::pack({ u, false }));
return Void();
});
}
// Updates the error per type map and the last error property
Future<Void> updateErrorInfo(Database cx, Error e, std::string message) {
// Avoid capture of this ptr
auto& copy = *this;
return runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) mutable {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
return map(tr->getReadVersion(), [=](Version v) mutable {
copy.lastError().set(tr, { message, v });
copy.lastErrorPerType().set(tr, e.code(), { message, v });
return Void();
});
});
}
};
class BackupAgentBase : NonCopyable {
public:
// Time formatter for anything backup or restore related
@ -643,10 +742,10 @@ inline Reference<IBackupContainer> TupleCodec<Reference<IBackupContainer>>::unpa
return IBackupContainer::openContainer(url, proxy, encryptionKeyFileName);
}
class BackupConfig : public KeyBackedConfig {
class BackupConfig : public KeyBackedTaskConfig {
public:
BackupConfig(UID uid = UID()) : KeyBackedConfig(fileBackupPrefixRange.begin, uid) {}
BackupConfig(Reference<Task> task) : KeyBackedConfig(fileBackupPrefixRange.begin, task) {}
BackupConfig(UID uid = UID()) : KeyBackedTaskConfig(fileBackupPrefixRange.begin, uid) {}
BackupConfig(Reference<Task> task) : KeyBackedTaskConfig(fileBackupPrefixRange.begin, task) {}
// rangeFileMap maps a keyrange file's End to its Begin and Filename
struct RangeSlice {

View File

@ -27,7 +27,7 @@
#include "fdbclient/CommitProxyInterface.h"
#include "fdbclient/DatabaseConfiguration.h"
#include "fdbclient/FDBTypes.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbrpc/fdbrpc.h"
#include "fdbrpc/Locality.h"

View File

@ -535,8 +535,9 @@ Future<ConfigurationResult> changeConfig(Reference<DB> db, std::map<std::string,
}
if (!creating && resetPPWStats) {
wait(resetStorageWiggleMetrics(tr, PrimaryRegion(true)));
wait(resetStorageWiggleMetrics(tr, PrimaryRegion(false)));
state StorageWiggleData wiggleData;
wait(wiggleData.resetStorageWiggleMetrics(tr, PrimaryRegion(true)));
wait(wiggleData.resetStorageWiggleMetrics(tr, PrimaryRegion(false)));
}
tr->addReadConflictRange(singleKeyRange(moveKeysLockOwnerKey));

View File

@ -1,123 +1,46 @@
/*
* KeyBackedConfig.actor.h
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2022 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.
*/
* KeyBackedConfig.actor.h
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2022 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.
*/
#pragma once
#if defined(NO_INTELLISENSE) && !defined(FDBCLIENT_KEYBACKEDCONFIG_G_H)
#define FDBCLIENT_KEYBACKEDCONFIG_G_H
#include "fdbclient/KeyBackedConfig.actor.g.h"
#elif !defined(FDBCLIENT_KEYBACKEDCONFIG_ACTOR_H)
#define FDBCLIENT_KEYBACKEDCONFIG_ACTOR_H
#include "fdbclient/TaskBucket.h"
#include "fdbclient/KeyBackedTypes.h"
#include "flow/actorcompiler.h" // has to be last include
FDB_DECLARE_BOOLEAN_PARAM(SetValidation);
// Key backed tags are a single-key slice of the TagUidMap, defined below.
// The Value type of the key is a UidAndAbortedFlagT which is a pair of {UID, aborted_flag}
// All tasks on the UID will have a validation key/value that requires aborted_flag to be
// false, so changing that value, such as changing the UID or setting aborted_flag to true,
// will kill all of the active tasks on that backup/restore UID.
typedef std::pair<UID, bool> UidAndAbortedFlagT;
class KeyBackedTag : public KeyBackedProperty<UidAndAbortedFlagT> {
public:
KeyBackedTag() : KeyBackedProperty(StringRef()) {}
KeyBackedTag(std::string tagName, StringRef tagMapPrefix);
Future<Void> cancel(Reference<ReadYourWritesTransaction> tr) {
std::string tag = tagName;
Key _tagMapPrefix = tagMapPrefix;
return map(get(tr), [tag, _tagMapPrefix, tr](Optional<UidAndAbortedFlagT> up) -> Void {
if (up.present()) {
// Set aborted flag to true
up.get().second = true;
KeyBackedTag(tag, _tagMapPrefix).set(tr, up.get());
}
return Void();
});
}
std::string tagName;
Key tagMapPrefix;
};
typedef KeyBackedMap<std::string, UidAndAbortedFlagT> TagMap;
// Map of tagName to {UID, aborted_flag} located in the fileRestorePrefixRange keyspace.
class TagUidMap : public KeyBackedMap<std::string, UidAndAbortedFlagT> {
ACTOR static Future<std::vector<KeyBackedTag>> getAll_impl(TagUidMap* tagsMap,
Reference<ReadYourWritesTransaction> tr,
Snapshot snapshot);
public:
TagUidMap(const StringRef& prefix) : TagMap("tag->uid/"_sr.withPrefix(prefix)), prefix(prefix) {}
Future<std::vector<KeyBackedTag>> getAll(Reference<ReadYourWritesTransaction> tr,
Snapshot snapshot = Snapshot::False) {
return getAll_impl(this, tr, snapshot);
}
Key prefix;
};
class KeyBackedConfig {
public:
static struct {
static TaskParam<UID> uid() { return __FUNCTION__sr; }
} TaskParams;
KeyBackedConfig(StringRef prefix, UID uid = UID())
: uid(uid), prefix(prefix), configSpace(uidPrefixKey("uid->config/"_sr.withPrefix(prefix), uid)) {}
KeyBackedConfig(StringRef prefix, Reference<Task> task) : KeyBackedConfig(prefix, TaskParams.uid().get(task)) {}
Future<Void> toTask(Reference<ReadYourWritesTransaction> tr,
Reference<Task> task,
SetValidation setValidation = SetValidation::True) {
// Set the uid task parameter
TaskParams.uid().set(task, uid);
if (!setValidation) {
return Void();
}
// Set the validation condition for the task which is that the restore uid's tag's uid is the same as the
// restore uid. Get this uid's tag, then get the KEY for the tag's uid but don't read it. That becomes the
// validation key which TaskBucket will check, and its value must be this restore config's uid.
UID u = uid; // 'this' could be invalid in lambda
Key p = prefix;
return map(tag().get(tr), [u, p, task](Optional<std::string> const& tag) -> Void {
if (!tag.present())
throw restore_error();
// Validation contition is that the uidPair key must be exactly {u, false}
TaskBucket::setValidationCondition(
task, KeyBackedTag(tag.get(), p).key, TupleCodec<UidAndAbortedFlagT>::pack({ u, false }));
return Void();
});
}
KeyBackedProperty<std::string> tag() { return configSpace.pack(__FUNCTION__sr); }
UID getUid() { return uid; }
Key getUidAsKey() { return BinaryWriter::toValue(uid, Unversioned()); }
void clear(Reference<ReadYourWritesTransaction> tr) { tr->clear(configSpace.range()); }
template <class TrType>
void clear(TrType tr) {
tr->clear(configSpace.range());
}
// lastError is a pair of error message and timestamp expressed as an int64_t
KeyBackedProperty<std::pair<std::string, Version>> lastError() { return configSpace.pack(__FUNCTION__sr); }
@ -126,23 +49,6 @@ public:
return configSpace.pack(__FUNCTION__sr);
}
// Updates the error per type map and the last error property
Future<Void> updateErrorInfo(Database cx, Error e, std::string message) {
// Avoid capture of this ptr
auto& copy = *this;
return runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) mutable {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
return map(tr->getReadVersion(), [=](Version v) mutable {
copy.lastError().set(tr, { message, v });
copy.lastErrorPerType().set(tr, e.code(), { message, v });
return Void();
});
});
}
protected:
UID uid;
Key prefix;
@ -150,4 +56,4 @@ protected:
};
#include "flow/unactorcompiler.h"
#endif //FOUNDATIONDB_KEYBACKEDCONFIG_H
#endif // FOUNDATIONDB_KEYBACKEDCONFIG_H

View File

@ -0,0 +1,85 @@
/*
* RunRYWTransaction.actor.h
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2022 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.
*/
#pragma once
// When actually compiled (NO_INTELLISENSE), include the generated version of this file. In intellisense use the source
// version.
#if defined(NO_INTELLISENSE) && !defined(FDBCLIENT_RUNRYWTRANSACTION_ACTOR_G_H)
#define FDBCLIENT_RUNRYWTRANSACTION_ACTOR_G_H
#include "fdbclient/RunRYWTransaction.actor.g.h"
#elif !defined(FDBCLIENT_RUNRYWTRANSACTION_ACTOR_H)
#define FDBCLIENT_RUNRYWTRANSACTION_ACTOR_H
#include <utility>
#include "flow/flow.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/ReadYourWrites.h"
#include "flow/actorcompiler.h" // This must be the last #include.
ACTOR template <class Function>
Future<decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue())> runRYWTransaction(
Database cx,
Function func) {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
loop {
try {
// func should be idempotent; otherwise, retry will get undefined result
state decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue()) result =
wait(func(tr));
wait(tr->commit());
return result;
} catch (Error& e) {
wait(tr->onError(e));
}
}
}
ACTOR template <class Function>
Future<decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue())>
runRYWTransactionFailIfLocked(Database cx, Function func) {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
loop {
try {
state decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue()) result =
wait(func(tr));
wait(tr->commit());
return result;
} catch (Error& e) {
if (e.code() == error_code_database_locked)
throw;
wait(tr->onError(e));
}
}
}
ACTOR template <class Function>
Future<decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue())> runRYWTransactionNoRetry(
Database cx,
Function func) {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
state decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue()) result = wait(func(tr));
wait(tr->commit());
return result;
}
#include "flow/unactorcompiler.h"
#endif

View File

@ -31,27 +31,8 @@
#include <utility>
#include "flow/flow.h"
#include "fdbclient/ReadYourWrites.h"
#include "flow/actorcompiler.h" // This must be the last #include.
ACTOR template <class Function>
Future<decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue())> runRYWTransaction(
Database cx,
Function func) {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
loop {
try {
// func should be idempotent; otherwise, retry will get undefined result
state decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue()) result =
wait(func(tr));
wait(tr->commit());
return result;
} catch (Error& e) {
wait(tr->onError(e));
}
}
}
ACTOR template <class Function, class DB>
Future<decltype(std::declval<Function>()(Reference<typename DB::TransactionT>()).getValue())> runTransaction(
Reference<DB> db,
@ -70,33 +51,5 @@ Future<decltype(std::declval<Function>()(Reference<typename DB::TransactionT>())
}
}
ACTOR template <class Function>
Future<decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue())>
runRYWTransactionFailIfLocked(Database cx, Function func) {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
loop {
try {
state decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue()) result =
wait(func(tr));
wait(tr->commit());
return result;
} catch (Error& e) {
if (e.code() == error_code_database_locked)
throw;
wait(tr->onError(e));
}
}
}
ACTOR template <class Function>
Future<decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue())> runRYWTransactionNoRetry(
Database cx,
Function func) {
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
state decltype(std::declval<Function>()(Reference<ReadYourWritesTransaction>()).getValue()) result = wait(func(tr));
wait(tr->commit());
return result;
}
#include "flow/unactorcompiler.h"
#endif

View File

@ -1,5 +1,5 @@
/*
* StorageWiggleMetrics.actor.h
* StorageWiggleMetrics.h
*
* This source file is part of the FoundationDB open source project
*
@ -28,8 +28,10 @@
#include "fdbrpc/Smoother.h"
#include "flow/ObjectSerializer.h"
#include "flow/serialize.h"
#include "fdbclient/Status.h"
#include "flow/actorcompiler.h" // This must be the last #include.
#include "fdbclient/SystemData.h"
#include "fdbclient/KeyBackedConfig.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "flow/actorcompiler.h"
FDB_DECLARE_BOOLEAN_PARAM(PrimaryRegion);
@ -103,56 +105,6 @@ struct StorageWiggleMetrics {
}
};
// read from DB
ACTOR template <typename TxnType>
Future<Optional<StorageWiggleMetrics>> loadStorageWiggleMetrics(TxnType tr, PrimaryRegion primary) {
tr->setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::READ_LOCK_AWARE);
auto f = tr->get(perpetualStorageWiggleKeyFor(primary, PerpetualWiggleKeyType::WIGGLE_STATS));
Optional<Value> value = wait(safeThreadFutureToFuture(f));
if (!value.present()) {
return Optional<StorageWiggleMetrics>();
}
return ObjectReader::fromStringRef<StorageWiggleMetrics>(value.get(), IncludeVersion());
}
// update the serialized metrics when the perpetual wiggle is enabled
ACTOR template <typename TxnType>
Future<Void> updateStorageWiggleMetrics(TxnType tr, StorageWiggleMetrics metrics, PrimaryRegion primary) {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
auto f = tr->get(perpetualStorageWiggleKey);
Optional<Value> v = wait(safeThreadFutureToFuture(f));
if (v.present() && v == "1"_sr) {
tr->set(perpetualStorageWiggleKeyFor(primary, PerpetualWiggleKeyType::WIGGLE_STATS),
ObjectWriter::toValue(metrics, IncludeVersion()));
} else {
CODE_PROBE(true, "Intend to update StorageWiggleMetrics after PW disabled");
}
return Void();
}
// set all fields except for smoothed durations to default values. If the metrics is not given, load from system key
// space
ACTOR template <class TrType>
Future<Void> resetStorageWiggleMetrics(TrType tr,
PrimaryRegion primary,
Optional<StorageWiggleMetrics> metrics = Optional<StorageWiggleMetrics>()) {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
if (!metrics.present()) {
wait(store(metrics, loadStorageWiggleMetrics(tr, primary)));
}
if (metrics.present()) {
metrics.get().reset();
tr->set(perpetualStorageWiggleKeyFor(primary, PerpetualWiggleKeyType::WIGGLE_STATS),
ObjectWriter::toValue(metrics.get(), IncludeVersion()));
}
return Void();
}
struct StorageWiggleDelay {
constexpr static FileIdentifier file_identifier = 102937;
double delaySeconds = 0;
@ -164,58 +116,119 @@ struct StorageWiggleDelay {
}
};
namespace {
// Persistent the total delay time to the database, and return accumulated delay time.
ACTOR template <class TrType>
Future<StorageWiggleDelay> readPerpetualWiggleDelay(TrType tr, PrimaryRegion primary) {
tr->setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
Future<double> addPerpetualWiggleDelay_impl(
TrType tr,
KeyBackedObjectProperty<StorageWiggleDelay, decltype(IncludeVersion())> delayProperty,
double secDelta) {
state StorageWiggleDelay delayObj = wait(delayProperty.getD(tr, Snapshot::False));
delayObj.delaySeconds += secDelta;
delayProperty.set(tr, delayObj);
return delayObj.delaySeconds;
}
// set all fields except for smoothed durations to default values. If the metrics is not given, load from system key
// space
ACTOR template <class TrType>
Future<Void> resetStorageWiggleMetrics_impl(
TrType tr,
KeyBackedObjectProperty<StorageWiggleMetrics, decltype(IncludeVersion())> metricsProperty,
Optional<StorageWiggleMetrics> metrics) {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
auto f = tr->get(perpetualStorageWiggleKeyFor(primary, PerpetualWiggleKeyType::WIGGLE_DELAY));
Optional<Value> v = wait(safeThreadFutureToFuture(f));
StorageWiggleDelay delayObj;
if (v.present()) {
delayObj = BinaryReader::fromStringRef<StorageWiggleDelay>(v.get(), IncludeVersion());
if (!metrics.present()) {
wait(store(metrics, metricsProperty.get(tr)));
}
return delayObj;
}
// Persistent the total delay time to the database, and return accumulated delay time.
ACTOR template <class TrType>
Future<double> addPerpetualWiggleDelay(TrType tr, PrimaryRegion primary, double secDelta) {
state double totalDelay = 0;
loop {
tr->reset();
try {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
state StorageWiggleDelay delayObj = wait(readPerpetualWiggleDelay(tr, primary));
delayObj.delaySeconds += secDelta;
totalDelay = delayObj.delaySeconds;
tr->set(perpetualStorageWiggleKeyFor(primary, PerpetualWiggleKeyType::WIGGLE_DELAY),
BinaryWriter::toValue(delayObj, IncludeVersion()));
wait(tr->commit());
break;
} catch (Error& e) {
wait(tr->onError(e));
}
}
return totalDelay;
}
// Persistent the total delay time to the database, and return accumulated delay time.
ACTOR template <class TrType>
Future<Void> clearPerpetualWiggleDelay(TrType tr, PrimaryRegion primary) {
loop {
tr->reset();
try {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
tr->clear(perpetualStorageWiggleKeyFor(primary, PerpetualWiggleKeyType::WIGGLE_DELAY));
wait(tr->commit());
break;
} catch (Error& e) {
wait(tr->onError(e));
}
if (metrics.present()) {
metrics.get().reset();
metricsProperty.set(tr, metrics.get());
}
return Void();
}
} // namespace
// After 7.3, the perpetual wiggle related keys should use format "\xff/storageWiggle/[primary | remote]/[fieldName]"
class StorageWiggleData : public KeyBackedConfig {
public:
StorageWiggleData() : KeyBackedConfig(perpetualStorageWigglePrefix) {}
auto perpetualWiggleSpeed() const { return KeyBackedProperty<Value, NullCodec>(perpetualStorageWiggleKey); }
auto wigglingStorageServer(PrimaryRegion primaryDc) const {
Key mapPrefix = perpetualStorageWiggleIDPrefix.withSuffix(primaryDc ? "primary/"_sr : "remote/"_sr);
return KeyBackedObjectMap<UID, StorageWiggleValue, decltype(IncludeVersion())>(mapPrefix, IncludeVersion());
}
auto storageWiggleMetrics(PrimaryRegion primaryDc) const {
Key key = perpetualStorageWiggleStatsPrefix.withSuffix(primaryDc ? "primary"_sr : "remote"_sr);
return KeyBackedObjectProperty<StorageWiggleMetrics, decltype(IncludeVersion())>(key, IncludeVersion());
}
auto storageWiggleDelay(PrimaryRegion primaryDc) const {
Key key = prefix.withSuffix(primaryDc ? "primary/"_sr : "remote/"_sr).withSuffix("wiggleDelay"_sr);
return KeyBackedObjectProperty<StorageWiggleDelay, decltype(IncludeVersion())>(key, IncludeVersion());
}
// Persistent the total delay time to the database, and return accumulated delay time.
template <class DB>
Future<double> addPerpetualWiggleDelay(Reference<DB> db, PrimaryRegion primary, double secDelta) {
return runTransaction(db, [=, self = *this](Reference<typename DB::TransactionT> tr) {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
return addPerpetualWiggleDelay_impl(tr, self.storageWiggleDelay(primary), secDelta);
});
}
// clear the persistent total delay in database
template <class DB>
Future<Void> clearPerpetualWiggleDelay(Reference<DB> db, PrimaryRegion primary) {
return runTransaction(db, [=, self = *this](Reference<typename DB::TransactionT> tr) {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
self.storageWiggleDelay(primary).clear(tr);
return Future<Void>(Void());
});
}
// set all fields except for smoothed durations to default values. If the metrics is not given, load from system key
// space
template <class TrType>
Future<Void> resetStorageWiggleMetrics(TrType tr,
PrimaryRegion primary,
Optional<StorageWiggleMetrics> metrics = Optional<StorageWiggleMetrics>()) {
return resetStorageWiggleMetrics_impl(tr, storageWiggleMetrics(primary), metrics);
}
ACTOR template <typename TrType>
static Future<Void> updateStorageWiggleMetrics_impl(
KeyBackedProperty<Value, NullCodec> wiggleSpeed,
KeyBackedObjectProperty<StorageWiggleMetrics, decltype(IncludeVersion())> storageMetrics,
TrType tr,
StorageWiggleMetrics metrics,
PrimaryRegion primary) {
tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
Optional<Value> v = wait(wiggleSpeed.get(tr));
if (v.present() && v == "1"_sr) {
storageMetrics.set(tr, metrics);
} else {
CODE_PROBE(true, "Intend to update StorageWiggleMetrics after PW disabled");
}
return Void();
}
// update the serialized metrics when the perpetual wiggle is enabled
template <typename TrType>
Future<Void> updateStorageWiggleMetrics(TrType tr, StorageWiggleMetrics metrics, PrimaryRegion primary) {
return updateStorageWiggleMetrics_impl(
perpetualWiggleSpeed(), storageWiggleMetrics(primary), tr, metrics, primary);
}
};
#include "flow/unactorcompiler.h"
#endif

View File

@ -277,11 +277,7 @@ extern const KeyRef perpetualStorageWiggleKey;
extern const KeyRef perpetualStorageWiggleLocalityKey;
extern const KeyRef perpetualStorageWiggleIDPrefix;
extern const KeyRef perpetualStorageWiggleStatsPrefix;
// the final char is "/"
enum class PerpetualWigglePrefixType { STORAGE_ID };
enum class PerpetualWiggleKeyType { WIGGLE_STATS, WIGGLE_DELAY };
const Key perpetualStorageWigglePrefixFor(bool primaryDc, PerpetualWigglePrefixType type);
const Key perpetualStorageWiggleKeyFor(bool primaryDc, PerpetualWiggleKeyType type);
extern const KeyRef perpetualStorageWigglePrefix;
// Change the value of this key to anything and that will trigger detailed data distribution team info log.
extern const KeyRef triggerDDTeamInfoPrintKey;

View File

@ -28,7 +28,7 @@
#include "fdbclient/FDBTypes.h"
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/Subspace.h"
#include "fdbclient/KeyBackedTypes.h"

View File

@ -29,7 +29,7 @@
#include "fdbclient/DatabaseContext.h"
#include "fdbclient/FDBOptions.g.h"
#include "fdbclient/FDBTypes.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/Tenant.h"
#include "fdbclient/TenantManagement.actor.h"
#include "fdbclient/Knobs.h"

View File

@ -1945,9 +1945,10 @@ public:
}
ACTOR static Future<Void> updateNextWigglingStorageID(DDTeamCollection* self) {
state Key writeKey = perpetualStorageWigglePrefixFor(self->primary, PerpetualWigglePrefixType::STORAGE_ID);
state KeyBackedObjectMap<UID, StorageWiggleValue, decltype(IncludeVersion())> metadataMap(writeKey,
IncludeVersion());
state StorageWiggleData wiggleState;
state KeyBackedObjectMap<UID, StorageWiggleValue, decltype(IncludeVersion())> metadataMap =
wiggleState.wigglingStorageServer(PrimaryRegion(self->primary));
state UID nextId = wait(self->getNextWigglingServerID());
state StorageWiggleValue value(nextId);
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(self->dbContext()));
@ -1976,15 +1977,17 @@ public:
wait(delay(SERVER_KNOBS->PERPETUAL_WIGGLE_DELAY));
return Void();
}
state Reference<ReadYourWritesTransaction> tr = makeReference<ReadYourWritesTransaction>(self->dbContext());
state double nextDelay = 60.0;
while (true) {
wait(delay(nextDelay));
double totalDelay = wait(addPerpetualWiggleDelay(tr, PrimaryRegion(self->primary), nextDelay));
double totalDelay = wait(self->storageWiggler->wiggleData.addPerpetualWiggleDelay(
self->dbContext().getReference(), PrimaryRegion(self->primary), nextDelay));
nextDelay = std::min(SERVER_KNOBS->PERPETUAL_WIGGLE_DELAY - totalDelay, 60.0);
if (totalDelay >= SERVER_KNOBS->PERPETUAL_WIGGLE_DELAY) {
wait(clearPerpetualWiggleDelay(tr, PrimaryRegion(self->primary)));
wait(self->storageWiggler->wiggleData.clearPerpetualWiggleDelay(self->dbContext().getReference(),
PrimaryRegion(self->primary)));
return Void();
}
}
@ -1995,7 +1998,7 @@ public:
state Promise<int64_t> avgShardBytes;
while (takeRest) {
// a minimal delay to avoid excluding and including SS too fast
wait(delay(SERVER_KNOBS->PERPETUAL_WIGGLE_DELAY));
wait(waitPerpetualWiggleDelay(self));
avgShardBytes.reset();
self->getAverageShardBytes.send(avgShardBytes);
@ -2076,8 +2079,9 @@ public:
ACTOR static Future<Void> perpetualStorageWiggler(DDTeamCollection* self,
AsyncVar<bool>* stopSignal,
PromiseStream<Void> finishStorageWiggleSignal) {
state KeyBackedObjectMap<UID, StorageWiggleValue, decltype(IncludeVersion())> metadataMap(
perpetualStorageWigglePrefixFor(self->primary, PerpetualWigglePrefixType::STORAGE_ID), IncludeVersion());
state StorageWiggleData wiggleState;
state KeyBackedObjectMap<UID, StorageWiggleValue, decltype(IncludeVersion())> metadataMap =
wiggleState.wigglingStorageServer(PrimaryRegion(self->primary));
state Future<StorageWiggleValue> nextFuture = Never();
state Future<Void> moveFinishFuture = Never();

View File

@ -27,7 +27,7 @@
#include "fdbclient/FDBTypes.h"
#include "fdbclient/Knobs.h"
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/StorageServerInterface.h"
#include "fdbclient/SystemData.h"
#include "fdbclient/Tenant.h"
@ -182,24 +182,14 @@ Future<Void> StorageWiggler::resetStats() {
metrics.reset();
return runRYWTransaction(
teamCollection->dbContext(), [this](Reference<ReadYourWritesTransaction> tr) -> Future<Void> {
return resetStorageWiggleMetrics(tr, PrimaryRegion(teamCollection->isPrimary()), metrics);
return wiggleData.resetStorageWiggleMetrics(tr, PrimaryRegion(teamCollection->isPrimary()), metrics);
});
}
Future<Void> StorageWiggler::restoreStats() {
auto& metricsRef = metrics;
auto assignFunc = [&metricsRef](Optional<StorageWiggleMetrics> v) {
if (v.present()) {
metricsRef = v.get();
}
return Void();
};
auto readFuture =
runRYWTransaction(teamCollection->dbContext(),
[this](Reference<ReadYourWritesTransaction> tr) -> Future<Optional<StorageWiggleMetrics>> {
return loadStorageWiggleMetrics(tr, PrimaryRegion(teamCollection->isPrimary()));
});
return map(readFuture, assignFunc);
auto readFuture = wiggleData.storageWiggleMetrics(PrimaryRegion(teamCollection->isPrimary()))
.getD(teamCollection->dbContext().getReference(), Snapshot::False, metrics);
return store(metrics, readFuture);
}
Future<Void> StorageWiggler::startWiggle() {
@ -209,7 +199,7 @@ Future<Void> StorageWiggler::startWiggle() {
}
return runRYWTransaction(
teamCollection->dbContext(), [this](Reference<ReadYourWritesTransaction> tr) -> Future<Void> {
return updateStorageWiggleMetrics(tr, metrics, PrimaryRegion(teamCollection->isPrimary()));
return wiggleData.updateStorageWiggleMetrics(tr, metrics, PrimaryRegion(teamCollection->isPrimary()));
});
}
@ -227,7 +217,7 @@ Future<Void> StorageWiggler::finishWiggle() {
}
return runRYWTransaction(
teamCollection->dbContext(), [this](Reference<ReadYourWritesTransaction> tr) -> Future<Void> {
return updateStorageWiggleMetrics(tr, metrics, PrimaryRegion(teamCollection->isPrimary()));
return wiggleData.updateStorageWiggleMetrics(tr, metrics, PrimaryRegion(teamCollection->isPrimary()));
});
}

View File

@ -23,7 +23,7 @@
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/Notified.h"
#include "fdbclient/KeyRangeMap.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/SystemData.h"
#include "fdbserver/WorkerInterface.actor.h"
#include "fdbserver/TLogInterface.h"

View File

@ -24,7 +24,7 @@
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/Notified.h"
#include "fdbclient/KeyRangeMap.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/SystemData.h"
#include "fdbserver/WorkerInterface.actor.h"
#include "fdbserver/TLogInterface.h"

View File

@ -31,7 +31,7 @@
#include "fdbclient/DatabaseContext.h"
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/ReadYourWrites.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/TesterInterface.actor.h"
#include "fdbserver/WorkerInterface.actor.h"

View File

@ -21,7 +21,7 @@
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/MutationList.h"
#include "fdbclient/ReadYourWrites.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbserver/RestoreUtil.h"
#include "fdbserver/RestoreRoleCommon.actor.h"

View File

@ -2914,13 +2914,16 @@ ACTOR Future<std::pair<Optional<StorageWiggleMetrics>, Optional<StorageWiggleMet
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
state Optional<StorageWiggleMetrics> primaryV;
state Optional<StorageWiggleMetrics> remoteV;
state StorageWiggleData wiggleState;
loop {
try {
if (use_system_priority) {
tr->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
}
wait(store(primaryV, loadStorageWiggleMetrics(tr, PrimaryRegion(true))) &&
store(remoteV, loadStorageWiggleMetrics(tr, PrimaryRegion(false))));
tr->setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
tr->setOption(FDBTransactionOptions::READ_LOCK_AWARE);
wait(store(primaryV, wiggleState.storageWiggleMetrics(PrimaryRegion(true)).get(tr)) &&
store(remoteV, wiggleState.storageWiggleMetrics(PrimaryRegion(false)).get(tr)));
return std::make_pair(primaryV, remoteV);
} catch (Error& e) {
wait(tr->onError(e));

View File

@ -23,7 +23,7 @@
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/Notified.h"
#include "fdbclient/KeyRangeMap.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/SystemData.h"
#include "fdbclient/FDBTypes.h"
#include "fdbserver/WorkerInterface.actor.h"

View File

@ -30,7 +30,7 @@
#include "fdbclient/SystemData.h"
#include "fdbclient/DatabaseContext.h"
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbrpc/Replication.h"
#include "fdbserver/DataDistribution.actor.h"
#include "fdbserver/FDBExecHelper.actor.h"

View File

@ -28,7 +28,7 @@
#include "fdbserver/MoveKeys.actor.h"
#include "fdbserver/TenantCache.h"
#include "fdbserver/TCInfo.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbserver/DDTxnProcessor.h"
#include "fdbserver/ShardsAffectedByTeamFailure.h"
#include "fdbserver/Knobs.h"
@ -567,6 +567,8 @@ struct StorageWiggler : ReferenceCounted<StorageWiggler> {
enum State : uint8_t { INVALID = 0, RUN = 1, PAUSE = 2 };
DDTeamCollection const* teamCollection;
StorageWiggleData wiggleData; // the wiggle related data persistent in database
StorageWiggleMetrics metrics;
AsyncVar<bool> stopWiggleSignal;
// data structures

View File

@ -54,10 +54,10 @@ struct RestoreFileFR;
// Restore.actor.h and implementation in RestoreCommon.actor.cpp, so that we can use in both the existing restore and
// the new fast restore subsystems. We use RestoreConfig as a Reference<RestoreConfig>, which leads to some
// non-functional changes in RestoreConfig
class RestoreConfigFR : public KeyBackedConfig, public ReferenceCounted<RestoreConfigFR> {
class RestoreConfigFR : public KeyBackedTaskConfig, public ReferenceCounted<RestoreConfigFR> {
public:
RestoreConfigFR(UID uid = UID()) : KeyBackedConfig(fileRestorePrefixRange.begin, uid) {}
RestoreConfigFR(Reference<Task> task) : KeyBackedConfig(fileRestorePrefixRange.begin, task) {}
RestoreConfigFR(UID uid = UID()) : KeyBackedTaskConfig(fileRestorePrefixRange.begin, uid) {}
RestoreConfigFR(Reference<Task> task) : KeyBackedTaskConfig(fileRestorePrefixRange.begin, task) {}
KeyBackedProperty<ERestoreState> stateEnum();

View File

@ -20,7 +20,7 @@
#include "fdbserver/TesterInterface.actor.h"
#include "fdbclient/ReadYourWrites.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbserver/workloads/workloads.actor.h"
#include "flow/actorcompiler.h" // This must be the last #include.

View File

@ -20,7 +20,7 @@
#include "fdbserver/TesterInterface.actor.h"
#include "fdbclient/ReadYourWrites.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbserver/workloads/workloads.actor.h"
#include "flow/actorcompiler.h" // This must be the last #include.

View File

@ -23,7 +23,7 @@
#include "fdbclient/BackupContainer.h"
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbserver/RestoreWorkerInterface.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbserver/RestoreCommon.actor.h"
#include "fdbserver/workloads/workloads.actor.h"
#include "fdbserver/workloads/BulkSetup.actor.h"

View File

@ -22,7 +22,7 @@
#include "fdbserver/ServerDBInfo.h"
#include "fdbclient/GlobalConfig.actor.h"
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/Tuple.h"
#include "flow/actorcompiler.h" // has to be last include

View File

@ -21,7 +21,7 @@
#include "fdbclient/NativeAPI.actor.h"
#include "fdbserver/TesterInterface.actor.h"
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/workloads/workloads.actor.h"
#include "fdbrpc/simulator.h"

View File

@ -20,7 +20,7 @@
#include "fdbclient/ClusterConnectionMemoryRecord.h"
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/TenantManagement.actor.h"
#include "fdbrpc/simulator.h"
#include "fdbserver/workloads/workloads.actor.h"

View File

@ -26,7 +26,7 @@
#include "fdbclient/Metacluster.h"
#include "fdbclient/MetaclusterManagement.actor.h"
#include "fdbclient/ReadYourWrites.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/TenantManagement.actor.h"
#include "fdbclient/ThreadSafeTransaction.h"
#include "fdbrpc/simulator.h"

View File

@ -169,7 +169,8 @@ struct PerpetualWiggleStatsWorkload : public TestWorkload {
self->lastMetrics = getRandomWiggleMetrics();
auto& lastMetrics = self->lastMetrics;
wait(success(runRYWTransaction(cx, [&lastMetrics](Reference<ReadYourWritesTransaction> tr) -> Future<Void> {
return updateStorageWiggleMetrics(tr, lastMetrics, PrimaryRegion(true));
StorageWiggleData wiggleData;
return wiggleData.updateStorageWiggleMetrics(tr, lastMetrics, PrimaryRegion(true));
})));
return Void();
}

View File

@ -31,7 +31,7 @@
#include "fdbserver/workloads/ReadWriteWorkload.actor.h"
#include "fdbclient/ReadYourWrites.h"
#include "flow/TDMetric.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "flow/actorcompiler.h" // This must be the last #include.
struct SkewedReadWriteWorkload : ReadWriteCommon {

View File

@ -25,7 +25,7 @@
#include "fdbclient/Status.h"
#include "fdbclient/StatusClient.h"
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "flow/actorcompiler.h" // has to be last include
struct SuspendProcessesWorkload : TestWorkload {

View File

@ -28,7 +28,7 @@
#include "fdbclient/KeyBackedTypes.h"
#include "fdbclient/MetaclusterManagement.actor.h"
#include "fdbclient/ReadYourWrites.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "fdbclient/Tenant.h"
#include "fdbclient/TenantManagement.actor.h"
#include "fdbclient/TenantSpecialKeys.actor.h"

View File

@ -21,7 +21,6 @@
#include "fdbrpc/simulator.h"
#include "flow/DeterministicRandom.h"
#include "fdbserver/TesterInterface.actor.h"
#include "fdbserver/QuietDatabase.h"
#include "fdbserver/ServerDBInfo.h"
#include "fdbclient/ThreadSafeTransaction.h"
#include "fdbclient/MultiVersionTransaction.h"

View File

@ -23,7 +23,7 @@
#include "fdbclient/Status.h"
#include "fdbclient/StatusClient.h"
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/RunRYWTransaction.actor.h"
#include "flow/actorcompiler.h" // has to be last include
struct TriggerRecoveryLoopWorkload : TestWorkload {