[GitHub] [brooklyn-server] algairim commented on a change in pull request #1184: code for functionality to remove a particular node from persistence via API

2021-07-14 Thread GitBox


algairim commented on a change in pull request #1184:
URL: https://github.com/apache/brooklyn-server/pull/1184#discussion_r669537927



##
File path: 
core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
##
@@ -1004,6 +1019,15 @@ public ManagementPlaneSyncRecord 
loadManagementPlaneSyncRecord(boolean useLocalK
 return record; 
 }
 
+private boolean updateLastManagementPlaneSyncRecordWithLocalKnowledge() {
+if (lastSyncRecord != null) {
+lastSyncRecord = 
updateManagementPlaneSyncRecordWithLocalKnowledge(lastSyncRecord);
+return true;
+} else {
+return false;
+}
+}

Review comment:
   Do we need this method at all? Dose not look like return value is used 
anywhere.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brooklyn.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [brooklyn-server] algairim commented on a change in pull request #1184: code for functionality to remove a particular node from persistence via API

2021-07-14 Thread GitBox


algairim commented on a change in pull request #1184:
URL: https://github.com/apache/brooklyn-server/pull/1184#discussion_r669536725



##
File path: 
core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
##
@@ -1072,6 +1081,26 @@ private ManagementPlaneSyncRecord 
loadManagementPlaneSyncRecordInternal(boolean
 throw new IllegalStateException(message, lastException);
 }
 
+private ManagementPlaneSyncRecord 
updateManagementPlaneSyncRecordWithLocalKnowledge(ManagementPlaneSyncRecord 
result) {

Review comment:
   I would add javadoc saying that this method re-assigns the value of the 
supplied parameter. Otherwise, make it final if you prefer to return a new 
value from this method.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brooklyn.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [brooklyn-server] algairim commented on a change in pull request #1184: code for functionality to remove a particular node from persistence via API

2021-07-14 Thread GitBox


algairim commented on a change in pull request #1184:
URL: https://github.com/apache/brooklyn-server/pull/1184#discussion_r669527429



##
File path: 
core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
##
@@ -1072,6 +1081,26 @@ private ManagementPlaneSyncRecord 
loadManagementPlaneSyncRecordInternal(boolean
 throw new IllegalStateException(message, lastException);
 }
 
+private ManagementPlaneSyncRecord 
updateManagementPlaneSyncRecordWithLocalKnowledge(ManagementPlaneSyncRecord 
result) {
+// Report this node's most recent state, and detect AWOL nodes
+ManagementNodeSyncRecord me = BasicManagementNodeSyncRecord.builder()
+.from(result.getManagementNodes().get(ownNodeId), true)
+.from(createManagementNodeSyncRecord(false), true)
+.build();
+Iterable allNodes = 
result.getManagementNodes().values();
+if (me.getRemoteTimestamp()!=null)
+allNodes = Iterables.transform(allNodes, new MarkAwolNodes(me));
+Builder builder = ManagementPlaneSyncRecordImpl.builder()
+.masterNodeId(result.getMasterNodeId())
+.nodes(allNodes);
+builder.node(me);
+if (getTransitionTargetNodeState() == ManagementNodeState.MASTER) {
+builder.masterNodeId(ownNodeId);
+}
+result = builder.build();
+return result;

Review comment:
   Remove the `return` condition from the method signature. It is not 
required.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brooklyn.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [brooklyn-server] algairim commented on a change in pull request #1184: code for functionality to remove a particular node from persistence via API

2021-07-14 Thread GitBox


algairim commented on a change in pull request #1184:
URL: https://github.com/apache/brooklyn-server/pull/1184#discussion_r669457493



##
File path: 
rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
##
@@ -476,6 +477,16 @@ public Response clearHighAvailabilityPlaneStates() {
 return Response.ok().build();
 }
 
+@Override
+public Response clearHighAvailabilityPlaneStates(String nodeId) {

Review comment:
   Unit-test for this in `ServerResourceTest` please.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brooklyn.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org