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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org