Skip to content

Commit

Permalink
HDDS-11742. update scm HA metrics once, revert the changes in MiniOzo…
Browse files Browse the repository at this point in the history
…neClusterImpl
  • Loading branch information
Slava Tutrinov committed Nov 28, 2024
1 parent e8f9afd commit 7094e8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1595,12 +1595,9 @@ public void start() throws IOException {

setStartTime();

if (SCMHAUtils.isSCMHAEnabled(configuration) && getScmHAManager().getRatisServer().getLeaderId() != null) {
scmHAMetricsUpdate(getScmHAManager().getRatisServer().getLeaderId().toString());
} else {
// At this point leader is not known
scmHAMetricsUpdate(null);
}
RaftPeerId leaderId = SCMHAUtils.isSCMHAEnabled(configuration)
? getScmHAManager().getRatisServer().getLeaderId() : null;
scmHAMetricsUpdate(Objects.toString(leaderId, null));

if (scmCertificateClient != null) {
// In case root CA certificate is rotated during this SCM is offline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public class MiniOzoneClusterImpl implements MiniOzoneCluster {
private CertificateClient caClient;
private final Set<AutoCloseable> clients = ConcurrentHashMap.newKeySet();
private SecretKeyClient secretKeyClient;
private static volatile MockedStatic mockDNStatic;
private static MockedStatic mockDNStatic = Mockito.mockStatic(HddsDatanodeService.class);

/**
* Creates a new MiniOzoneCluster with Recon.
Expand Down Expand Up @@ -571,16 +571,6 @@ private void setSecretKeyClient(SecretKeyClient client) {
this.secretKeyClient = client;
}

public static void mockDatanode() {
if (mockDNStatic == null) {
synchronized (MiniOzoneClusterImpl.class) {
if (mockDNStatic == null) {
mockDNStatic = Mockito.mockStatic(HddsDatanodeService.class);
}
}
}
}

private static void stopDatanodes(
Collection<HddsDatanodeService> hddsDatanodes) {
if (!hddsDatanodes.isEmpty()) {
Expand Down Expand Up @@ -877,7 +867,6 @@ protected Gateway createS3G() {
*/
protected List<HddsDatanodeService> createHddsDatanodes()
throws IOException {
mockDatanode();
List<HddsDatanodeService> hddsDatanodes = new ArrayList<>();

// Override default datanode initial and current version if necessary
Expand Down

0 comments on commit 7094e8c

Please sign in to comment.