add change

This commit is contained in:
antoniofilipovic 2024-03-05 11:38:12 +01:00
parent 97b0a56b3e
commit 7d9352beb5
2 changed files with 4 additions and 5 deletions

View File

@ -65,7 +65,8 @@ CoordinatorInstance::CoordinatorInstance()
}); });
}, },
[this]() { [this]() {
spdlog::info("Leader changed, stopping all replication instances!"); spdlog::info("Leader changed, trying to stop all replication instances!");
/// TODO Add to pool
auto lock = std::lock_guard{coord_instance_lock_}; // RAII auto lock = std::lock_guard{coord_instance_lock_}; // RAII
repl_instances_.clear(); repl_instances_.clear();
spdlog::info("Leader changed, stopped all replication instances!"); spdlog::info("Leader changed, stopped all replication instances!");
@ -218,14 +219,14 @@ auto CoordinatorInstance::TryFailover() -> void {
spdlog::warn("Failover failed since promoting replica to main failed!"); spdlog::warn("Failover failed since promoting replica to main failed!");
return; return;
} }
spdlog::info("Leader changed, stopping all replication instances!"); spdlog::info("Promote to main done, trying to append update uuid");
// TODO (antoniofilipovic) : This can fail and we don't know we change uuid // TODO (antoniofilipovic) : This can fail and we don't know we change uuid
if (!raft_state_.AppendUpdateUUIDLog(new_main_uuid)) { if (!raft_state_.AppendUpdateUUIDLog(new_main_uuid)) {
return; return;
} }
auto const new_main_instance_name = new_main->InstanceName(); auto const new_main_instance_name = new_main->InstanceName();
spdlog::info("Promote to main done, trying to set instance as main log");
// TODO (antoniofilipovic): This can fail and we don't know we have set up new MAIN // TODO (antoniofilipovic): This can fail and we don't know we have set up new MAIN
if (!raft_state_.AppendSetInstanceAsMainLog(new_main_instance_name)) { if (!raft_state_.AppendSetInstanceAsMainLog(new_main_instance_name)) {
return; return;

View File

@ -265,8 +265,6 @@ void ReplicationStorageClient::RecoverReplica(uint64_t replica_commit, memgraph:
spdlog::debug("Starting replica recovery"); spdlog::debug("Starting replica recovery");
auto *mem_storage = static_cast<InMemoryStorage *>(storage); auto *mem_storage = static_cast<InMemoryStorage *>(storage);
// TODO(antoniofilipovic): Can we get stuck here in while loop if replica commit timestamp is not updated when using
// only snapshot
while (true) { while (true) {
auto file_locker = mem_storage->file_retainer_.AddLocker(); auto file_locker = mem_storage->file_retainer_.AddLocker();