Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,4 @@ compile_commands.json

cmake-build-debug/
.cache
_codeql_detected_source_root
23 changes: 23 additions & 0 deletions tx_service/src/sharder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,29 @@ int Sharder::Init(
if (log_agent_ != nullptr)
{
log_agent_->Init(txlog_ips_, txlog_ports_, 0);
// Refresh leader information for all log groups immediately after
// initialization to ensure we have current leader info, especially
// important after cluster restart when leaders may have changed.
uint32_t log_group_count = log_agent_->LogGroupCount();
if (log_group_count == 0)
{
LOG(WARNING)
<< "No log groups found after log agent initialization. "
"Log service may not be properly configured.";
}
else
{
LOG(INFO) << "Refreshing leader info for " << log_group_count
<< " log group(s) after initialization";
for (uint32_t lg_id = 0; lg_id < log_group_count; ++lg_id)
{
// RefreshLeader is typically a lightweight operation that
// updates internal cache. The log service will handle any
// connection issues gracefully with retries.
log_agent_->RefreshLeader(lg_id);
DLOG(INFO) << "Refreshed leader for log group " << lg_id;
}
}
}

#ifdef EXT_TX_PROC_ENABLED
Expand Down