Skip to content
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

Add heartbeat processor #343

Merged
merged 5 commits into from
May 13, 2019
Merged

Add heartbeat processor #343

merged 5 commits into from
May 13, 2019

Conversation

dangleptr
Copy link
Contributor

@dangleptr dangleptr commented May 8, 2019

Subtask of #283

@dangleptr dangleptr requested review from ayyt, darionyaphet, sherman-the-tank, boshengchen and dutor and removed request for darionyaphet May 8, 2019 12:35
@nebula-community-bot
Copy link
Member

Unit testing passed.

"Check the expired hosts at the interval");
DEFINE_int32(expired_threshold_sec, 10 * 60,
"Hosts will be expired in this time if no heartbeat received");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a parameter check be better? for example :
static bool checkHBFlags(const char* fn, int32_t th) {
   if (FLAGS_expired_hosts_check_interval_sec > th) 
     return false;
   return true;
}
static const bool invalid = RegisterFlagValidator(&FLAGS_expired_threshold_sec, &checkHBFlags);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

auto hostKey = MetaServiceUtils::hostKey(h.ip, h.port);
auto ret = hostExist(hostKey);
if (!ret.ok()) {
LOG(WARNING) << "The host [" << h.ip << ":" << h.port << "] not existed!";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here ip is int32, not dotted decimal IP string, so even if you put it into the log, the user can't understand.

so I think we should put dotted decimal IP string to log.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. I noticed output HostAddr to stream has been supported.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, output HostAddr to stream has been supported. 👍

so here we should output h.

HostAddr host(req.host.ip, req.host.port);
if (hostExist(MetaServiceUtils::hostKey(host.first, host.second))
== Status::HostNotFound()) {
LOG(INFO) << "Reject unregistered host " << host << "!";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a interface to handler the situation uniformly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Output HostAddr to stream has been supported.

}

struct HBReq {
1: common.HostAddr host,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timestamp ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when a storage node offline, could get the final reporting time.

Or recorded it in logs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have recorded its last hb-timestamp

@nebula-community-bot
Copy link
Member

Unit testing failed.

@nebula-community-bot
Copy link
Member

Unit testing passed.

@darionyaphet
Copy link
Contributor

LGTM, Great Work 🎉

@darionyaphet darionyaphet added the ready-for-testing PR: ready for the CI test label May 13, 2019
@dangleptr
Copy link
Contributor Author

Jenkins go

@nebula-community-bot
Copy link
Member

Unit testing passed.

@nebula-community-bot
Copy link
Member

Unit testing passed.

@dangleptr dangleptr merged commit 24f13ee into vesoft-inc:master May 13, 2019
@dangleptr dangleptr deleted the hb2 branch May 13, 2019 04:12
tong-hao pushed a commit to tong-hao/nebula that referenced this pull request Jun 1, 2021
* x

* Add heartbeat processor

* Address comments
yixinglu pushed a commit to yixinglu/nebula that referenced this pull request Mar 21, 2022
* “enhancement-template”

* “fix-feature-request”

* Update feature_request.md

Co-authored-by: Shylock Hg <[email protected]>

Co-authored-by: Sophie-Xie <[email protected]>
Co-authored-by: Shylock Hg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants