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 2022/01/03 02:16:57 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #7423: [improvement] add a config repair_slow_replica

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



##########
File path: fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
##########
@@ -966,6 +970,39 @@ private boolean handleColocateRedundant(TabletSchedCtx tabletCtx) throws SchedEx
         throw new SchedException(Status.SCHEDULE_FAILED, "unable to delete any colocate redundant replicas");
     }
 
+    /**
+     * remove the replica which has the most version count, and much more than others
+     * return true if delete one replica, otherwise, return false.
+     */
+    private boolean handleReplicaTooSlow(TabletSchedCtx tabletCtx) throws SchedException {
+        Replica chosenReplica = null;
+        Replica minReplica = null;
+        long maxVersionCount = -1;
+        long minVersionCount = Integer.MAX_VALUE;
+        for (Replica replica : tabletCtx.getReplicas()) {
+            if (replica.getVersionCount() > maxVersionCount) {
+                maxVersionCount = replica.getVersionCount();
+                chosenReplica = replica;
+            }
+            if (replica.getVersionCount() < minVersionCount) {
+                minVersionCount = replica.getVersionCount();
+                minReplica = replica;
+            }
+        }
+
+        if (chosenReplica != null && !chosenReplica.equals(minReplica) && minReplica.isAlive()) {
+            try {
+                Catalog.getCurrentCatalog().setReplicaStatus(tabletCtx.getTabletId(), chosenReplica.getBackendId(),
+                        Replica.ReplicaStatus.BAD);
+                throw new SchedException(Status.FINISHED, "colocate redundant replica is deleted");

Review comment:
       ```suggestion
                   throw new SchedException(Status.FINISHED, "set slow replica as bad");
   ```




-- 
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-unsubscribe@doris.apache.org

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