Skip to content
Snippets Groups Projects
Commit afed17dc authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon:
Browse files

chore: add some logging when joining and updating instances

parent d513eae3
No related branches found
No related tags found
1 merge request!1399Gmoshkin/fix join after expel
......@@ -10,6 +10,7 @@ use crate::schema::ADMIN_ID;
use crate::storage::ClusterwideTable;
use crate::storage::{Clusterwide, ToEntryIter as _};
use crate::tier::Tier;
use crate::tlog;
use crate::traft::op::{Dml, Op};
use crate::traft::{self, RaftId};
use crate::traft::{error::Error, node, Address, PeerAddress, Result};
......@@ -33,7 +34,10 @@ crate::define_rpc_request! {
/// 4. Compare and swap request to commit new instance and its address failed
/// with an error that cannot be retried.
fn proc_raft_join(req: Request) -> Result<Response> {
handle_join_request_and_wait(req, TIMEOUT)
let res = handle_join_request_and_wait(req, TIMEOUT)?;
tlog!(Info, "new instance joined the cluster: {:?}", res.instance);
Ok(res)
}
/// Request to join the cluster.
......
......@@ -9,6 +9,7 @@ use crate::replicaset::Replicaset;
use crate::schema::ADMIN_ID;
use crate::storage::ClusterwideTable;
use crate::tier::Tier;
use crate::tlog;
use crate::traft::op::{Dml, Op};
use crate::traft::Result;
use crate::traft::{error::Error, node};
......@@ -35,8 +36,11 @@ crate::define_rpc_request! {
/// with an error that cannot be retried.
fn proc_update_instance(req: Request) -> Result<Response> {
if req.current_state.is_some() {
return Err(Error::Other("Changing current state through Proc API is not allowed.".into()));
tlog!(Warning, "invalid request to update current state: {req:?}");
return Err(Error::Other("Changing current state through Proc API is not allowed.".into()));
}
tlog!(Debug, "got update instance request: {req:?}");
handle_update_instance_request_and_wait(req, TIMEOUT)?;
Ok(Response {})
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment