fix IKeyValueStore include

This commit is contained in:
Evan Tschannen 2023-06-16 13:28:40 -07:00
parent ac30b3c84f
commit ef682d304e
34 changed files with 158 additions and 120 deletions

View File

@ -38,7 +38,7 @@
#include "fdbclient/CommitProxyInterface.h"
#include "fdbclient/SpecialKeySpace.actor.h"
#include "fdbclient/VersionVector.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbclient/IKeyValueStore.actor.h"
#include "fdbrpc/QueueModel.h"
#include "fdbrpc/MultiInterface.h"
#include "flow/TDMetric.actor.h"

View File

@ -1,5 +1,5 @@
/*
* IKeyValueStore.h
* IKeyValueStore.actor.h
*
* This source file is part of the FoundationDB open source project
*
@ -18,16 +18,23 @@
* limitations under the License.
*/
#ifndef FDBCLIENT_IKEYVALUESTORE_H
#define FDBCLIENT_IKEYVALUESTORE_H
#include "flow/Trace.h"
#pragma once
#if defined(NO_INTELLISENSE) && !defined(FDBCLIENT_IKEYVALUESTORE_ACTOR_G_H)
#define FDBCLIENT_IKEYVALUESTORE_ACTOR_G_H
#include "fdbclient/IKeyValueStore.actor.g.h"
#elif !defined(FDBCLIENT_IKEYVALUESTORE_ACTOR_H)
#define FDBCLIENT_IKEYVALUESTORE_ACTOR_H
#include "flow/Trace.h"
#include "fdbclient/FDBTypes.h"
#include "fdbclient/StorageCheckpoint.h"
#include "fdbclient/Tenant.h"
#include "fdbclient/IClosable.h"
#include "fdbclient/KeyRangeMap.h"
#include "flow/flow.h"
#include "flow/actorcompiler.h" // This must be the last #include.
struct CheckpointRequest {
const Version version; // The FDB version at which the checkpoint is created.
@ -44,6 +51,10 @@ struct CheckpointRequest {
: version(version), ranges(ranges), format(format), checkpointID(id), checkpointDir(checkpointDir) {}
};
ACTOR static Future<Void> replaceRange_impl(class IKeyValueStore* self,
KeyRange range,
Standalone<VectorRef<KeyValueRef>> data);
class IKeyValueStore : public IClosable {
public:
virtual KeyValueStoreType getType() const = 0;
@ -78,7 +89,9 @@ public:
virtual std::vector<std::string> removeRange(KeyRangeRef range) { return std::vector<std::string>(); }
// Replace the specified range, the default implementation ignores `blockRange` and writes the key one by one.
virtual Future<Void> replaceRange(KeyRange range, Standalone<VectorRef<KeyValueRef>> data);
virtual Future<Void> replaceRange(KeyRange range, Standalone<VectorRef<KeyValueRef>> data) {
return replaceRange_impl(this, range, data);
}
// Persists key range and physical shard mapping.
virtual void persistRangeMapping(KeyRangeRef range, bool isAdd) {}
@ -142,60 +155,25 @@ protected:
virtual ~IKeyValueStore() {}
};
extern IKeyValueStore* keyValueStoreSQLite(std::string const& filename,
UID logID,
KeyValueStoreType storeType,
bool checkChecksums = false,
bool checkIntegrity = false);
extern IKeyValueStore* keyValueStoreRedwoodV1(std::string const& filename,
UID logID,
Reference<AsyncVar<struct ServerDBInfo> const> db = {},
Optional<EncryptionAtRestMode> encryptionMode = {},
int64_t pageCacheBytes = 0);
extern IKeyValueStore* keyValueStoreRocksDB(std::string const& path,
UID logID,
KeyValueStoreType storeType,
bool checkChecksums = false,
bool checkIntegrity = false);
extern IKeyValueStore* keyValueStoreShardedRocksDB(std::string const& path,
UID logID,
KeyValueStoreType storeType,
bool checkChecksums = false,
bool checkIntegrity = false);
extern IKeyValueStore* keyValueStoreMemory(std::string const& basename,
UID logID,
int64_t memoryLimit,
std::string ext = "fdq",
KeyValueStoreType storeType = KeyValueStoreType::MEMORY);
extern IKeyValueStore* keyValueStoreLogSystem(class IDiskQueue* queue,
Reference<AsyncVar<struct ServerDBInfo> const> db,
UID logID,
int64_t memoryLimit,
bool disableSnapshot,
bool replaceContent,
bool exactRecovery,
bool enableEncryption);
ACTOR static Future<Void> replaceRange_impl(IKeyValueStore* self,
KeyRange range,
Standalone<VectorRef<KeyValueRef>> data) {
state int sinceYield = 0;
state const KeyValueRef* kvItr = data.begin();
state KeyRangeRef rangeRef = range;
if (rangeRef.empty()) {
return Void();
}
self->clear(rangeRef);
for (; kvItr != data.end(); kvItr++) {
self->set(*kvItr);
if (++sinceYield > 1000) {
wait(yield());
sinceYield = 0;
}
}
return Void();
}
extern IKeyValueStore* openRemoteKVStore(KeyValueStoreType storeType,
std::string const& filename,
UID logID,
int64_t memoryLimit,
bool checkChecksums = false,
bool checkIntegrity = false);
IKeyValueStore* openKVStore(KeyValueStoreType storeType,
std::string const& filename,
UID logID,
int64_t memoryLimit,
bool checkChecksums = false,
bool checkIntegrity = false,
bool openRemotely = false,
Reference<AsyncVar<struct ServerDBInfo> const> db = {},
Optional<EncryptionAtRestMode> encryptionMode = {},
int64_t pageCacheBytes = 0);
void GenerateIOLogChecksumFile(std::string filename);
Future<Void> KVFileCheck(std::string const& filename, bool const& integrity);
Future<Void> KVFileDump(std::string const& filename);
#endif
#include "flow/unactorcompiler.h"
#endif

View File

@ -26,7 +26,7 @@
#include "fdbclient/SystemData.h"
#include "fdbclient/Tenant.h"
#include "fdbserver/ApplyMetadataMutation.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/LogProtocolMessage.h"
#include "fdbserver/LogSystem.h"

View File

@ -45,7 +45,7 @@
#include "fdbserver/ServerDBInfo.actor.h"
#include "fdbserver/ServerDBInfo.h"
#include "fdbserver/WaitFailure.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "flow/Arena.h"
#include "flow/CompressionUtils.h"

View File

@ -45,7 +45,7 @@
#include "fdbserver/DataDistributorInterface.h"
#include "fdbserver/FDBExecHelper.actor.h"
#include "fdbclient/GetEncryptCipherKeys.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/LogSystem.h"
#include "fdbserver/LogSystemDiskQueueAdapter.h"

View File

@ -22,7 +22,7 @@
#include "fdbclient/SystemData.h"
#include "fdbserver/ConfigNode.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/OnDemandStore.h"
#include "flow/Arena.h"
#include "flow/genericactors.actor.h"

View File

@ -23,7 +23,7 @@
#include "fdbclient/ConfigTransactionInterface.h"
#include "fdbserver/CoordinationInterface.h"
#include "fdbserver/ConfigNode.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/OnDemandStore.h"
#include "fdbserver/WorkerInterface.actor.h"

View File

@ -37,7 +37,7 @@
#include "fdbserver/DDTeamCollection.h"
#include "fdbserver/DataDistribution.actor.h"
#include "fdbserver/FDBExecHelper.actor.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/QuietDatabase.h"
#include "fdbserver/ServerDBInfo.h"

View File

@ -1,5 +1,5 @@
/*
* IKeyValueStore.actor.cpp
* IKeyValueStore.cpp
*
* This source file is part of the FoundationDB open source project
*
@ -19,7 +19,7 @@
*/
#include "fdbserver/ServerDBInfo.actor.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "flow/flow.h"
#include "flow/actorcompiler.h" // This must be the last #include.
@ -67,29 +67,4 @@ IKeyValueStore* openKVStore(KeyValueStoreType storeType,
UNREACHABLE();
}
UNREACHABLE(); // FIXME: is this right?
}
ACTOR static Future<Void> replaceRange_impl(IKeyValueStore* self,
KeyRange range,
Standalone<VectorRef<KeyValueRef>> data) {
state int sinceYield = 0;
state const KeyValueRef* kvItr = data.begin();
state KeyRangeRef rangeRef = range;
if (rangeRef.empty()) {
return Void();
}
self->clear(rangeRef);
for (; kvItr != data.end(); kvItr++) {
self->set(*kvItr);
if (++sinceYield > 1000) {
wait(yield());
sinceYield = 0;
}
}
return Void();
}
// Default implementation for replaceRange(), which writes the key one by one.
Future<Void> IKeyValueStore::replaceRange(KeyRange range, Standalone<VectorRef<KeyValueRef>> data) {
return replaceRange_impl(this, range, data);
}
}

View File

@ -18,7 +18,7 @@
* limitations under the License.
*/
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "flow/actorcompiler.h" // has to be last include
// KeyValueStoreCompressTestData wraps an existing IKeyValueStore and

View File

@ -28,7 +28,7 @@
#include "fdbclient/GetEncryptCipherKeys.h"
#include "fdbserver/IDiskQueue.h"
#include "fdbserver/IKeyValueContainer.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/RadixTree.h"
#include "flow/ActorCollection.h"
#include "flow/EncryptUtils.h"

View File

@ -64,7 +64,7 @@
#endif // SSD_ROCKSDB_EXPERIMENTAL
#include "fdbserver/Knobs.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/RocksDBCheckpointUtils.actor.h"
#include "flow/actorcompiler.h" // has to be last include

View File

@ -22,7 +22,7 @@
#define SQLITE_THREADSAFE 0 // also in sqlite3.amalgamation.c!
#include "fmt/format.h"
#include "crc32/crc32c.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/CoroFlow.h"
#include "fdbserver/Knobs.h"
#include "flow/Hash3.h"

View File

@ -42,7 +42,7 @@
#endif // SSD_ROCKSDB_EXPERIMENTAL
#include "fdbserver/Knobs.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/RocksDBCheckpointUtils.actor.h"
#include "flow/actorcompiler.h" // has to be last include

View File

@ -20,7 +20,7 @@
#include "fdbclient/IKnobCollection.h"
#include "fdbrpc/Stats.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/LocalConfiguration.h"
#include "fdbserver/OnDemandStore.h"
#include "flow/UnitTest.h"

View File

@ -27,7 +27,7 @@
#include "fdbserver/WorkerInterface.actor.h"
#include "fdbserver/TLogInterface.h"
#include "fdbserver/Knobs.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "flow/ActorCollection.h"
#include "fdbrpc/FailureMonitor.h"
#include "fdbserver/IDiskQueue.h"

View File

@ -28,7 +28,7 @@
#include "fdbserver/WorkerInterface.actor.h"
#include "fdbserver/TLogInterface.h"
#include "fdbserver/Knobs.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "flow/ActorCollection.h"
#include "fdbrpc/FailureMonitor.h"
#include "fdbserver/IDiskQueue.h"

View File

@ -29,7 +29,7 @@
#include "fdbserver/WorkerInterface.actor.h"
#include "fdbserver/TLogInterface.h"
#include "fdbserver/Knobs.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "flow/ActorCollection.h"
#include "fdbrpc/FailureMonitor.h"
#include "fdbserver/IDiskQueue.h"

View File

@ -18,7 +18,7 @@
* limitations under the License.
*/
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/ServerDBInfo.actor.h"
#include "flow/ActorCollection.h"
#include "flow/Error.h"

View File

@ -28,7 +28,7 @@
#include "fdbrpc/Stats.h"
#include "fdbserver/ApplyMetadataMutation.h"
#include "fdbserver/ConflictSet.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/LogSystem.h"
#include "fdbserver/LogSystemDiskQueueAdapter.h"

View File

@ -30,7 +30,7 @@
#include "fdbserver/SpanContextMessage.h"
#include "fdbserver/TLogInterface.h"
#include "fdbserver/Knobs.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/MutationTracking.h"
#include "flow/ActorCollection.h"
#include "fdbrpc/FailureMonitor.h"

View File

@ -25,7 +25,7 @@
#include "fdbrpc/DDSketch.h"
#include "fdbrpc/simulator.h"
#include "fdbserver/DeltaTree.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/IPager.h"
#include "fdbserver/IPageEncryptionKeyProvider.actor.h"
#include "fdbserver/Knobs.h"

View File

@ -59,7 +59,7 @@
#include "fdbserver/CoroFlow.h"
#include "fdbserver/DataDistribution.actor.h"
#include "fdbserver/FDBExecHelper.actor.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/MoveKeys.actor.h"
#include "fdbserver/NetworkTest.h"
#include "fdbserver/RemoteIKeyValueStore.actor.h"

View File

@ -30,7 +30,7 @@
#include "fdbclient/Notified.h"
#include "fdbclient/StorageServerInterface.h"
#include "fdbclient/SystemData.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/LogProtocolMessage.h"
#include "fdbserver/LogSystem.h"
#include "fdbserver/ProxyCommitData.actor.h"

View File

@ -34,7 +34,7 @@
#include "fdbrpc/Replication.h"
#include "fdbserver/DataDistribution.actor.h"
#include "fdbserver/FDBExecHelper.actor.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/MoveKeys.actor.h"
#include "fdbserver/QuietDatabase.h"

View File

@ -23,7 +23,7 @@
#pragma once
#include "fdbclient/FDBTypes.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "flow/BooleanParam.h"
FDB_BOOLEAN_PARAM(CheckHashes);

View File

@ -0,0 +1,85 @@
/*
* IKeyValueStore.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.
*/
#ifndef FDBSERVER_IKEYVALUESTORE_H
#define FDBSERVER_IKEYVALUESTORE_H
#pragma once
#include "fdbclient/FDBTypes.h"
#include "fdbclient/IKeyValueStore.actor.h"
#include "flow/BooleanParam.h"
extern IKeyValueStore* keyValueStoreSQLite(std::string const& filename,
UID logID,
KeyValueStoreType storeType,
bool checkChecksums = false,
bool checkIntegrity = false);
extern IKeyValueStore* keyValueStoreRedwoodV1(std::string const& filename,
UID logID,
Reference<AsyncVar<struct ServerDBInfo> const> db = {},
Optional<EncryptionAtRestMode> encryptionMode = {},
int64_t pageCacheBytes = 0);
extern IKeyValueStore* keyValueStoreRocksDB(std::string const& path,
UID logID,
KeyValueStoreType storeType,
bool checkChecksums = false,
bool checkIntegrity = false);
extern IKeyValueStore* keyValueStoreShardedRocksDB(std::string const& path,
UID logID,
KeyValueStoreType storeType,
bool checkChecksums = false,
bool checkIntegrity = false);
extern IKeyValueStore* keyValueStoreMemory(std::string const& basename,
UID logID,
int64_t memoryLimit,
std::string ext = "fdq",
KeyValueStoreType storeType = KeyValueStoreType::MEMORY);
extern IKeyValueStore* keyValueStoreLogSystem(class IDiskQueue* queue,
Reference<AsyncVar<struct ServerDBInfo> const> db,
UID logID,
int64_t memoryLimit,
bool disableSnapshot,
bool replaceContent,
bool exactRecovery,
bool enableEncryption);
extern IKeyValueStore* openRemoteKVStore(KeyValueStoreType storeType,
std::string const& filename,
UID logID,
int64_t memoryLimit,
bool checkChecksums = false,
bool checkIntegrity = false);
IKeyValueStore* openKVStore(KeyValueStoreType storeType,
std::string const& filename,
UID logID,
int64_t memoryLimit,
bool checkChecksums = false,
bool checkIntegrity = false,
bool openRemotely = false,
Reference<AsyncVar<struct ServerDBInfo> const> db = {},
Optional<EncryptionAtRestMode> encryptionMode = {},
int64_t pageCacheBytes = 0);
void GenerateIOLogChecksumFile(std::string filename);
Future<Void> KVFileCheck(std::string const& filename, bool const& integrity);
Future<Void> KVFileDump(std::string const& filename);
#endif

View File

@ -23,7 +23,7 @@
#include "flow/Arena.h"
#include "flow/IRandom.h"
#include "flow/Platform.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
// Create a key value store if and only if it is actually used
class OnDemandStore : public IClosable, NonCopyable {

View File

@ -37,7 +37,7 @@
#include "fdbrpc/fdbrpc.h"
#include "fdbclient/FDBTypes.h"
#include "fdbserver/FDBExecHelper.actor.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/Knobs.h"
#include "flow/actorcompiler.h" // This must be the last #include.

View File

@ -72,7 +72,7 @@
#include "fdbrpc/Stats.h"
#include "fdbserver/FDBExecHelper.actor.h"
#include "fdbclient/GetEncryptCipherKeys.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/Knobs.h"
#include "fdbserver/LatencyBandConfig.h"
#include "fdbserver/LogProtocolMessage.h"

View File

@ -51,7 +51,7 @@
#include "fdbclient/EncryptKeyProxyInterface.h"
#include "fdbserver/RoleLineage.actor.h"
#include "fdbserver/WorkerInterface.actor.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/WaitFailure.h"
#include "fdbserver/TesterInterface.actor.h" // for poisson()
#include "fdbserver/IDiskQueue.h"

View File

@ -24,7 +24,7 @@
#include "fmt/format.h"
#include "fdbserver/ServerDBInfo.actor.h"
#include "fdbserver/workloads/workloads.actor.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "flow/ActorCollection.h"
#include "flow/actorcompiler.h" // This must be the last #include.

View File

@ -21,7 +21,7 @@
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbclient/NativeAPI.actor.h"
#include "fdbrpc/simulator.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/MoveKeys.actor.h"
#include "fdbserver/QuietDatabase.h"
#include "fdbserver/ServerCheckpoint.actor.h"

View File

@ -21,7 +21,7 @@
#include "fdbclient/ManagementAPI.actor.h"
#include "fdbclient/NativeAPI.actor.h"
#include "fdbrpc/simulator.h"
#include "fdbclient/IKeyValueStore.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/ServerCheckpoint.actor.h"
#include "fdbserver/MoveKeys.actor.h"
#include "fdbserver/QuietDatabase.h"