xxubai commented on code in PR #3920:
URL: https://github.com/apache/amoro/pull/3920#discussion_r2881874019


##########
amoro-ams/src/main/java/org/apache/amoro/server/ha/DataBaseHighAvailabilityContainer.java:
##########
@@ -135,6 +137,44 @@ public void waitFollowerShip() throws InterruptedException 
{
     LOG.info("Became the follower of AMS (Database lease)");
   }
 
+  @Override
+  public void registerAndElect() throws Exception {
+    boolean isMasterSlaveMode = 
serviceConfig.getBoolean(AmoroManagementConf.USE_MASTER_SLAVE_MODE);
+    if (!isMasterSlaveMode) {
+      LOG.debug("Master-slave mode is not enabled, skip node registration");
+      return;
+    }
+    // In master-slave mode, register node to database by writing 
OPTIMIZING_SERVICE info
+    // This is similar to ZK mode registering ephemeral nodes
+    long now = System.currentTimeMillis();
+    String optimizingInfoJson = 
JacksonUtil.toJSONString(optimizingServiceServerInfo);

Review Comment:
   The two implementations register **different** service info. Given that 
`AmoroServiceContainer.main()` calls `registerAndElect()` followed by 
`startOptimizingService()` in master-slave mode, the ZK implementation should 
also register `optimizingServiceServerInfo` (or both) to be consistent.
   



##########
amoro-ams/src/main/java/org/apache/amoro/server/ha/HighAvailabilityContainer.java:
##########
@@ -49,5 +53,19 @@ public interface HighAvailabilityContainer {
    *
    * @throws Exception If registration fails or participation in the primary 
election fails.
    */
-  void registAndElect() throws Exception;
+  void registerAndElect() throws Exception;
+
+  /**
+   * Used in master-slave mode to obtain information about all currently 
registered AMS nodes.
+   *
+   * @return List<AmsServerInfo>
+   */
+  List<AmsServerInfo> getAliveNodes();
+
+  /**
+   * Used to determine whether the current AMS node is the primary node.
+   *
+   * @return

Review Comment:
   nit: lack return param



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to