Apache9 commented on code in PR #5520:
URL: https://github.com/apache/hbase/pull/5520#discussion_r1413126430


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateStore.java:
##########
@@ -249,25 +272,31 @@ private void removeMirrorMetaLocation(int 
oldReplicaCount, int newReplicaCount)
     }
   }
 
-  private void updateRegionLocation(RegionInfo regionInfo, State state, Put 
put)
-    throws IOException {
-    try {
-      if (regionInfo.isMetaRegion()) {
+  private CompletableFuture<Void> updateRegionLocation(RegionInfo regionInfo, 
State state,
+    Put put) {
+    CompletableFuture<Void> future;
+    if (regionInfo.isMetaRegion()) {
+      try {
         masterRegion.update(r -> r.put(put));
-      } else {
-        try (Table table = 
master.getConnection().getTable(TableName.META_TABLE_NAME)) {
-          table.put(put);
-        }
+        future = CompletableFuture.completedFuture(null);
+      } catch (Exception e) {
+        future = FutureUtils.failedFuture(e);
       }
-    } catch (IOException e) {
-      // TODO: Revist!!!! Means that if a server is loaded, then we will abort 
our host!
-      // In tests we abort the Master!
-      String msg = String.format("FAILED persisting region=%s state=%s",
-        regionInfo.getShortNameToLog(), state);
-      LOG.error(msg, e);
-      master.abort(msg, e);
-      throw e;
+    } else {
+      AsyncTable<?> table = 
master.getAsyncConnection().getTable(TableName.META_TABLE_NAME);
+      future = table.put(put);
     }
+    FutureUtils.addListener(future, (r, e) -> {
+      if (e != null) {
+        // TODO: Revist!!!! Means that if a server is loaded, then we will 
abort our host!
+        // In tests we abort the Master!

Review Comment:
   This is still the case...
   This PR only solve the problem that we will not block the PEWorker when 
updating meta, but if the region server which holds meta is busy, i.e, loaded, 
the update to meta could still fail and the simple way to fix here is still to 
crash master, so we can reload the data in meta again after restarting to make 
sure that the data in meta and the data in master's memory are consistent...



-- 
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: issues-unsubscr...@hbase.apache.org

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

Reply via email to