[fix](tablet clone) delete tablet check other catchup #24038

Sometimes FE replica's version is unreliable. FE's replica may bigger than BE's real version. Need check if BE missing version (last failed version > 0).
This commit is contained in:
yujun
2023-09-09 00:42:32 +08:00
committed by GitHub
parent aad3eb257f
commit 2fb4c818da

View File

@ -1056,14 +1056,11 @@ public class TabletScheduler extends MasterDaemon {
Replica replica, String reason, boolean force) throws SchedException {
List<Replica> replicas = tabletCtx.getTablet().getReplicas();
int matchupReplicaCount = 0;
for (Replica tmpReplica : replicas) {
if (tmpReplica.getVersion() >= replica.getVersion()) {
matchupReplicaCount++;
}
}
if (matchupReplicaCount <= 1) {
boolean otherCatchup = replicas.stream().anyMatch(
r -> r.getId() != replica.getId()
&& (r.getVersion() > replica.getVersion()
|| (r.getVersion() == replica.getVersion() && r.getLastFailedVersion() < 0)));
if (!otherCatchup) {
LOG.info("can not delete only one replica, tabletId = {} replicaId = {}", tabletCtx.getTabletId(),
replica.getId());
throw new SchedException(Status.UNRECOVERABLE, "the only one latest replia can not be dropped, tabletId = "