yujun777 commented on code in PR #20872:
URL: https://github.com/apache/doris/pull/20872#discussion_r1231161100
##########
fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java:
##########
@@ -1113,6 +1103,21 @@ private void deleteReplicaInternal(TabletSchedCtx
tabletCtx,
}
}
+ List<Replica> replicas = tabletCtx.getTablet().getReplicas();
+ int matchupReplicaCount = 0;
+ for (Replica tmpReplica : replicas) {
+ if (tmpReplica.getVersion() >= replica.getVersion()) {
+ matchupReplicaCount++;
+ }
+ }
+
+ if (matchupReplicaCount <= 1) {
+ LOG.info("can not delete only one replica, tabletId = {} replicaId
= {}", tabletCtx.getTabletId(),
+ replica.getId());
+ throw new SchedException(Status.FINISHED, "the only one latest
replia can not be dropped, tabletId = "
+ + tabletCtx.getTabletId() + ",
replicaId = " + replica.getId());
+ }
+
Review Comment:
Can move the-only-one check to the begining of this function ? Otherwise
this replica will change to decommission state.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]