Skip to content

Commit

Permalink
[flash-423] fix ch fail to start when tidb cluster is not ready. (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanfei1991 authored Aug 27, 2019
1 parent da0cac9 commit 1a9376b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion dbms/src/Server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,19 @@ int Server::main(const std::vector<std::string> & /*args*/)
global_context->setCurrentDatabase(default_database);

/// Then, sync schemas with TiDB, and initialize schema sync service.
global_context->getTMTContext().getSchemaSyncer()->syncSchemas(*global_context);
for (int i = 0; i < 180 ; i++) // retry for 3 mins
{
try
{
global_context->getTMTContext().getSchemaSyncer()->syncSchemas(*global_context);
break;
}
catch (Poco::Exception & e)
{
LOG_ERROR(log, "Bootstrap failed because sync schema error: " << e.displayText() << "\n We will sleep 3 seconds and try again.");
::sleep(1);
}
}
LOG_DEBUG(log, "Sync schemas done.");
global_context->initializeSchemaSyncService();

Expand Down

0 comments on commit 1a9376b

Please sign in to comment.