You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/04/20 10:33:36 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #5647: [Bug] Skip balance for olap table whoes state is not normal to avoid some potential operation failure on table

morningman commented on a change in pull request #5647:
URL: https://github.com/apache/incubator-doris/pull/5647#discussion_r616558916



##########
File path: fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
##########
@@ -1053,7 +1054,23 @@ private void selectTabletsForBalance() {
 
         List<TabletSchedCtx> alternativeTablets = rebalancer.selectAlternativeTablets();
         for (TabletSchedCtx tabletCtx : alternativeTablets) {
-            addTablet(tabletCtx, false);
+            TabletMeta tabletMeta = invertedIndex.getTabletMeta(tabletCtx.getTabletId());
+            if (tabletMeta == null) {
+                continue;
+            }
+            Database db = Catalog.getCurrentCatalog().getDb(tabletMeta.getDbId());
+            OlapTable table = db == null ? null : (OlapTable) db.getTable(tabletMeta.getTableId());
+            if (table != null) {
+                table.readLock();
+                try {
+                    if (table.getState() == OlapTableState.NORMAL) {
+                        addTablet(tabletCtx, false);
+                    }
+                } finally {
+                    table.readUnlock();
+                }
+            }

Review comment:
       We have a logic here:
   
   https://github.com/apache/incubator-doris/blob/a2e83e65d2e8aad604c35fe492f5bdd92650cbd7/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java#L513-L516
   
   so I think it is not neccesary to check here.




-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org