2017-05-26 04:48:44 +08:00
|
|
|
/*
|
|
|
|
* SystemData.h
|
|
|
|
*
|
|
|
|
* This source file is part of the FoundationDB open source project
|
|
|
|
*
|
|
|
|
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* 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
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FDBCLIENT_SYSTEMDATA_H
|
|
|
|
#define FDBCLIENT_SYSTEMDATA_H
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Functions and constants documenting the organization of the reserved keyspace in the database beginning with "\xFF"
|
|
|
|
|
2018-10-20 01:30:13 +08:00
|
|
|
#include "fdbclient/FDBTypes.h"
|
|
|
|
#include "fdbclient/StorageServerInterface.h"
|
2019-09-26 15:18:37 +08:00
|
|
|
#include "fdbclient/RestoreWorkerInterface.actor.h"
|
2019-09-04 06:50:21 +08:00
|
|
|
|
2020-04-06 05:30:09 +08:00
|
|
|
// Don't warn on constants being defined in this file.
|
|
|
|
#pragma clang diagnostic push
|
|
|
|
#pragma clang diagnostic ignored "-Wunused-variable"
|
|
|
|
|
2019-05-10 11:55:44 +08:00
|
|
|
struct RestoreLoaderInterface;
|
|
|
|
struct RestoreApplierInterface;
|
|
|
|
struct RestoreMasterInterface;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
extern const KeyRangeRef normalKeys; // '' to systemKeys.begin
|
2021-03-11 02:06:03 +08:00
|
|
|
extern const KeyRangeRef systemKeys; // [FF] to [FF][FF]
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRangeRef nonMetadataSystemKeys; // [FF][00] to [FF][01]
|
|
|
|
extern const KeyRangeRef allKeys; // '' to systemKeys.end
|
2020-04-09 05:33:41 +08:00
|
|
|
extern const KeyRangeRef specialKeys; // [FF][FF] to [FF][FF][FF], some client functions are exposed through FDB calls
|
|
|
|
// using these special keys, see pr#2662
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRef afterAllKeys;
|
|
|
|
|
2020-04-06 05:30:09 +08:00
|
|
|
// "\xff/keyServers/[[begin]]" := "[[vector<serverID>, vector<serverID>]|[vector<Tag>, vector<Tag>]]"
|
2021-01-05 04:26:48 +08:00
|
|
|
// An internal mapping of where shards are located in the database. [[begin]] is the start of the shard range
|
|
|
|
// and the result is a list of serverIDs or Tags where these shards are located. These values can be changed
|
|
|
|
// as data movement occurs.
|
2017-07-27 04:45:11 +08:00
|
|
|
extern const KeyRangeRef keyServersKeys, keyServersKeyServersKeys;
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRef keyServersPrefix, keyServersEnd, keyServersKeyServersKey;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key keyServersKey(const KeyRef& k);
|
|
|
|
const KeyRef keyServersKey(const KeyRef& k, Arena& arena);
|
2021-05-04 04:14:16 +08:00
|
|
|
const Value keyServersValue(RangeResult result,
|
2021-03-11 02:06:03 +08:00
|
|
|
const std::vector<UID>& src,
|
|
|
|
const std::vector<UID>& dest = std::vector<UID>());
|
|
|
|
const Value keyServersValue(const std::vector<Tag>& srcTag, const std::vector<Tag>& destTag = std::vector<Tag>());
|
2020-04-06 05:30:09 +08:00
|
|
|
// `result` must be the full result of getting serverTagKeys
|
2021-05-04 04:14:16 +08:00
|
|
|
void decodeKeyServersValue(RangeResult result,
|
2021-03-11 02:06:03 +08:00
|
|
|
const ValueRef& value,
|
|
|
|
std::vector<UID>& src,
|
|
|
|
std::vector<UID>& dest,
|
|
|
|
bool missingIsError = true);
|
|
|
|
void decodeKeyServersValue(std::map<Tag, UID> const& tag_uid,
|
|
|
|
const ValueRef& value,
|
|
|
|
std::vector<UID>& src,
|
|
|
|
std::vector<UID>& dest);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2019-12-07 05:28:44 +08:00
|
|
|
// "\xff/storageCacheServer/[[UID]] := StorageServerInterface"
|
2021-01-05 04:26:48 +08:00
|
|
|
// This will be added by the cache server on initialization and removed by DD
|
|
|
|
// TODO[mpilman]: We will need a way to map uint16_t ids to UIDs in a future
|
|
|
|
// versions. For now caches simply cache everything so the ids
|
|
|
|
// are not yet meaningful.
|
2019-12-07 05:28:44 +08:00
|
|
|
extern const KeyRangeRef storageCacheServerKeys;
|
|
|
|
extern const KeyRef storageCacheServersPrefix, storageCacheServersEnd;
|
|
|
|
const Key storageCacheServerKey(UID id);
|
|
|
|
const Value storageCacheServerValue(const StorageServerInterface& ssi);
|
|
|
|
|
2019-11-13 05:01:29 +08:00
|
|
|
// "\xff/storageCache/[[begin]]" := "[[vector<uint16_t>]]"
|
|
|
|
extern const KeyRangeRef storageCacheKeys;
|
|
|
|
extern const KeyRef storageCachePrefix;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key storageCacheKey(const KeyRef& k);
|
|
|
|
const Value storageCacheValue(const std::vector<uint16_t>& serverIndices);
|
|
|
|
void decodeStorageCacheValue(const ValueRef& value, std::vector<uint16_t>& serverIndices);
|
2019-11-13 05:01:29 +08:00
|
|
|
|
2021-01-07 06:15:31 +08:00
|
|
|
// "\xff/serverKeys/[[serverID]]/[[begin]]" := "[[serverKeysTrue]]" |" [[serverKeysFalse]]"
|
2021-01-05 04:26:48 +08:00
|
|
|
// An internal mapping of what shards any given server currently has ownership of
|
|
|
|
// Using the serverID as a prefix, then followed by the beginning of the shard range
|
|
|
|
// as the key, the value indicates whether the shard does or does not exist on the server.
|
|
|
|
// These values can be changed as data movement occurs.
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRef serverKeysPrefix;
|
|
|
|
extern const ValueRef serverKeysTrue, serverKeysFalse;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key serverKeysKey(UID serverID, const KeyRef& keys);
|
|
|
|
const Key serverKeysPrefixFor(UID serverID);
|
|
|
|
UID serverKeysDecodeServer(const KeyRef& key);
|
|
|
|
bool serverHasKey(ValueRef storedValue);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2020-04-09 03:43:25 +08:00
|
|
|
extern const KeyRangeRef conflictingKeysRange;
|
2020-03-25 00:48:03 +08:00
|
|
|
extern const ValueRef conflictingKeysTrue, conflictingKeysFalse;
|
2020-04-30 05:43:37 +08:00
|
|
|
extern const KeyRangeRef writeConflictRangeKeysRange;
|
|
|
|
extern const KeyRangeRef readConflictRangeKeysRange;
|
2020-05-19 01:36:34 +08:00
|
|
|
extern const KeyRangeRef ddStatsRange;
|
2020-03-25 00:48:03 +08:00
|
|
|
|
2019-11-13 05:01:29 +08:00
|
|
|
extern const KeyRef cacheKeysPrefix;
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key cacheKeysKey(uint16_t idx, const KeyRef& key);
|
|
|
|
const Key cacheKeysPrefixFor(uint16_t idx);
|
|
|
|
uint16_t cacheKeysDecodeIndex(const KeyRef& key);
|
|
|
|
KeyRef cacheKeysDecodeKey(const KeyRef& key);
|
2019-11-13 05:01:29 +08:00
|
|
|
|
|
|
|
extern const KeyRef cacheChangeKey;
|
|
|
|
extern const KeyRangeRef cacheChangeKeys;
|
|
|
|
extern const KeyRef cacheChangePrefix;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key cacheChangeKeyFor(uint16_t idx);
|
|
|
|
uint16_t cacheChangeKeyDecodeIndex(const KeyRef& key);
|
2019-11-13 05:01:29 +08:00
|
|
|
|
2020-04-06 05:30:09 +08:00
|
|
|
// "\xff/serverTag/[[serverID]]" = "[[Tag]]"
|
2021-01-05 04:26:48 +08:00
|
|
|
// Provides the Tag for the given serverID. Used to access a
|
|
|
|
// storage server's corresponding TLog in order to apply mutations.
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRangeRef serverTagKeys;
|
|
|
|
extern const KeyRef serverTagPrefix;
|
2017-08-04 07:16:36 +08:00
|
|
|
extern const KeyRangeRef serverTagMaxKeys;
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRangeRef serverTagConflictKeys;
|
|
|
|
extern const KeyRef serverTagConflictPrefix;
|
2018-01-29 03:52:54 +08:00
|
|
|
extern const KeyRangeRef serverTagHistoryKeys;
|
|
|
|
extern const KeyRef serverTagHistoryPrefix;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key serverTagKeyFor(UID serverID);
|
|
|
|
const Key serverTagHistoryKeyFor(UID serverID);
|
|
|
|
const KeyRange serverTagHistoryRangeFor(UID serverID);
|
|
|
|
const KeyRange serverTagHistoryRangeBefore(UID serverID, Version version);
|
|
|
|
const Value serverTagValue(Tag);
|
|
|
|
UID decodeServerTagKey(KeyRef const&);
|
|
|
|
Version decodeServerTagHistoryKey(KeyRef const&);
|
|
|
|
Tag decodeServerTagValue(ValueRef const&);
|
|
|
|
const Key serverTagConflictKeyFor(Tag);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2017-08-04 07:16:36 +08:00
|
|
|
// "\xff/tagLocalityList/[[datacenterID]]" := "[[tagLocality]]"
|
2021-01-05 04:26:48 +08:00
|
|
|
// Provides the tagLocality for the given datacenterID
|
|
|
|
// See "FDBTypes.h" struct Tag for more details on tagLocality
|
2017-08-04 07:16:36 +08:00
|
|
|
extern const KeyRangeRef tagLocalityListKeys;
|
|
|
|
extern const KeyRef tagLocalityListPrefix;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key tagLocalityListKeyFor(Optional<Value> dcID);
|
|
|
|
const Value tagLocalityListValue(int8_t const&);
|
|
|
|
Optional<Value> decodeTagLocalityListKey(KeyRef const&);
|
|
|
|
int8_t decodeTagLocalityListValue(ValueRef const&);
|
2018-04-09 12:24:05 +08:00
|
|
|
|
2018-11-12 04:37:53 +08:00
|
|
|
// "\xff\x02/datacenterReplicas/[[datacenterID]]" := "[[replicas]]"
|
2021-01-05 04:26:48 +08:00
|
|
|
// Provides the number of replicas for the given datacenterID.
|
|
|
|
// Used in the initialization of the Data Distributor.
|
2018-04-09 12:24:05 +08:00
|
|
|
extern const KeyRangeRef datacenterReplicasKeys;
|
|
|
|
extern const KeyRef datacenterReplicasPrefix;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key datacenterReplicasKeyFor(Optional<Value> dcID);
|
|
|
|
const Value datacenterReplicasValue(int const&);
|
|
|
|
Optional<Value> decodeDatacenterReplicasKey(KeyRef const&);
|
|
|
|
int decodeDatacenterReplicasValue(ValueRef const&);
|
2017-08-04 07:16:36 +08:00
|
|
|
|
2018-11-13 10:42:29 +08:00
|
|
|
// "\xff\x02/tLogDatacenters/[[datacenterID]]"
|
2021-01-05 04:26:48 +08:00
|
|
|
// The existence of an empty string as a value signifies that the datacenterID is valid
|
|
|
|
// (as opposed to having no value at all)
|
2018-11-12 04:37:53 +08:00
|
|
|
extern const KeyRangeRef tLogDatacentersKeys;
|
|
|
|
extern const KeyRef tLogDatacentersPrefix;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key tLogDatacentersKeyFor(Optional<Value> dcID);
|
|
|
|
Optional<Value> decodeTLogDatacentersKey(KeyRef const&);
|
2018-11-12 04:37:53 +08:00
|
|
|
|
2018-06-15 10:36:02 +08:00
|
|
|
extern const KeyRef primaryDatacenterKey;
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
// "\xff/serverList/[[serverID]]" := "[[StorageServerInterface]]"
|
|
|
|
// Storage servers are listed here when they are recruited - always before assigning them keys
|
|
|
|
// Storage servers removed from here are never replaced. The same fdbserver, if re-recruited, will always
|
|
|
|
// have a new ID. When removed from here, a storage server may release all resources and destroy itself.
|
|
|
|
extern const KeyRangeRef serverListKeys;
|
|
|
|
extern const KeyRef serverListPrefix;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key serverListKeyFor(UID serverID);
|
|
|
|
const Value serverListValue(StorageServerInterface const&);
|
|
|
|
UID decodeServerListKey(KeyRef const&);
|
|
|
|
StorageServerInterface decodeServerListValue(ValueRef const&);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
// "\xff/processClass/[[processID]]" := "[[ProcessClass]]"
|
|
|
|
// Contains a mapping from processID to processClass
|
|
|
|
extern const KeyRangeRef processClassKeys;
|
|
|
|
extern const KeyRef processClassPrefix;
|
|
|
|
extern const KeyRef processClassChangeKey;
|
|
|
|
extern const KeyRef processClassVersionKey;
|
|
|
|
extern const ValueRef processClassVersionValue;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key processClassKeyFor(StringRef processID);
|
|
|
|
const Value processClassValue(ProcessClass const&);
|
|
|
|
Key decodeProcessClassKey(KeyRef const&);
|
|
|
|
ProcessClass decodeProcessClassValue(ValueRef const&);
|
|
|
|
UID decodeProcessClassKeyOld(KeyRef const& key);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
// "\xff/conf/[[option]]" := "value"
|
2021-01-05 04:26:48 +08:00
|
|
|
// An umbrella prefix for options mostly used by the DatabaseConfiguration class.
|
|
|
|
// See DatabaseConfiguration.cpp ::setInternal for more examples.
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRangeRef configKeys;
|
|
|
|
extern const KeyRef configKeysPrefix;
|
|
|
|
|
2020-11-13 08:27:55 +08:00
|
|
|
// Change the value of this key to anything and that will trigger detailed data distribution team info log.
|
|
|
|
extern const KeyRef triggerDDTeamInfoPrintKey;
|
2021-01-16 03:35:10 +08:00
|
|
|
|
|
|
|
// The differences between excluded and failed can be found in "command-line-interface.rst"
|
|
|
|
// and in the help message of the fdbcli command "exclude".
|
2021-01-05 04:26:48 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
// "\xff/conf/excluded/1.2.3.4" := ""
|
|
|
|
// "\xff/conf/excluded/1.2.3.4:4000" := ""
|
|
|
|
// These are inside configKeysPrefix since they represent a form of configuration and they are convenient
|
|
|
|
// to track in the same way by the tlog and recovery process, but they are ignored by the DatabaseConfiguration
|
|
|
|
// class.
|
2021-01-05 05:00:12 +08:00
|
|
|
// The existence of an empty string as a value signifies that the provided IP has been excluded.
|
|
|
|
// (as opposed to having no value at all)
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRef excludedServersPrefix;
|
|
|
|
extern const KeyRangeRef excludedServersKeys;
|
2021-03-11 02:06:03 +08:00
|
|
|
extern const KeyRef excludedServersVersionKey; // The value of this key shall be changed by any transaction that
|
|
|
|
// modifies the excluded servers list
|
|
|
|
const AddressExclusion decodeExcludedServersKey(KeyRef const& key); // where key.startsWith(excludedServersPrefix)
|
|
|
|
std::string encodeExcludedServersKey(AddressExclusion const&);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-01-05 04:26:48 +08:00
|
|
|
// "\xff/conf/failed/1.2.3.4" := ""
|
|
|
|
// "\xff/conf/failed/1.2.3.4:4000" := ""
|
|
|
|
// These are inside configKeysPrefix since they represent a form of configuration and they are convenient
|
|
|
|
// to track in the same way by the tlog and recovery process, but they are ignored by the DatabaseConfiguration
|
|
|
|
// class.
|
2021-01-05 05:00:12 +08:00
|
|
|
// The existence of an empty string as a value signifies that the provided IP has been marked as failed.
|
|
|
|
// (as opposed to having no value at all)
|
2019-07-31 02:45:32 +08:00
|
|
|
extern const KeyRef failedServersPrefix;
|
|
|
|
extern const KeyRangeRef failedServersKeys;
|
2021-03-11 02:06:03 +08:00
|
|
|
extern const KeyRef failedServersVersionKey; // The value of this key shall be changed by any transaction that modifies
|
|
|
|
// the failed servers list
|
|
|
|
const AddressExclusion decodeFailedServersKey(KeyRef const& key); // where key.startsWith(failedServersPrefix)
|
|
|
|
std::string encodeFailedServersKey(AddressExclusion const&);
|
2019-07-31 02:45:32 +08:00
|
|
|
|
2021-02-13 10:55:01 +08:00
|
|
|
// "\xff/globalConfig/[[option]]" := "value"
|
|
|
|
// An umbrella prefix for global configuration data synchronized to all nodes.
|
2021-02-20 16:43:54 +08:00
|
|
|
// extern const KeyRangeRef globalConfigData;
|
|
|
|
// extern const KeyRef globalConfigDataPrefix;
|
2021-02-13 10:55:01 +08:00
|
|
|
|
|
|
|
// "\xff/globalConfig/k/[[key]]" := "value"
|
|
|
|
// Key-value pairs that have been set. The range this keyspace represents
|
|
|
|
// contains all globally configured options.
|
|
|
|
extern const KeyRangeRef globalConfigDataKeys;
|
2021-02-20 16:43:54 +08:00
|
|
|
extern const KeyRef globalConfigKeysPrefix;
|
2021-02-13 10:55:01 +08:00
|
|
|
|
|
|
|
// "\xff/globalConfig/h/[[version]]" := "value"
|
|
|
|
// Maps a commit version to a list of mutations made to the global
|
|
|
|
// configuration at that commit. Shipped to nodes periodically. In general,
|
|
|
|
// clients should not write to keys in this keyspace; it will be written
|
|
|
|
// automatically when updating global configuration keys.
|
|
|
|
extern const KeyRangeRef globalConfigHistoryKeys;
|
|
|
|
extern const KeyRef globalConfigHistoryPrefix;
|
|
|
|
|
2021-03-24 07:22:39 +08:00
|
|
|
// "\xff/globalConfig/v" := "version"
|
|
|
|
// Read-only key which returns the commit version of the most recent mutation
|
|
|
|
// made to the global configuration keyspace.
|
2021-02-13 10:55:01 +08:00
|
|
|
extern const KeyRef globalConfigVersionKey;
|
|
|
|
|
2021-01-05 05:00:12 +08:00
|
|
|
// "\xff/workers/[[processID]]" := ""
|
|
|
|
// Asynchronously updated by the cluster controller, this is a list of fdbserver processes that have joined the cluster
|
|
|
|
// and are currently (recently) available
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRangeRef workerListKeys;
|
|
|
|
extern const KeyRef workerListPrefix;
|
2021-03-11 02:06:03 +08:00
|
|
|
const Key workerListKeyFor(StringRef processID);
|
|
|
|
const Value workerListValue(ProcessData const&);
|
|
|
|
Key decodeWorkerListKey(KeyRef const&);
|
|
|
|
ProcessData decodeWorkerListValue(ValueRef const&);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-01-05 05:00:12 +08:00
|
|
|
// "\xff\x02/backupProgress/[[workerID]]" := "[[WorkerBackupStatus]]"
|
2021-01-05 04:26:48 +08:00
|
|
|
// Provides the progress for the given backup worker.
|
|
|
|
// See "FDBTypes.h" struct WorkerBackupStatus for more details on the return type value.
|
2019-05-24 07:06:23 +08:00
|
|
|
extern const KeyRangeRef backupProgressKeys;
|
|
|
|
extern const KeyRef backupProgressPrefix;
|
|
|
|
const Key backupProgressKeyFor(UID workerID);
|
2019-07-30 01:37:42 +08:00
|
|
|
const Value backupProgressValue(const WorkerBackupStatus& status);
|
2019-05-24 07:06:23 +08:00
|
|
|
UID decodeBackupProgressKey(const KeyRef& key);
|
2019-07-30 01:37:42 +08:00
|
|
|
WorkerBackupStatus decodeBackupProgressValue(const ValueRef& value);
|
2019-05-24 07:06:23 +08:00
|
|
|
|
2020-04-03 06:28:51 +08:00
|
|
|
// The key to signal backup workers a new backup job is submitted.
|
|
|
|
// "\xff\x02/backupStarted" := "[[vector<UID,Version1>]]"
|
2020-01-05 06:33:50 +08:00
|
|
|
extern const KeyRef backupStartedKey;
|
2020-01-22 08:57:30 +08:00
|
|
|
Value encodeBackupStartedValue(const std::vector<std::pair<UID, Version>>& ids);
|
|
|
|
std::vector<std::pair<UID, Version>> decodeBackupStartedValue(const ValueRef& value);
|
2020-01-05 06:33:50 +08:00
|
|
|
|
2021-01-05 04:26:48 +08:00
|
|
|
// The key to signal backup workers that they should resume or pause.
|
2020-04-03 06:28:51 +08:00
|
|
|
// "\xff\x02/backupPaused" := "[[0|1]]"
|
2021-01-05 04:26:48 +08:00
|
|
|
// 0 = Send a signal to resume/already resumed.
|
|
|
|
// 1 = Send a signal to pause/already paused.
|
2020-04-03 06:28:51 +08:00
|
|
|
extern const KeyRef backupPausedKey;
|
|
|
|
|
2021-01-05 05:00:12 +08:00
|
|
|
// "\xff/coordinators" = "[[ClusterConnectionString]]"
|
2021-01-05 04:26:48 +08:00
|
|
|
// Set to the encoded structure of the cluster's current set of coordinators.
|
|
|
|
// Changed when performing quorumChange.
|
|
|
|
// See "CoordinationInterface.h" struct ClusterConnectionString for more details
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRef coordinatorsKey;
|
2021-01-05 05:00:12 +08:00
|
|
|
|
|
|
|
// "\xff/logs" = "[[LogsValue]]"
|
|
|
|
// Used during master recovery in order to communicate
|
|
|
|
// and store info about the logs system.
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRef logsKey;
|
2021-01-05 05:00:12 +08:00
|
|
|
|
|
|
|
// "\xff/minRequiredCommitVersion" = "[[Version]]"
|
|
|
|
// Used during backup/recovery to restrict version requirements
|
2017-09-08 08:41:20 +08:00
|
|
|
extern const KeyRef minRequiredCommitVersionKey;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
const Value logsValue(const vector<std::pair<UID, NetworkAddress>>& logs,
|
|
|
|
const vector<std::pair<UID, NetworkAddress>>& oldLogs);
|
|
|
|
std::pair<vector<std::pair<UID, NetworkAddress>>, vector<std::pair<UID, NetworkAddress>>> decodeLogsValue(
|
|
|
|
const ValueRef& value);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2021-01-05 05:00:12 +08:00
|
|
|
// The "global keys" are sent to each storage server any time they are changed
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRef globalKeysPrefix;
|
|
|
|
extern const KeyRef lastEpochEndKey;
|
|
|
|
extern const KeyRef lastEpochEndPrivateKey;
|
2019-02-19 06:30:51 +08:00
|
|
|
extern const KeyRef killStorageKey;
|
|
|
|
extern const KeyRef killStoragePrivateKey;
|
2018-11-09 07:44:03 +08:00
|
|
|
extern const KeyRef rebootWhenDurableKey;
|
|
|
|
extern const KeyRef rebootWhenDurablePrivateKey;
|
2019-02-19 06:40:30 +08:00
|
|
|
extern const KeyRef primaryLocalityKey;
|
|
|
|
extern const KeyRef primaryLocalityPrivateKey;
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRef fastLoggingEnabled;
|
|
|
|
extern const KeyRef fastLoggingEnabledPrivateKey;
|
|
|
|
|
|
|
|
extern const KeyRef moveKeysLockOwnerKey, moveKeysLockWriteKey;
|
|
|
|
|
|
|
|
extern const KeyRef dataDistributionModeKey;
|
|
|
|
extern const UID dataDistributionModeLock;
|
|
|
|
|
2020-04-04 06:24:14 +08:00
|
|
|
// Keys to view and control tag throttling
|
|
|
|
extern const KeyRangeRef tagThrottleKeys;
|
|
|
|
extern const KeyRef tagThrottleKeysPrefix;
|
2020-04-24 11:50:40 +08:00
|
|
|
extern const KeyRef tagThrottleAutoKeysPrefix;
|
2020-04-04 06:24:14 +08:00
|
|
|
extern const KeyRef tagThrottleSignalKey;
|
|
|
|
extern const KeyRef tagThrottleAutoEnabledKey;
|
2020-04-18 02:48:02 +08:00
|
|
|
extern const KeyRef tagThrottleLimitKey;
|
|
|
|
extern const KeyRef tagThrottleCountKey;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
// Log Range constant variables
|
2021-01-05 05:00:12 +08:00
|
|
|
// Used in the backup pipeline to track mutations
|
2021-03-11 02:06:03 +08:00
|
|
|
// \xff/logRanges/[16-byte UID][begin key] := serialize( make_pair([end key], [destination key prefix]),
|
|
|
|
// IncludeVersion() )
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRangeRef logRangesRange;
|
|
|
|
|
|
|
|
// Returns the encoded key comprised of begin key and log uid
|
|
|
|
Key logRangesEncodeKey(KeyRef keyBegin, UID logUid);
|
|
|
|
|
|
|
|
// Returns the start key and optionally the logRange Uid
|
2020-09-21 02:33:09 +08:00
|
|
|
KeyRef logRangesDecodeKey(KeyRef key, UID* logUid = nullptr);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
// Returns the end key and optionally the key prefix
|
2020-09-21 02:33:09 +08:00
|
|
|
Key logRangesDecodeValue(KeyRef keyValue, Key* destKeyPrefix = nullptr);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
// Returns the encoded key value comprised of the end key and destination prefix
|
2018-02-21 05:22:31 +08:00
|
|
|
Key logRangesEncodeValue(KeyRef keyEnd, KeyRef destPath);
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
// Returns a key prefixed with the specified key with
|
|
|
|
// the given uid encoded at the end
|
|
|
|
Key uidPrefixKey(KeyRef keyPrefix, UID logUid);
|
|
|
|
|
2017-12-21 08:54:57 +08:00
|
|
|
/// Apply mutations constant variables
|
|
|
|
|
|
|
|
// applyMutationsEndRange.end defines the highest version for which we have mutations that we can
|
|
|
|
// apply to our database as part of a DR/restore operation.
|
2017-05-26 04:48:44 +08:00
|
|
|
// \xff/applyMutationsEnd/[16-byte UID] := serialize( endVersion, Unversioned() )
|
|
|
|
extern const KeyRangeRef applyMutationsEndRange;
|
|
|
|
|
2017-12-21 08:54:57 +08:00
|
|
|
// applyMutationsBeginRange.begin defines the highest version of what has already been applied by a
|
|
|
|
// DR/restore to the database, and thus also what version is of the next mutation that needs to be
|
|
|
|
// applied to the database.
|
2017-05-26 04:48:44 +08:00
|
|
|
// \xff/applyMutationsBegin/[16-byte UID] := serialize( beginVersion, Unversioned() )
|
|
|
|
extern const KeyRangeRef applyMutationsBeginRange;
|
|
|
|
|
|
|
|
// \xff/applyMutationsAddPrefix/[16-byte UID] := addPrefix
|
|
|
|
extern const KeyRangeRef applyMutationsAddPrefixRange;
|
|
|
|
|
|
|
|
// \xff/applyMutationsRemovePrefix/[16-byte UID] := removePrefix
|
|
|
|
extern const KeyRangeRef applyMutationsRemovePrefixRange;
|
|
|
|
|
|
|
|
extern const KeyRangeRef applyMutationsKeyVersionMapRange;
|
|
|
|
extern const KeyRangeRef applyMutationsKeyVersionCountRange;
|
|
|
|
|
2017-09-30 12:14:08 +08:00
|
|
|
// FdbClient Info prefix
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRangeRef fdbClientInfoPrefixRange;
|
|
|
|
|
2019-06-21 12:38:45 +08:00
|
|
|
// Consistency Check settings
|
|
|
|
extern const KeyRef fdbShouldConsistencyCheckBeSuspended;
|
|
|
|
|
2019-01-19 08:18:34 +08:00
|
|
|
// Request latency measurement key
|
|
|
|
extern const KeyRef latencyBandConfigKey;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2017-09-26 03:40:24 +08:00
|
|
|
// Keyspace to maintain wall clock to version map
|
|
|
|
extern const KeyRangeRef timeKeeperPrefixRange;
|
2017-09-28 07:31:38 +08:00
|
|
|
extern const KeyRef timeKeeperVersionKey;
|
2017-09-29 04:13:24 +08:00
|
|
|
extern const KeyRef timeKeeperDisableKey;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
// Layer status metadata prefix
|
|
|
|
extern const KeyRangeRef layerStatusMetaPrefixRange;
|
|
|
|
|
|
|
|
// Backup agent status root
|
|
|
|
extern const KeyRangeRef backupStatusPrefixRange;
|
|
|
|
|
|
|
|
// Key range reserved by file backup agent to storing configuration and state information
|
|
|
|
extern const KeyRangeRef fileBackupPrefixRange;
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
// Key range reserved by file restore agent (currently part of backup agent functionally separate) for storing
|
|
|
|
// configuration and state information
|
2017-05-26 04:48:44 +08:00
|
|
|
extern const KeyRangeRef fileRestorePrefixRange;
|
|
|
|
|
|
|
|
// Key range reserved by database backup agent to storing configuration and state information
|
|
|
|
extern const KeyRangeRef databaseBackupPrefixRange;
|
|
|
|
|
2018-02-21 05:22:31 +08:00
|
|
|
extern const KeyRef destUidLookupPrefix;
|
|
|
|
extern const KeyRef backupLatestVersionsPrefix;
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
// Key range reserved by backup agent to storing mutations
|
|
|
|
extern const KeyRangeRef backupLogKeys;
|
|
|
|
extern const KeyRangeRef applyLogKeys;
|
|
|
|
|
|
|
|
extern const KeyRef backupVersionKey;
|
|
|
|
extern const ValueRef backupVersionValue;
|
|
|
|
extern const int backupVersion;
|
|
|
|
static const int backupLogPrefixBytes = 8;
|
|
|
|
|
|
|
|
// Use for legacy system support (pre 300)
|
|
|
|
extern const KeyRef backupEnabledKey;
|
|
|
|
|
|
|
|
extern const KeyRef systemTuplesPrefix;
|
|
|
|
extern const KeyRef metricConfChangeKey;
|
|
|
|
|
|
|
|
extern const KeyRangeRef metricConfKeys;
|
|
|
|
extern const KeyRef metricConfPrefix;
|
2021-03-11 02:06:03 +08:00
|
|
|
// const Key metricConfKey( KeyRef const& prefix, struct MetricNameRef const& name, KeyRef const& key );
|
|
|
|
// std::pair<struct MetricNameRef, KeyRef> decodeMetricConfKey( KeyRef const& prefix, KeyRef const& key );
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
extern const KeyRef maxUIDKey;
|
|
|
|
|
|
|
|
extern const KeyRef databaseLockedKey;
|
2020-08-20 10:52:37 +08:00
|
|
|
extern const KeyRef databaseLockedKeyEnd;
|
2019-03-01 09:45:00 +08:00
|
|
|
extern const KeyRef metadataVersionKey;
|
2019-05-16 01:13:38 +08:00
|
|
|
extern const KeyRef metadataVersionKeyEnd;
|
2019-03-01 09:45:00 +08:00
|
|
|
extern const KeyRef metadataVersionRequiredValue;
|
2018-08-22 13:15:45 +08:00
|
|
|
extern const KeyRef mustContainSystemMutationsKey;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2018-10-02 01:43:53 +08:00
|
|
|
// Key range reserved for storing changes to monitor conf files
|
|
|
|
extern const KeyRangeRef monitorConfKeys;
|
|
|
|
|
2019-06-05 13:17:08 +08:00
|
|
|
// Fast restore
|
2018-10-10 09:47:28 +08:00
|
|
|
extern const KeyRef restoreLeaderKey;
|
2018-10-16 09:19:51 +08:00
|
|
|
extern const KeyRangeRef restoreWorkersKeys;
|
2019-06-05 13:17:08 +08:00
|
|
|
extern const KeyRef restoreStatusKey; // To be used when we measure fast restore performance
|
2018-11-30 02:31:47 +08:00
|
|
|
extern const KeyRef restoreRequestTriggerKey;
|
|
|
|
extern const KeyRef restoreRequestDoneKey;
|
|
|
|
extern const KeyRangeRef restoreRequestKeys;
|
2019-10-11 08:18:34 +08:00
|
|
|
extern const KeyRangeRef restoreApplierKeys;
|
|
|
|
extern const KeyRef restoreApplierTxnValue;
|
|
|
|
|
2020-01-15 06:18:41 +08:00
|
|
|
const Key restoreApplierKeyFor(UID const& applierID, int64_t batchIndex, Version version);
|
|
|
|
std::tuple<UID, int64_t, Version> decodeRestoreApplierKey(ValueRef const& key);
|
2019-08-02 08:00:13 +08:00
|
|
|
const Key restoreWorkerKeyFor(UID const& workerID);
|
|
|
|
const Value restoreWorkerInterfaceValue(RestoreWorkerInterface const& server);
|
|
|
|
RestoreWorkerInterface decodeRestoreWorkerInterfaceValue(ValueRef const& value);
|
|
|
|
const Value restoreRequestTriggerValue(UID randomUID, int const numRequests);
|
2019-10-27 05:29:05 +08:00
|
|
|
int decodeRestoreRequestTriggerValue(ValueRef const& value);
|
2019-08-02 08:00:13 +08:00
|
|
|
const Value restoreRequestDoneVersionValue(Version readVersion);
|
|
|
|
Version decodeRestoreRequestDoneVersionValue(ValueRef const& value);
|
|
|
|
const Key restoreRequestKeyFor(int const& index);
|
|
|
|
const Value restoreRequestValue(RestoreRequest const& server);
|
|
|
|
RestoreRequest decodeRestoreRequestValue(ValueRef const& value);
|
|
|
|
const Key restoreStatusKeyFor(StringRef statusType);
|
2019-09-04 06:50:21 +08:00
|
|
|
const Value restoreStatusValue(double val);
|
2018-10-10 09:47:28 +08:00
|
|
|
|
2019-04-02 08:55:13 +08:00
|
|
|
extern const KeyRef healthyZoneKey;
|
2019-07-19 04:18:36 +08:00
|
|
|
extern const StringRef ignoreSSFailuresZoneString;
|
2019-07-10 07:09:51 +08:00
|
|
|
extern const KeyRef rebalanceDDIgnoreKey;
|
2019-04-02 08:55:13 +08:00
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
const Value healthyZoneValue(StringRef const& zoneId, Version version);
|
|
|
|
std::pair<Key, Version> decodeHealthyZoneValue(ValueRef const&);
|
2019-04-02 08:55:13 +08:00
|
|
|
|
2019-04-26 07:57:39 +08:00
|
|
|
// All mutations done to this range are blindly copied into txnStateStore.
|
|
|
|
// Used to create artifically large txnStateStore instances in testing.
|
|
|
|
extern const KeyRangeRef testOnlyTxnStateStorePrefixRange;
|
|
|
|
|
2020-09-03 02:13:58 +08:00
|
|
|
// Snapshot + Incremental Restore
|
2021-01-05 05:59:08 +08:00
|
|
|
|
|
|
|
// "\xff/writeRecovery" = "[[writeRecoveryKeyTrue]]"
|
|
|
|
// Flag used for the snapshot-restore pipeline in order to avoid
|
|
|
|
// anomalous behaviour with multiple recoveries.
|
2020-09-03 02:13:58 +08:00
|
|
|
extern const KeyRef writeRecoveryKey;
|
2020-09-03 03:44:55 +08:00
|
|
|
extern const ValueRef writeRecoveryKeyTrue;
|
2021-01-05 05:59:08 +08:00
|
|
|
|
|
|
|
// "\xff/snapshotEndVersion" = "[[Version]]"
|
|
|
|
// Written by master server during recovery if recovering from a snapshot.
|
2021-03-11 02:06:03 +08:00
|
|
|
// Allows incremental restore to read and set starting version for consistency.
|
2020-09-03 02:13:58 +08:00
|
|
|
extern const KeyRef snapshotEndVersionKey;
|
|
|
|
|
2020-04-06 05:30:09 +08:00
|
|
|
#pragma clang diagnostic pop
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
#endif
|