-
Notifications
You must be signed in to change notification settings - Fork 604
HDDS-14335. Container Balancer status fails due to InvalidProtocolBufferException with old SCM #9586
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-14335. Container Balancer status fails due to InvalidProtocolBufferException with old SCM #9586
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1049,12 +1049,24 @@ public ContainerBalancerStatusInfoResponseProto getContainerBalancerStatusInfo() | |
|
|
||
| ContainerBalancerStatusInfoRequestProto request = | ||
| ContainerBalancerStatusInfoRequestProto.getDefaultInstance(); | ||
| ContainerBalancerStatusInfoResponseProto response = | ||
| submitRequest(Type.GetContainerBalancerStatusInfo, | ||
| builder -> builder.setContainerBalancerStatusInfoRequest(request)) | ||
| .getContainerBalancerStatusInfoResponse(); | ||
| return response; | ||
|
|
||
| try { | ||
| ContainerBalancerStatusInfoResponseProto response = | ||
| submitRequest(Type.GetContainerBalancerStatusInfo, | ||
| builder -> builder.setContainerBalancerStatusInfoRequest(request)) | ||
| .getContainerBalancerStatusInfoResponse(); | ||
| return response; | ||
| } catch (IOException e) { | ||
| // HDDS-11120 - Added a rich rebalancing status info | ||
| // Backward compatibility fix - newer clients (2.0 >=) gracefully fallback to the old | ||
| // API when connecting to older servers (< 2.0) that don't support the new enum value. | ||
| if (e.getMessage() != null && e.getMessage().contains("missing required fields")) { | ||
|
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. Can we check for the underlying |
||
| boolean isRunning = getContainerBalancerStatus(); | ||
| return ContainerBalancerStatusInfoResponseProto.newBuilder() | ||
| .setIsRunning(isRunning) | ||
| .build(); | ||
| } | ||
| throw e; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,7 +59,7 @@ public void execute(ScmClient scmClient) throws IOException { | |
| ContainerBalancerStatusInfoResponseProto response = scmClient.getContainerBalancerStatusInfo(); | ||
| boolean isRunning = response.getIsRunning(); | ||
| ContainerBalancerStatusInfoProto balancerStatusInfo = response.getContainerBalancerStatusInfo(); | ||
| if (isRunning) { | ||
| if (isRunning && balancerStatusInfo != null) { | ||
| Instant startedAtInstant = Instant.ofEpochSecond(balancerStatusInfo.getStartedAt()); | ||
| LocalDateTime dateTime = | ||
| LocalDateTime.ofInstant(startedAtInstant, ZoneId.systemDefault()); | ||
|
Comment on lines
+62
to
65
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. nit: Let's move these two statements inside |
||
|
|
@@ -101,6 +101,8 @@ public void execute(ScmClient scmClient) throws IOException { | |
| } | ||
| } | ||
|
|
||
| } else if (isRunning) { | ||
| System.out.println("ContainerBalancer is Running."); | ||
| } else { | ||
| System.out.println("ContainerBalancer is Not Running."); | ||
| } | ||
|
|
||
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.
nit: please reduce indent of "line continuation" from 8 to 4 while already touching these lines.