Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.9k
Add path info of replica in catalog#327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -60,7 +60,7 @@ void HeartbeatServer::heartbeat( | ||
| << "counter:" << google::COUNTER; | ||
| // do heartbeat | ||
| Status st = _heartbeat(master_info); | ||
| Status st = _heartbeat(master_info); | ||
| st.to_thrift(&heartbeat_result.status); | ||
| if (st.ok()) { | ||
| @@ -73,6 +73,8 @@ void HeartbeatServer::heartbeat( | ||
| Status HeartbeatServer::_heartbeat( | ||
| const TMasterInfo& master_info) { | ||
| std::lock_guard<std::mutex> lk(_hb_mtx); | ||
| if (master_info.__isset.backend_ip) { | ||
| if (master_info.backend_ip != BackendOptions::get_localhost()) { | ||
| @@ -104,12 +106,14 @@ Status HeartbeatServer::_heartbeat( | ||
| } | ||
| } | ||
| bool need_report = false; | ||
| if (_master_info->network_address.hostname != master_info.network_address.hostname | ||
| || _master_info->network_address.port != master_info.network_address.port) { | ||
| if (master_info.epoch > _epoch) { | ||
| _master_info->network_address.hostname = master_info.network_address.hostname; | ||
| _master_info->network_address.port = master_info.network_address.port; | ||
| _epoch = master_info.epoch; | ||
| need_report = true; | ||
| LOG(INFO) << "master change. new master host: " << _master_info->network_address.hostname | ||
| << ". port: " << _master_info->network_address.port << ". epoch: " << _epoch; | ||
| } else { | ||
| @@ -119,6 +123,13 @@ Status HeartbeatServer::_heartbeat( | ||
| << " local epoch: " << _epoch << " received epoch: " << master_info.epoch; | ||
| return Status("epoch is not greater than local. ignore heartbeat."); | ||
| } | ||
| } else { | ||
| // when Master FE restarted, host and port remains the same, but epoch will be increased. | ||
| if (master_info.epoch > _epoch) { | ||
| _epoch = master_info.epoch; | ||
| need_report = true; | ||
| LOG(INFO) << "master restarted. epoch: " << _epoch; | ||
| } | ||
| } | ||
| if (master_info.__isset.token) { | ||
| @@ -132,6 +143,11 @@ Status HeartbeatServer::_heartbeat( | ||
| } | ||
| } | ||
| if (need_report) { | ||
| LOG(INFO) << "Master FE is changed or restarted. report tablet and disk info immediately"; | ||
| _olap_engine->report_notify(true); | ||
| } | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed | ||
| return Status::OK; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function may be called concurrently. and changing
_epochand testing_epochwithout any protect would lead to strange resultThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a mutex to protect _heartbeat() function