mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-29 13:10:48 +00:00
Starting nukeeper server
This commit is contained in:
parent
4aa11b3494
commit
c2e6d6cfe8
13
src/Coordination/NuKeeperServer.cpp
Normal file
13
src/Coordination/NuKeeperServer.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <Coordination/NuKeeperServer.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
void NuKeeperServer::addServer(int server_id_, const std::string & server_uri)
|
||||
{
|
||||
if (raft_instance->is_leader())
|
||||
{
|
||||
nuraft::srv_config first_config(server_id, server_uri);
|
||||
}
|
||||
|
||||
}
|
43
src/Coordination/NuKeeperServer.h
Normal file
43
src/Coordination/NuKeeperServer.h
Normal file
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <libnuraft/nuraft.hxx>
|
||||
#include <Coordination/InMemoryLogStore.h>
|
||||
#include <Coordination/InMemoryStateManager.h>
|
||||
#include <Coordination/NuKeeperStateMachine.h>
|
||||
#include <Coordination/TestKeeperStorage.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
class NuKeeperServer
|
||||
{
|
||||
private:
|
||||
int server_id;
|
||||
|
||||
std::string hostname;
|
||||
|
||||
int port;
|
||||
|
||||
std::string endpoint;
|
||||
|
||||
nuraft::ptr<StateMachine> state_machine;
|
||||
|
||||
nuraft::ptr<nuraft::state_mgr> state_manager;
|
||||
|
||||
nuraft::raft_launcher launcher;
|
||||
|
||||
nuraft::ptr<nuraft::raft_server> raft_instance;
|
||||
|
||||
public:
|
||||
NuKeeperServer(int server_id, const std::string & hostname, int port);
|
||||
|
||||
void startup();
|
||||
|
||||
TestKeeperStorage::ResponsesForSessions putRequests(const TestKeeperStorage::RequestsForSessions & requests);
|
||||
|
||||
void addServer(int server_id_, const std::string & server_uri);
|
||||
|
||||
void shutdown();
|
||||
};
|
||||
|
||||
}
|
@ -81,7 +81,6 @@ bool NuKeeperStateMachine::apply_snapshot(nuraft::snapshot & s)
|
||||
|
||||
nuraft::ptr<nuraft::snapshot> NuKeeperStateMachine::last_snapshot()
|
||||
{
|
||||
|
||||
LOG_DEBUG(log, "Trying to get last snapshot");
|
||||
// Just return the latest snapshot.
|
||||
std::lock_guard<std::mutex> lock(snapshots_lock);
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
{
|
||||
return session_id_counter++;
|
||||
}
|
||||
|
||||
ResponsesForSessions processRequest(const Coordination::ZooKeeperRequestPtr & request, int64_t session_id);
|
||||
ResponsesForSessions finalize(const RequestsForSessions & expired_requests);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user