Skip to content

Commit

Permalink
issue=#982 bugfix.nexus-session-id
Browse files Browse the repository at this point in the history
  • Loading branch information
taocp committed Aug 29, 2016
1 parent 0a7e8ed commit ed4371a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/tabletnode/tabletnode_zk_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ed4371a

Please sign in to comment.