From ed4371a438f03af4ba02b5722155815588f3ae89 Mon Sep 17 00:00:00 2001 From: taocp Date: Wed, 24 Aug 2016 14:36:13 +0800 Subject: [PATCH] issue=#982 bugfix.nexus-session-id --- src/tabletnode/tabletnode_zk_adapter.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tabletnode/tabletnode_zk_adapter.cc b/src/tabletnode/tabletnode_zk_adapter.cc index 359667fc9..eb1013074 100644 --- a/src/tabletnode/tabletnode_zk_adapter.cc +++ b/src/tabletnode/tabletnode_zk_adapter.cc @@ -363,14 +363,15 @@ void InsTabletNodeZkAdapter::Init() { // create session m_ins_sdk = new galaxy::ins::sdk::InsSDK(FLAGS_tera_ins_addr_list); + // create node + std::string lock_key = root_path + kTsListPath + "/" + m_server_addr; + CHECK(m_ins_sdk->Lock(lock_key, &err)) << "register fail"; + // get session id + // session-id may be changed during Lock(), so we must be call Lock() first, and then get the session-id. std::string session_id = m_ins_sdk->GetSessionID(); m_tabletnode_impl->SetSessionId(session_id); m_tabletnode_impl->SetTabletNodeStatus(TabletNodeImpl::kIsRunning); - - // create node - std::string lock_key = root_path + kTsListPath + "/" + m_server_addr; - CHECK(m_ins_sdk->Lock(lock_key, &err)) << "register fail"; LOG(INFO) << "create ts-node success: " << session_id; // create watch node