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

Display TServer clock information in yb-master ui #6772

Closed
kmuthukk opened this issue Dec 30, 2020 · 3 comments
Closed

Display TServer clock information in yb-master ui #6772

kmuthukk opened this issue Dec 30, 2020 · 3 comments
Assignees
Labels
area/docdb YugabyteDB core features good first issue This is a good issue to start contributing!

Comments

@kmuthukk
Copy link
Collaborator

For debugging purposes, it'll be useful to add a new view say -- http://yb-master:7000/tablet-server-clocks) to visually display the clocks of the various TServers, that provides the following data for each tablet server:

  • time since heartbeat (this is already available from the heartbeat sent to master and it is shown here today).
  • the physical time on the tserver at the time of heartbeat
  • the hybrid time on the tserver at the time of the heartbeat (its physical & logical components).
@kmuthukk kmuthukk added good first issue This is a good issue to start contributing! area/docdb YugabyteDB core features labels Dec 30, 2020
@kmuthukk
Copy link
Collaborator Author

Implementation pointers on this (based on discussions with @spolitov ):

  • add two new fields in TSHeartbeatRequestPB for ts_physical_time and ts_hybrid_time. The plan would be to set these two fields in this function which handles the heartbeats on the TServer side:
    Status Heartbeater::Thread::TryHeartbeat() {

We typically use fixed64 type for these fields in proto over int64. The latter uses variant length encoding which isn't very useful for very large integer values.

  • To obtain the hybrid time on the TServer side, the logic would involve getting the hybrid clock:

auto* hybrid_clock = down_cast<server::HybridClock*>(server_->Clock());

and from there, the current value can be obtained thus:

hybrid_clock->Now().ToUint64()

  • To obtain the physical time on the TServer, the TEST_clock() function, currently only used for tests, can be repurposed and renamed to say physical_clock()

const PhysicalClockPtr& TEST_clock() { return clock_; }

and the now timestamp can be obtained via:

Result<PhysicalTime> now = hybrid_clock->physical_clock()->Now();

and subsequently via now->time_point

  • On the master side, when heartbeats are received, the new fields in the proto structures can be copied/save into two new fields (for physical & hybrid time) in the TSDescriptor

Here's the master side logic when a TServer heartbeat is received.

void MasterServiceImpl::TSHeartbeat(const TSHeartbeatRequestPB* req,

These TSDescriptor fields can then be used to drive the UI logic.

@VishnuK007
Copy link
Contributor

I am interested in working on this issue. I will try to submit a patch for it in the next couple of days.

@rkarthik007
Copy link
Collaborator

Thanks @VishnuK007! Assigned to you.

VishnuK007 added a commit to VishnuK007/yugabyte-db that referenced this issue Jan 1, 2021
spolitov pushed a commit that referenced this issue Jan 21, 2021
Display tserver clock information in yb-master UI

PR #6776
polarweasel pushed a commit to lizayugabyte/yugabyte-db that referenced this issue Mar 9, 2021
Display tserver clock information in yb-master UI

PR yugabyte#6776
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docdb YugabyteDB core features good first issue This is a good issue to start contributing!
Projects
None yet
Development

No branches or pull requests

3 participants