danny0405 commented on code in PR #10122:
URL: https://github.com/apache/hudi/pull/10122#discussion_r1398063189


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/embedded/EmbeddedTimelineService.java:
##########
@@ -146,19 +196,65 @@ public FileSystemViewManager getViewManager() {
     return viewManager;
   }
 
-  public boolean canReuseFor(String basePath) {
-    return this.server != null
-        && this.viewManager != null
-        && this.basePath.equals(basePath);
+  /**
+   * Adds a new base path to the set that are managed by this instance.
+   * @param basePath the new base path to add
+   */
+  private void addBasePath(String basePath) {
+    basePaths.add(basePath);
+  }
+
+  private boolean canReuseFor(HoodieWriteConfig newWriteConfig, String 
newHostAddr) {
+    if (server == null || viewManager == null) {
+      return false; // service is not running
+    }
+    if (basePaths.contains(newWriteConfig.getBasePath())) {
+      return true; // already running for this base path
+    }
+    if (newHostAddr != null && !newHostAddr.equals(this.hostAddr)) {
+      return false; // different host address
+    }
+    if (writeConfig.getMarkersType() != newWriteConfig.getMarkersType()) {
+      return false; // different marker type
+    }
+    return 
metadataConfigsAreEquivalent(writeConfig.getMetadataConfig().getProps(), 
newWriteConfig.getMetadataConfig().getProps());
+  }
+
+  private boolean metadataConfigsAreEquivalent(Properties properties1, 
Properties properties2) {
+    Set<Object> metadataConfigs = new HashSet<>(properties1.keySet());

Review Comment:
   Can do a shortcut check for whether the reference equals: `props1 == props2`.



-- 
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: commits-unsubscr...@hudi.apache.org

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

Reply via email to