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

HDDS-11742. don't reset SCM leadership metric to null on initilizing http server #7471

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vtutrinov
Copy link
Contributor

What changes were proposed in this pull request?

Reset SCM leadership metric to null only in case the leader is not defined earlier on initializing the RAFT server

When the SCM servers are in HA mode and start simultaneously leadership manages to settle down before the HTTP server starts. But the SCM main thread set the leadership to null with the suggestion the leadership is not defined yet, and the leadership will not be defined on prometheus metrics level:

bash-5.1$ for scm in {scm1,scm2,scm3}; do echo ${scm} && curl -s http://${scm}:9876/prom | grep scmha_metrics_scmha_leader_state ; done
scm1
# TYPE scmha_metrics_scmha_leader_state gauge
scmha_metrics_scmha_leader_state{nodeid="a8b30f45-58b0-4ab2-b52b-9aae232ccc10",hostname="e8121b3ddde2"} 0
scm2
# TYPE scmha_metrics_scmha_leader_state gauge
scmha_metrics_scmha_leader_state{nodeid="ae525b25-2774-4f91-9bbc-83884c1f472d",hostname="a467ff8d65d7"} 0
scm3
# TYPE scmha_metrics_scmha_leader_state gauge
scmha_metrics_scmha_leader_state{nodeid="a5d83fc8-7fe3-4d49-b8f6-159e411bf0fa",hostname="2ea45cb6b00a"} 0

The PR suggests resetting the leadership metric to null only in case the leader is not defined earlier on initializing the RAFT server. Also, the HA mini-cluster was rewritten to imitate the simultaneous start of the SCM servers in HA mode

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-11742

How was this patch tested?

With existing integration tests after making changes for the Ozone HA mini-cluster

Copy link
Contributor

@myskov myskov left a comment

Choose a reason for hiding this comment

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

Thanks @vtutrinov for the patch!

scmHAMetricsUpdate(null);
AtomicBoolean leaderIsDefined = new AtomicBoolean(false);
if (SCMHAUtils.isSCMHAEnabled(configuration)) {
getScmHAManager().getRatisServer().getRatisRoles().stream()
Copy link
Contributor

Choose a reason for hiding this comment

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

There's the following method for OM: OzoneManagerRatisServer.getLeaderId
maybe we should add the same for SCMRatisServer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants