Add macros for literal string ref versions of __FUNCTION__ and __FILE__

This commit is contained in:
A.J. Beamon 2022-09-30 16:05:47 -07:00
parent e1fe28b78b
commit 111bf9e34d
7 changed files with 103 additions and 119 deletions

View File

@ -79,9 +79,9 @@ public:
DRConfig(Reference<Task> task) DRConfig(Reference<Task> task)
: DRConfig(BinaryReader::fromStringRef<UID>(task->params[BackupAgentBase::keyConfigLogUid], Unversioned())) {} : DRConfig(BinaryReader::fromStringRef<UID>(task->params[BackupAgentBase::keyConfigLogUid], Unversioned())) {}
KeyBackedBinaryValue<int64_t> rangeBytesWritten() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> rangeBytesWritten() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedBinaryValue<int64_t> logBytesWritten() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> logBytesWritten() { return configSpace.pack(__FUNCTION__sr); }
void clear(Reference<ReadYourWritesTransaction> tr) { tr->clear(configSpace.range()); } void clear(Reference<ReadYourWritesTransaction> tr) { tr->clear(configSpace.range()); }
@ -136,7 +136,7 @@ struct BackupRangeTaskFunc : TaskFuncBase {
static constexpr uint32_t version = 1; static constexpr uint32_t version = 1;
static struct { static struct {
static TaskParam<int64_t> bytesWritten() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> bytesWritten() { return __FUNCTION__sr; }
} Params; } Params;
static const Key keyAddBackupRangeTasks; static const Key keyAddBackupRangeTasks;
@ -704,7 +704,7 @@ struct CopyLogRangeTaskFunc : TaskFuncBase {
static constexpr uint32_t version = 1; static constexpr uint32_t version = 1;
static struct { static struct {
static TaskParam<int64_t> bytesWritten() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> bytesWritten() { return __FUNCTION__sr; }
} Params; } Params;
static const Key keyNextBeginVersion; static const Key keyNextBeginVersion;
@ -1455,7 +1455,7 @@ struct OldCopyLogRangeTaskFunc : TaskFuncBase {
static constexpr uint32_t version = 1; static constexpr uint32_t version = 1;
static struct { static struct {
static TaskParam<int64_t> bytesWritten() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> bytesWritten() { return __FUNCTION__sr; }
} Params; } Params;
static const Key keyNextBeginVersion; static const Key keyNextBeginVersion;

View File

@ -157,41 +157,37 @@ public:
RestoreConfig(UID uid = UID()) : KeyBackedConfig(fileRestorePrefixRange.begin, uid) {} RestoreConfig(UID uid = UID()) : KeyBackedConfig(fileRestorePrefixRange.begin, uid) {}
RestoreConfig(Reference<Task> task) : KeyBackedConfig(fileRestorePrefixRange.begin, task) {} RestoreConfig(Reference<Task> task) : KeyBackedConfig(fileRestorePrefixRange.begin, task) {}
KeyBackedProperty<ERestoreState> stateEnum() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<ERestoreState> stateEnum() { return configSpace.pack(__FUNCTION__sr); }
Future<StringRef> stateText(Reference<ReadYourWritesTransaction> tr) { Future<StringRef> stateText(Reference<ReadYourWritesTransaction> tr) {
return map(stateEnum().getD(tr), return map(stateEnum().getD(tr),
[](ERestoreState s) -> StringRef { return FileBackupAgent::restoreStateText(s); }); [](ERestoreState s) -> StringRef { return FileBackupAgent::restoreStateText(s); });
} }
KeyBackedProperty<Key> addPrefix() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Key> addPrefix() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<Key> removePrefix() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Key> removePrefix() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<bool> onlyApplyMutationLogs() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<bool> onlyApplyMutationLogs() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<bool> inconsistentSnapshotOnly() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<bool> inconsistentSnapshotOnly() { return configSpace.pack(__FUNCTION__sr); }
// XXX: Remove restoreRange() once it is safe to remove. It has been changed to restoreRanges // XXX: Remove restoreRange() once it is safe to remove. It has been changed to restoreRanges
KeyBackedProperty<KeyRange> restoreRange() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<KeyRange> restoreRange() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<std::vector<KeyRange>> restoreRanges() { KeyBackedProperty<std::vector<KeyRange>> restoreRanges() { return configSpace.pack(__FUNCTION__sr); }
return configSpace.pack(LiteralStringRef(__FUNCTION__)); KeyBackedProperty<Key> batchFuture() { return configSpace.pack(__FUNCTION__sr); }
} KeyBackedProperty<Version> beginVersion() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<Key> batchFuture() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Version> restoreVersion() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<Version> beginVersion() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Version> firstConsistentVersion() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<Version> restoreVersion() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
KeyBackedProperty<Version> firstConsistentVersion() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); }
KeyBackedProperty<Reference<IBackupContainer>> sourceContainer() { KeyBackedProperty<Reference<IBackupContainer>> sourceContainer() { return configSpace.pack(__FUNCTION__sr); }
return configSpace.pack(LiteralStringRef(__FUNCTION__));
}
// Get the source container as a bare URL, without creating a container instance // Get the source container as a bare URL, without creating a container instance
KeyBackedProperty<Value> sourceContainerURL() { return configSpace.pack("sourceContainer"_sr); } KeyBackedProperty<Value> sourceContainerURL() { return configSpace.pack("sourceContainer"_sr); }
// Total bytes written by all log and range restore tasks. // Total bytes written by all log and range restore tasks.
KeyBackedBinaryValue<int64_t> bytesWritten() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> bytesWritten() { return configSpace.pack(__FUNCTION__sr); }
// File blocks that have had tasks created for them by the Dispatch task // File blocks that have had tasks created for them by the Dispatch task
KeyBackedBinaryValue<int64_t> filesBlocksDispatched() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> filesBlocksDispatched() { return configSpace.pack(__FUNCTION__sr); }
// File blocks whose tasks have finished // File blocks whose tasks have finished
KeyBackedBinaryValue<int64_t> fileBlocksFinished() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> fileBlocksFinished() { return configSpace.pack(__FUNCTION__sr); }
// Total number of files in the fileMap // Total number of files in the fileMap
KeyBackedBinaryValue<int64_t> fileCount() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> fileCount() { return configSpace.pack(__FUNCTION__sr); }
// Total number of file blocks in the fileMap // Total number of file blocks in the fileMap
KeyBackedBinaryValue<int64_t> fileBlockCount() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> fileBlockCount() { return configSpace.pack(__FUNCTION__sr); }
Future<std::vector<KeyRange>> getRestoreRangesOrDefault(Reference<ReadYourWritesTransaction> tr) { Future<std::vector<KeyRange>> getRestoreRangesOrDefault(Reference<ReadYourWritesTransaction> tr) {
return getRestoreRangesOrDefault_impl(this, tr); return getRestoreRangesOrDefault_impl(this, tr);
@ -234,7 +230,7 @@ public:
}; };
typedef KeyBackedSet<RestoreFile> FileSetT; typedef KeyBackedSet<RestoreFile> FileSetT;
FileSetT fileSet() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } FileSetT fileSet() { return configSpace.pack(__FUNCTION__sr); }
Future<bool> isRunnable(Reference<ReadYourWritesTransaction> tr) { Future<bool> isRunnable(Reference<ReadYourWritesTransaction> tr) {
return map(stateEnum().getD(tr), [](ERestoreState s) -> bool { return map(stateEnum().getD(tr), [](ERestoreState s) -> bool {
@ -1531,9 +1527,9 @@ struct BackupRangeTaskFunc : BackupTaskFuncBase {
static constexpr uint32_t version = 1; static constexpr uint32_t version = 1;
static struct { static struct {
static TaskParam<Key> beginKey() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Key> beginKey() { return __FUNCTION__sr; }
static TaskParam<Key> endKey() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Key> endKey() { return __FUNCTION__sr; }
static TaskParam<bool> addBackupRangeTasks() { return LiteralStringRef(__FUNCTION__); } static TaskParam<bool> addBackupRangeTasks() { return __FUNCTION__sr; }
} Params; } Params;
std::string toString(Reference<Task> task) const override { std::string toString(Reference<Task> task) const override {
@ -1897,11 +1893,11 @@ struct BackupSnapshotDispatchTask : BackupTaskFuncBase {
static struct { static struct {
// Set by Execute, used by Finish // Set by Execute, used by Finish
static TaskParam<int64_t> shardsBehind() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> shardsBehind() { return __FUNCTION__sr; }
// Set by Execute, used by Finish // Set by Execute, used by Finish
static TaskParam<bool> snapshotFinished() { return LiteralStringRef(__FUNCTION__); } static TaskParam<bool> snapshotFinished() { return __FUNCTION__sr; }
// Set by Execute, used by Finish // Set by Execute, used by Finish
static TaskParam<Version> nextDispatchVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> nextDispatchVersion() { return __FUNCTION__sr; }
} Params; } Params;
StringRef getName() const override { return name; }; StringRef getName() const override { return name; };
@ -2469,10 +2465,10 @@ struct BackupLogRangeTaskFunc : BackupTaskFuncBase {
static constexpr uint32_t version = 1; static constexpr uint32_t version = 1;
static struct { static struct {
static TaskParam<bool> addBackupLogRangeTasks() { return LiteralStringRef(__FUNCTION__); } static TaskParam<bool> addBackupLogRangeTasks() { return __FUNCTION__sr; }
static TaskParam<int64_t> fileSize() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> fileSize() { return __FUNCTION__sr; }
static TaskParam<Version> beginVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> beginVersion() { return __FUNCTION__sr; }
static TaskParam<Version> endVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> endVersion() { return __FUNCTION__sr; }
} Params; } Params;
StringRef getName() const override { return name; }; StringRef getName() const override { return name; };
@ -2710,9 +2706,9 @@ struct EraseLogRangeTaskFunc : BackupTaskFuncBase {
StringRef getName() const override { return name; }; StringRef getName() const override { return name; };
static struct { static struct {
static TaskParam<Version> beginVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> beginVersion() { return __FUNCTION__sr; }
static TaskParam<Version> endVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> endVersion() { return __FUNCTION__sr; }
static TaskParam<Key> destUidValue() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Key> destUidValue() { return __FUNCTION__sr; }
} Params; } Params;
ACTOR static Future<Key> addTask(Reference<ReadYourWritesTransaction> tr, ACTOR static Future<Key> addTask(Reference<ReadYourWritesTransaction> tr,
@ -2784,8 +2780,8 @@ struct BackupLogsDispatchTask : BackupTaskFuncBase {
static constexpr uint32_t version = 1; static constexpr uint32_t version = 1;
static struct { static struct {
static TaskParam<Version> prevBeginVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> prevBeginVersion() { return __FUNCTION__sr; }
static TaskParam<Version> beginVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> beginVersion() { return __FUNCTION__sr; }
} Params; } Params;
ACTOR static Future<Void> _finish(Reference<ReadYourWritesTransaction> tr, ACTOR static Future<Void> _finish(Reference<ReadYourWritesTransaction> tr,
@ -3013,7 +3009,7 @@ struct BackupSnapshotManifest : BackupTaskFuncBase {
static StringRef name; static StringRef name;
static constexpr uint32_t version = 1; static constexpr uint32_t version = 1;
static struct { static struct {
static TaskParam<Version> endVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> endVersion() { return __FUNCTION__sr; }
} Params; } Params;
ACTOR static Future<Void> _execute(Database cx, ACTOR static Future<Void> _execute(Database cx,
@ -3212,7 +3208,7 @@ struct StartFullBackupTaskFunc : BackupTaskFuncBase {
static constexpr uint32_t version = 1; static constexpr uint32_t version = 1;
static struct { static struct {
static TaskParam<Version> beginVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> beginVersion() { return __FUNCTION__sr; }
} Params; } Params;
ACTOR static Future<Void> _execute(Database cx, ACTOR static Future<Void> _execute(Database cx,
@ -3455,9 +3451,9 @@ REGISTER_TASKFUNC(RestoreCompleteTaskFunc);
struct RestoreFileTaskFuncBase : RestoreTaskFuncBase { struct RestoreFileTaskFuncBase : RestoreTaskFuncBase {
struct InputParams { struct InputParams {
static TaskParam<RestoreFile> inputFile() { return LiteralStringRef(__FUNCTION__); } static TaskParam<RestoreFile> inputFile() { return __FUNCTION__sr; }
static TaskParam<int64_t> readOffset() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> readOffset() { return __FUNCTION__sr; }
static TaskParam<int64_t> readLen() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> readLen() { return __FUNCTION__sr; }
} Params; } Params;
std::string toString(Reference<Task> task) const override { std::string toString(Reference<Task> task) const override {
@ -3472,8 +3468,8 @@ struct RestoreRangeTaskFunc : RestoreFileTaskFuncBase {
static struct : InputParams { static struct : InputParams {
// The range of data that the (possibly empty) data represented, which is set if it intersects the target // The range of data that the (possibly empty) data represented, which is set if it intersects the target
// restore range // restore range
static TaskParam<KeyRange> originalFileRange() { return LiteralStringRef(__FUNCTION__); } static TaskParam<KeyRange> originalFileRange() { return __FUNCTION__sr; }
static TaskParam<std::vector<KeyRange>> originalFileRanges() { return LiteralStringRef(__FUNCTION__); } static TaskParam<std::vector<KeyRange>> originalFileRanges() { return __FUNCTION__sr; }
static std::vector<KeyRange> getOriginalFileRanges(Reference<Task> task) { static std::vector<KeyRange> getOriginalFileRanges(Reference<Task> task) {
if (originalFileRanges().exists(task)) { if (originalFileRanges().exists(task)) {
@ -4069,11 +4065,11 @@ struct RestoreDispatchTaskFunc : RestoreTaskFuncBase {
StringRef getName() const override { return name; }; StringRef getName() const override { return name; };
static struct { static struct {
static TaskParam<Version> beginVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> beginVersion() { return __FUNCTION__sr; }
static TaskParam<std::string> beginFile() { return LiteralStringRef(__FUNCTION__); } static TaskParam<std::string> beginFile() { return __FUNCTION__sr; }
static TaskParam<int64_t> beginBlock() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> beginBlock() { return __FUNCTION__sr; }
static TaskParam<int64_t> batchSize() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> batchSize() { return __FUNCTION__sr; }
static TaskParam<int64_t> remainingInBatch() { return LiteralStringRef(__FUNCTION__); } static TaskParam<int64_t> remainingInBatch() { return __FUNCTION__sr; }
} Params; } Params;
ACTOR static Future<Void> _finish(Reference<ReadYourWritesTransaction> tr, ACTOR static Future<Void> _finish(Reference<ReadYourWritesTransaction> tr,
@ -4542,7 +4538,7 @@ struct StartFullRestoreTaskFunc : RestoreTaskFuncBase {
static constexpr uint32_t version = 1; static constexpr uint32_t version = 1;
static struct { static struct {
static TaskParam<Version> firstVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> firstVersion() { return __FUNCTION__sr; }
} Params; } Params;
// Find all files needed for the restore and save them in the RestoreConfig for the task. // Find all files needed for the restore and save them in the RestoreConfig for the task.

View File

@ -143,7 +143,7 @@ public:
futureBucket = std::move(r.futureBucket); futureBucket = std::move(r.futureBucket);
} }
KeyBackedProperty<Key> lastBackupTimestamp() { return config.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Key> lastBackupTimestamp() { return config.pack(__FUNCTION__sr); }
Future<Void> run(Database cx, double pollDelay, int maxConcurrentTasks) { Future<Void> run(Database cx, double pollDelay, int maxConcurrentTasks) {
return taskBucket->run(cx, futureBucket, std::make_shared<double const>(pollDelay), maxConcurrentTasks); return taskBucket->run(cx, futureBucket, std::make_shared<double const>(pollDelay), maxConcurrentTasks);
@ -633,7 +633,7 @@ static inline Future<std::vector<KeyBackedTag>> getAllBackupTags(Reference<ReadY
class KeyBackedConfig { class KeyBackedConfig {
public: public:
static struct { static struct {
static TaskParam<UID> uid() { return LiteralStringRef(__FUNCTION__); } static TaskParam<UID> uid() { return __FUNCTION__sr; }
} TaskParams; } TaskParams;
KeyBackedConfig(StringRef prefix, UID uid = UID()) KeyBackedConfig(StringRef prefix, UID uid = UID())
@ -666,7 +666,7 @@ public:
}); });
} }
KeyBackedProperty<std::string> tag() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<std::string> tag() { return configSpace.pack(__FUNCTION__sr); }
UID getUid() { return uid; } UID getUid() { return uid; }
@ -675,12 +675,10 @@ public:
void clear(Reference<ReadYourWritesTransaction> tr) { tr->clear(configSpace.range()); } void clear(Reference<ReadYourWritesTransaction> tr) { tr->clear(configSpace.range()); }
// lastError is a pair of error message and timestamp expressed as an int64_t // lastError is a pair of error message and timestamp expressed as an int64_t
KeyBackedProperty<std::pair<std::string, Version>> lastError() { KeyBackedProperty<std::pair<std::string, Version>> lastError() { return configSpace.pack(__FUNCTION__sr); }
return configSpace.pack(LiteralStringRef(__FUNCTION__));
}
KeyBackedMap<int64_t, std::pair<std::string, Version>> lastErrorPerType() { KeyBackedMap<int64_t, std::pair<std::string, Version>> lastErrorPerType() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
// Updates the error per type map and the last error property // Updates the error per type map and the last error property
@ -769,47 +767,41 @@ public:
// Map of range end boundaries to info about the backup file written for that range. // Map of range end boundaries to info about the backup file written for that range.
typedef KeyBackedMap<Key, RangeSlice> RangeFileMapT; typedef KeyBackedMap<Key, RangeSlice> RangeFileMapT;
RangeFileMapT snapshotRangeFileMap() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } RangeFileMapT snapshotRangeFileMap() { return configSpace.pack(__FUNCTION__sr); }
// Number of kv range files that were both committed to persistent storage AND inserted into // Number of kv range files that were both committed to persistent storage AND inserted into
// the snapshotRangeFileMap. Note that since insertions could replace 1 or more existing // the snapshotRangeFileMap. Note that since insertions could replace 1 or more existing
// map entries this is not necessarily the number of entries currently in the map. // map entries this is not necessarily the number of entries currently in the map.
// This value exists to help with sizing of kv range folders for BackupContainers that // This value exists to help with sizing of kv range folders for BackupContainers that
// require it. // require it.
KeyBackedBinaryValue<int64_t> snapshotRangeFileCount() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> snapshotRangeFileCount() { return configSpace.pack(__FUNCTION__sr); }
// Coalesced set of ranges already dispatched for writing. // Coalesced set of ranges already dispatched for writing.
typedef KeyBackedMap<Key, bool> RangeDispatchMapT; typedef KeyBackedMap<Key, bool> RangeDispatchMapT;
RangeDispatchMapT snapshotRangeDispatchMap() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } RangeDispatchMapT snapshotRangeDispatchMap() { return configSpace.pack(__FUNCTION__sr); }
// Interval to use for the first (initial) snapshot. // Interval to use for the first (initial) snapshot.
KeyBackedProperty<int64_t> initialSnapshotIntervalSeconds() { KeyBackedProperty<int64_t> initialSnapshotIntervalSeconds() { return configSpace.pack(__FUNCTION__sr); }
return configSpace.pack(LiteralStringRef(__FUNCTION__));
}
// Interval to use for determining the target end version for new snapshots // Interval to use for determining the target end version for new snapshots
KeyBackedProperty<int64_t> snapshotIntervalSeconds() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<int64_t> snapshotIntervalSeconds() { return configSpace.pack(__FUNCTION__sr); }
// When the current snapshot began // When the current snapshot began
KeyBackedProperty<Version> snapshotBeginVersion() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Version> snapshotBeginVersion() { return configSpace.pack(__FUNCTION__sr); }
// When the current snapshot is desired to end. // When the current snapshot is desired to end.
// This can be changed at runtime to speed up or slow down a snapshot // This can be changed at runtime to speed up or slow down a snapshot
KeyBackedProperty<Version> snapshotTargetEndVersion() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Version> snapshotTargetEndVersion() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<int64_t> snapshotBatchSize() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<int64_t> snapshotBatchSize() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<Key> snapshotBatchFuture() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Key> snapshotBatchFuture() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<Key> snapshotBatchDispatchDoneKey() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Key> snapshotBatchDispatchDoneKey() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<int64_t> snapshotDispatchLastShardsBehind() { KeyBackedProperty<int64_t> snapshotDispatchLastShardsBehind() { return configSpace.pack(__FUNCTION__sr); }
return configSpace.pack(LiteralStringRef(__FUNCTION__));
}
KeyBackedProperty<Version> snapshotDispatchLastVersion() { KeyBackedProperty<Version> snapshotDispatchLastVersion() { return configSpace.pack(__FUNCTION__sr); }
return configSpace.pack(LiteralStringRef(__FUNCTION__));
}
Future<Void> initNewSnapshot(Reference<ReadYourWritesTransaction> tr, int64_t intervalSeconds = -1) { Future<Void> initNewSnapshot(Reference<ReadYourWritesTransaction> tr, int64_t intervalSeconds = -1) {
BackupConfig& copy = *this; // Capture this by value instead of this ptr BackupConfig& copy = *this; // Capture this by value instead of this ptr
@ -843,56 +835,50 @@ public:
}); });
} }
KeyBackedBinaryValue<int64_t> rangeBytesWritten() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> rangeBytesWritten() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedBinaryValue<int64_t> logBytesWritten() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedBinaryValue<int64_t> logBytesWritten() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<EBackupState> stateEnum() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<EBackupState> stateEnum() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<Reference<IBackupContainer>> backupContainer() { KeyBackedProperty<Reference<IBackupContainer>> backupContainer() { return configSpace.pack(__FUNCTION__sr); }
return configSpace.pack(LiteralStringRef(__FUNCTION__));
}
// Set to true when all backup workers for saving mutation logs have been started. // Set to true when all backup workers for saving mutation logs have been started.
KeyBackedProperty<bool> allWorkerStarted() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<bool> allWorkerStarted() { return configSpace.pack(__FUNCTION__sr); }
// Each backup worker adds its (epoch, tag.id) to this property. // Each backup worker adds its (epoch, tag.id) to this property.
KeyBackedProperty<std::vector<std::pair<int64_t, int64_t>>> startedBackupWorkers() { KeyBackedProperty<std::vector<std::pair<int64_t, int64_t>>> startedBackupWorkers() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
// Set to true if backup worker is enabled. // Set to true if backup worker is enabled.
KeyBackedProperty<bool> backupWorkerEnabled() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<bool> backupWorkerEnabled() { return configSpace.pack(__FUNCTION__sr); }
// Set to true if partitioned log is enabled (only useful if backup worker is also enabled). // Set to true if partitioned log is enabled (only useful if backup worker is also enabled).
KeyBackedProperty<bool> partitionedLogEnabled() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<bool> partitionedLogEnabled() { return configSpace.pack(__FUNCTION__sr); }
// Set to true if only requesting incremental backup without base snapshot. // Set to true if only requesting incremental backup without base snapshot.
KeyBackedProperty<bool> incrementalBackupOnly() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<bool> incrementalBackupOnly() { return configSpace.pack(__FUNCTION__sr); }
// Latest version for which all prior versions have saved by backup workers. // Latest version for which all prior versions have saved by backup workers.
KeyBackedProperty<Version> latestBackupWorkerSavedVersion() { KeyBackedProperty<Version> latestBackupWorkerSavedVersion() { return configSpace.pack(__FUNCTION__sr); }
return configSpace.pack(LiteralStringRef(__FUNCTION__));
}
// Stop differntial logging if already started or don't start after completing KV ranges // Stop differntial logging if already started or don't start after completing KV ranges
KeyBackedProperty<bool> stopWhenDone() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<bool> stopWhenDone() { return configSpace.pack(__FUNCTION__sr); }
// Enable snapshot backup file encryption // Enable snapshot backup file encryption
KeyBackedProperty<bool> enableSnapshotBackupEncryption() { KeyBackedProperty<bool> enableSnapshotBackupEncryption() { return configSpace.pack(__FUNCTION__sr); }
return configSpace.pack(LiteralStringRef(__FUNCTION__));
}
// Latest version for which all prior versions have had their log copy tasks completed // Latest version for which all prior versions have had their log copy tasks completed
KeyBackedProperty<Version> latestLogEndVersion() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Version> latestLogEndVersion() { return configSpace.pack(__FUNCTION__sr); }
// The end version of the last complete snapshot // The end version of the last complete snapshot
KeyBackedProperty<Version> latestSnapshotEndVersion() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Version> latestSnapshotEndVersion() { return configSpace.pack(__FUNCTION__sr); }
// The end version of the first complete snapshot // The end version of the first complete snapshot
KeyBackedProperty<Version> firstSnapshotEndVersion() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Version> firstSnapshotEndVersion() { return configSpace.pack(__FUNCTION__sr); }
KeyBackedProperty<Key> destUidValue() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<Key> destUidValue() { return configSpace.pack(__FUNCTION__sr); }
Future<Optional<Version>> getLatestRestorableVersion(Reference<ReadYourWritesTransaction> tr) { Future<Optional<Version>> getLatestRestorableVersion(Reference<ReadYourWritesTransaction> tr) {
tr->setOption(FDBTransactionOptions::READ_SYSTEM_KEYS); tr->setOption(FDBTransactionOptions::READ_SYSTEM_KEYS);
@ -923,7 +909,7 @@ public:
}); });
} }
KeyBackedProperty<std::vector<KeyRange>> backupRanges() { return configSpace.pack(LiteralStringRef(__FUNCTION__)); } KeyBackedProperty<std::vector<KeyRange>> backupRanges() { return configSpace.pack(__FUNCTION__sr); }
void startMutationLogs(Reference<ReadYourWritesTransaction> tr, KeyRangeRef backupRange, Key destUidValue) { void startMutationLogs(Reference<ReadYourWritesTransaction> tr, KeyRangeRef backupRange, Key destUidValue) {
Key mutationLogsDestKey = destUidValue.withPrefix(backupLogKeys.begin); Key mutationLogsDestKey = destUidValue.withPrefix(backupLogKeys.begin);

View File

@ -115,7 +115,7 @@ public:
}; };
struct ReservedTaskParams { struct ReservedTaskParams {
static TaskParam<Version> scheduledVersion() { return LiteralStringRef(__FUNCTION__); } static TaskParam<Version> scheduledVersion() { return __FUNCTION__sr; }
}; };
class FutureBucket; class FutureBucket;

View File

@ -48,7 +48,7 @@ TEST_CASE("/flow/actorcompiler/lineNumbers") {
} }
break; break;
} }
ASSERT(LiteralStringRef(__FILE__).endsWith("FlowTests.actor.cpp"_sr)); ASSERT(__FILE__sr.endsWith("FlowTests.actor.cpp"_sr));
return Void(); return Void();
} }

View File

@ -38,33 +38,33 @@
// RestoreCommon.actor.cpp // RestoreCommon.actor.cpp
KeyBackedProperty<ERestoreState> RestoreConfigFR::stateEnum() { KeyBackedProperty<ERestoreState> RestoreConfigFR::stateEnum() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
Future<StringRef> RestoreConfigFR::stateText(Reference<ReadYourWritesTransaction> tr) { Future<StringRef> RestoreConfigFR::stateText(Reference<ReadYourWritesTransaction> tr) {
return map(stateEnum().getD(tr), [](ERestoreState s) -> StringRef { return FileBackupAgent::restoreStateText(s); }); return map(stateEnum().getD(tr), [](ERestoreState s) -> StringRef { return FileBackupAgent::restoreStateText(s); });
} }
KeyBackedProperty<Key> RestoreConfigFR::addPrefix() { KeyBackedProperty<Key> RestoreConfigFR::addPrefix() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
KeyBackedProperty<Key> RestoreConfigFR::removePrefix() { KeyBackedProperty<Key> RestoreConfigFR::removePrefix() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
// XXX: Remove restoreRange() once it is safe to remove. It has been changed to restoreRanges // XXX: Remove restoreRange() once it is safe to remove. It has been changed to restoreRanges
KeyBackedProperty<KeyRange> RestoreConfigFR::restoreRange() { KeyBackedProperty<KeyRange> RestoreConfigFR::restoreRange() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
KeyBackedProperty<std::vector<KeyRange>> RestoreConfigFR::restoreRanges() { KeyBackedProperty<std::vector<KeyRange>> RestoreConfigFR::restoreRanges() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
KeyBackedProperty<Key> RestoreConfigFR::batchFuture() { KeyBackedProperty<Key> RestoreConfigFR::batchFuture() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
KeyBackedProperty<Version> RestoreConfigFR::restoreVersion() { KeyBackedProperty<Version> RestoreConfigFR::restoreVersion() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
KeyBackedProperty<Reference<IBackupContainer>> RestoreConfigFR::sourceContainer() { KeyBackedProperty<Reference<IBackupContainer>> RestoreConfigFR::sourceContainer() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
// Get the source container as a bare URL, without creating a container instance // Get the source container as a bare URL, without creating a container instance
KeyBackedProperty<Value> RestoreConfigFR::sourceContainerURL() { KeyBackedProperty<Value> RestoreConfigFR::sourceContainerURL() {
@ -73,23 +73,23 @@ KeyBackedProperty<Value> RestoreConfigFR::sourceContainerURL() {
// Total bytes written by all log and range restore tasks. // Total bytes written by all log and range restore tasks.
KeyBackedBinaryValue<int64_t> RestoreConfigFR::bytesWritten() { KeyBackedBinaryValue<int64_t> RestoreConfigFR::bytesWritten() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
// File blocks that have had tasks created for them by the Dispatch task // File blocks that have had tasks created for them by the Dispatch task
KeyBackedBinaryValue<int64_t> RestoreConfigFR::filesBlocksDispatched() { KeyBackedBinaryValue<int64_t> RestoreConfigFR::filesBlocksDispatched() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
// File blocks whose tasks have finished // File blocks whose tasks have finished
KeyBackedBinaryValue<int64_t> RestoreConfigFR::fileBlocksFinished() { KeyBackedBinaryValue<int64_t> RestoreConfigFR::fileBlocksFinished() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
// Total number of files in the fileMap // Total number of files in the fileMap
KeyBackedBinaryValue<int64_t> RestoreConfigFR::fileCount() { KeyBackedBinaryValue<int64_t> RestoreConfigFR::fileCount() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
// Total number of file blocks in the fileMap // Total number of file blocks in the fileMap
KeyBackedBinaryValue<int64_t> RestoreConfigFR::fileBlockCount() { KeyBackedBinaryValue<int64_t> RestoreConfigFR::fileBlockCount() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
Future<std::vector<KeyRange>> RestoreConfigFR::getRestoreRangesOrDefault(Reference<ReadYourWritesTransaction> tr) { Future<std::vector<KeyRange>> RestoreConfigFR::getRestoreRangesOrDefault(Reference<ReadYourWritesTransaction> tr) {
@ -108,7 +108,7 @@ ACTOR Future<std::vector<KeyRange>> RestoreConfigFR::getRestoreRangesOrDefault_i
} }
KeyBackedSet<RestoreConfigFR::RestoreFile> RestoreConfigFR::fileSet() { KeyBackedSet<RestoreConfigFR::RestoreFile> RestoreConfigFR::fileSet() {
return configSpace.pack(LiteralStringRef(__FUNCTION__)); return configSpace.pack(__FUNCTION__sr);
} }
Future<bool> RestoreConfigFR::isRunnable(Reference<ReadYourWritesTransaction> tr) { Future<bool> RestoreConfigFR::isRunnable(Reference<ReadYourWritesTransaction> tr) {

View File

@ -740,6 +740,8 @@ StringRef LiteralStringRefHelper(const char* str) {
} }
} // namespace literal_string_ref } // namespace literal_string_ref
#define LiteralStringRef(str) literal_string_ref::LiteralStringRefHelper<decltype(str), sizeof(str)>(str) #define LiteralStringRef(str) literal_string_ref::LiteralStringRefHelper<decltype(str), sizeof(str)>(str)
#define __FILE__sr StringRef(reinterpret_cast<const uint8_t*>(__FILE__), sizeof(__FILE__))
#define __FUNCTION__sr StringRef(reinterpret_cast<const uint8_t*>(__FUNCTION__), sizeof(__FUNCTION__))
template <> template <>
struct fmt::formatter<StringRef> : formatter<std::string_view> { struct fmt::formatter<StringRef> : formatter<std::string_view> {