From 793cbe10ef90836624cb01d581e29dfbf3fd9cb1 Mon Sep 17 00:00:00 2001 From: hehechen Date: Wed, 29 Jun 2022 15:51:53 +0800 Subject: [PATCH 1/2] check result of start grpc server Signed-off-by: hehechen --- dbms/src/Server/Server.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dbms/src/Server/Server.cpp b/dbms/src/Server/Server.cpp index 571ba8fe3a5..102284d26d2 100644 --- a/dbms/src/Server/Server.cpp +++ b/dbms/src/Server/Server.cpp @@ -185,6 +185,7 @@ extern const int NO_ELEMENTS_IN_CONFIG; extern const int SUPPORT_IS_DISABLED; extern const int ARGUMENT_OUT_OF_BOUND; extern const int INVALID_CONFIG_PARAMETER; +extern const int IP_ADDRESS_NOT_ALLOWED; } // namespace ErrorCodes namespace Debug @@ -622,6 +623,10 @@ class Server::FlashGrpcServerHolder } } flash_grpc_server = builder.BuildAndStart(); + if (!flash_grpc_server) + { + throw Exception("Exception happens when start grpc server, the flash.service_addr may be wrong, flash.service_addr is " + raft_config.flash_server_addr, ErrorCodes::IP_ADDRESS_NOT_ALLOWED); + } LOG_FMT_INFO(log, "Flash grpc server listening on [{}]", raft_config.flash_server_addr); Debug::setServiceAddr(raft_config.flash_server_addr); if (enable_async_server) From fe21444f44bcba75ec15030f0d9555e3133554fa Mon Sep 17 00:00:00 2001 From: hehechen Date: Wed, 29 Jun 2022 15:56:57 +0800 Subject: [PATCH 2/2] Update Server.cpp --- dbms/src/Server/Server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/Server/Server.cpp b/dbms/src/Server/Server.cpp index 102284d26d2..477844cd509 100644 --- a/dbms/src/Server/Server.cpp +++ b/dbms/src/Server/Server.cpp @@ -625,7 +625,7 @@ class Server::FlashGrpcServerHolder flash_grpc_server = builder.BuildAndStart(); if (!flash_grpc_server) { - throw Exception("Exception happens when start grpc server, the flash.service_addr may be wrong, flash.service_addr is " + raft_config.flash_server_addr, ErrorCodes::IP_ADDRESS_NOT_ALLOWED); + throw Exception("Exception happens when start grpc server, the flash.service_addr may be invalid, flash.service_addr is " + raft_config.flash_server_addr, ErrorCodes::IP_ADDRESS_NOT_ALLOWED); } LOG_FMT_INFO(log, "Flash grpc server listening on [{}]", raft_config.flash_server_addr); Debug::setServiceAddr(raft_config.flash_server_addr);