Add dummy PaxosConfixDatabaseNode implementation

This commit is contained in:
sfc-gh-tclinkenbeard 2021-05-17 14:15:30 -07:00
parent 32f38394b1
commit 641882ef0b
13 changed files with 165 additions and 19 deletions

View File

@ -32,6 +32,7 @@ protected:
public:
virtual ~IConfigTransaction() = default;
// Not implemented:
void setVersion(Version) override { throw client_invalid_operation(); }
Future<Key> getKey(KeySelector const& key, bool snapshot = false) override { throw client_invalid_operation(); }
Future<Standalone<VectorRef<const char*>>> getAddressesForKey(Key const& key) override {
@ -49,4 +50,7 @@ public:
Future<Void> watch(Key const& key) override { throw client_invalid_operation(); }
void addWriteConflictRange(KeyRangeRef const& keys) override { throw client_invalid_operation(); }
Future<Standalone<StringRef>> getVersionstamp() override { throw client_invalid_operation(); }
// Implemented:
void getWriteConflicts(KeyRangeMap<bool>* result) override{};
};

View File

@ -68,6 +68,11 @@ void PaxosConfigTransaction::clear(KeyRef const& key) {
ASSERT(false);
}
void PaxosConfigTransaction::clear(KeyRangeRef const& key) {
// TODO: Implememnt
ASSERT(false);
}
Future<Void> PaxosConfigTransaction::commit() {
// TODO: Implememnt
ASSERT(false);

View File

@ -56,5 +56,4 @@ public:
void reset() override;
void debugTransaction(UID dID) override;
void checkDeferredError() const override;
void getWriteConflicts(KeyRangeMap<bool>* result) override;
};

View File

@ -28,6 +28,7 @@ set(FDBSERVER_SRCS
FDBExecHelper.actor.cpp
FDBExecHelper.actor.h
GrvProxyServer.actor.cpp
IConfigDatabaseNode.cpp
IConfigDatabaseNode.h
IConfigConsumer.h
IDiskQueue.h
@ -71,6 +72,8 @@ set(FDBSERVER_SRCS
Orderer.actor.h
PaxosConfigConsumer.actor.cpp
PaxosConfigConsumer.h
PaxosConfigDatabaseNode.actor.cpp
PaxosConfigDatabaseNode.h
ProxyCommitData.actor.h
pubsub.actor.cpp
pubsub.h

View File

@ -217,13 +217,13 @@ class TransactionEnvironment {
public:
TransactionEnvironment()
: tr(cti), node(makeReference<SimpleConfigDatabaseNode>()), id(deterministicRandom()->randomUniqueID()) {}
: tr(cti), node(IConfigDatabaseNode::createSimple()), id(deterministicRandom()->randomUniqueID()) {}
Future<Void> setup() { return setup(this); }
Future<Void> restart() {
server.cancel();
node = makeReference<SimpleConfigDatabaseNode>();
node = IConfigDatabaseNode::createSimple();
return setup();
}
@ -263,16 +263,15 @@ class TransactionToLocalConfigEnvironment {
public:
TransactionToLocalConfigEnvironment(std::string const& configPath)
: cfi(makeReference<AsyncVar<ConfigFollowerInterface>>()), tr(cti),
node(makeReference<SimpleConfigDatabaseNode>()), nodeID(deterministicRandom()->randomUniqueID()),
localConfiguration(configPath, {}) {}
: cfi(makeReference<AsyncVar<ConfigFollowerInterface>>()), tr(cti), node(IConfigDatabaseNode::createSimple()),
nodeID(deterministicRandom()->randomUniqueID()), localConfiguration(configPath, {}) {}
Future<Void> setup() { return setup(this); }
Future<Void> restartNode() {
cfiServer.cancel();
ctiServer.cancel();
node = makeReference<SimpleConfigDatabaseNode>();
node = IConfigDatabaseNode::createSimple();
return setupNode(this);
}

View File

@ -623,7 +623,7 @@ ACTOR Future<Void> coordinationServer(std::string dataFolder) {
state ConfigFollowerInterface configFollowerInterface;
configTransactionInterface.setupWellKnownEndpoints();
configFollowerInterface.setupWellKnownEndpoints();
state Reference<IConfigDatabaseNode> configDatabaseNode = makeReference<SimpleConfigDatabaseNode>();
state Reference<IConfigDatabaseNode> configDatabaseNode = IConfigDatabaseNode::createSimple();
wait(configDatabaseNode->initialize(dataFolder, deterministicRandom()->randomUniqueID()));
TraceEvent("CoordinationServer", myID)

View File

@ -0,0 +1,31 @@
/*
* IConfigDatabaseNode.actor.cpp
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "fdbserver/IConfigDatabaseNode.h"
#include "fdbserver/PaxosConfigDatabaseNode.h"
#include "fdbserver/SimpleConfigDatabaseNode.h"
Reference<IConfigDatabaseNode> IConfigDatabaseNode::createSimple() {
return makeReference<SimpleConfigDatabaseNode>();
}
Reference<IConfigDatabaseNode> IConfigDatabaseNode::createPaxos() {
return makeReference<PaxosConfigDatabaseNode>();
}

View File

@ -32,15 +32,7 @@ public:
virtual Future<Void> serve(ConfigTransactionInterface const&) = 0;
virtual Future<Void> serve(ConfigFollowerInterface const&) = 0;
virtual Future<Void> initialize(std::string const& dataFolder, UID id) = 0;
};
class SimpleConfigDatabaseNode : public IConfigDatabaseNode {
std::unique_ptr<class SimpleConfigDatabaseNodeImpl> impl;
public:
SimpleConfigDatabaseNode();
~SimpleConfigDatabaseNode();
Future<Void> serve(ConfigTransactionInterface const&) override;
Future<Void> serve(ConfigFollowerInterface const&) override;
Future<Void> initialize(std::string const& dataFolder, UID id) override;
static Reference<IConfigDatabaseNode> createSimple();
static Reference<IConfigDatabaseNode> createPaxos();
};

View File

View File

@ -0,0 +1,45 @@
/*
* PaxosConfigDatabaseNode.actor.cpp
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "fdbserver/PaxosConfigDatabaseNode.h"
class PaxosConfigDatabaseNodeImpl {};
PaxosConfigDatabaseNode::PaxosConfigDatabaseNode() : impl(std::make_unique<PaxosConfigDatabaseNodeImpl>()) {}
PaxosConfigDatabaseNode::~PaxosConfigDatabaseNode() = default;
Future<Void> PaxosConfigDatabaseNode::serve(ConfigTransactionInterface const& cti) {
// TODO: Implement
ASSERT(false);
return Void();
}
Future<Void> PaxosConfigDatabaseNode::serve(ConfigFollowerInterface const& cfi) {
// TODO: Implement
ASSERT(false);
return Void();
}
Future<Void> PaxosConfigDatabaseNode::initialize(std::string const& dataFolder, UID id) {
// TODO: Implement
ASSERT(false);
return Void();
}

View File

@ -0,0 +1,34 @@
/*
* PaxosConfigDatabaseNode.h
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "fdbserver/IConfigDatabaseNode.h"
class PaxosConfigDatabaseNode : public IConfigDatabaseNode {
std::unique_ptr<class PaxosConfigDatabaseNodeImpl> impl;
public:
PaxosConfigDatabaseNode();
~PaxosConfigDatabaseNode();
Future<Void> serve(ConfigTransactionInterface const&) override;
Future<Void> serve(ConfigFollowerInterface const&) override;
Future<Void> initialize(std::string const& dataFolder, UID id) override;
};

View File

@ -20,7 +20,7 @@
#include <map>
#include "fdbserver/IConfigDatabaseNode.h"
#include "fdbserver/SimpleConfigDatabaseNode.h"
#include "fdbserver/IKeyValueStore.h"
#include "flow/Arena.h"
#include "flow/genericactors.actor.h"

View File

@ -0,0 +1,34 @@
/*
* SimpleConfigDatabaseNode.h
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "fdbserver/IConfigDatabaseNode.h"
class SimpleConfigDatabaseNode : public IConfigDatabaseNode {
std::unique_ptr<class SimpleConfigDatabaseNodeImpl> impl;
public:
SimpleConfigDatabaseNode();
~SimpleConfigDatabaseNode();
Future<Void> serve(ConfigTransactionInterface const&) override;
Future<Void> serve(ConfigFollowerInterface const&) override;
Future<Void> initialize(std::string const& dataFolder, UID id) override;
};