DarvenDuan opened a new pull request, #36148: URL: https://github.com/apache/doris/pull/36148
## Proposed changes Issue Number: close #xxx If a table with an existing partition of the same schema is restored, and the version of those partitions is higher than the ones being restored, the restored replicas' version in the FE metadata will not be updated to match the restored partition's version. Although there will be no impact on read and write operations, these replicas might not be dropped during repair or rebalancing processes. This is because the TabletScheduler typically avoids dropping replicas with the highest version among all replicas within a tablet, potentially leading to the existence of redundant or abnormal replicas within a tablet: ``` +-----------+-----------+---------+-------------------+------------------+---------------+------------+---------------+----------------+----------+--------+-------+------------+--------------+----------------------+------------------------------------------------+--------------------------------------------------------------+-------------------+----------------+-----------+ | ReplicaId | BackendId | Version | LstSuccessVersion | LstFailedVersion | LstFailedTime | SchemaHash | LocalDataSize | RemoteDataSize | RowCount | State | IsBad | IsUserDrop | VersionCount | PathHash | MetaUrl | CompactionStatus | CooldownReplicaId | CooldownMetaId | QueryHits | +-----------+-----------+---------+-------------------+------------------+---------------+------------+---------------+----------------+----------+--------+-------+------------+--------------+----------------------+------------------------------------------------+--------------------------------------------------------------+-------------------+----------------+-----------+ | 16611 | 10148 | 441345 | 441345 | -1 | NULL | 363051650 | 190695232 | 0 | 23551002 | NORMAL | false | false | 8 | -8787066244400026431 | http://0.0.0.0:0/api/meta/header/16608 | http://0.0.0.0:0/api/compaction/show?tablet_id=16608 | -1 | | 0 | | 16610 | 17020 | 441343 | 441343 | -1 | NULL | 363051650 | 190695232 | 0 | 23551002 | NORMAL | false | false | 8 | -7255479345457496615 | http://xx.xx.xx.xx:8040/api/meta/header/16608 | http://xx.xx.xx.xx:8040/api/compaction/show?tablet_id=16608 | -1 | | 0 | | 16611 | 17021 | 441343 | 441343 | -1 | NULL | 363051650 | 190695232 | 0 | 23551002 | NORMAL | false | false | 8 | -8787066244400026431 | http://xx.xx.xx.xx:8040/api/meta/header/16608 | http://xx.xx.xx.xx:8040/api/compaction/show?tablet_id=16608 | -1 | | 0 | | 16609 | 17022 | 441343 | 441343 | -1 | NULL | 363051650 | 190695232 | 0 | 23551002 | NORMAL | false | false | 8 | 2726332276095749175 | http://xx.xx.xx.xx:8040/api/meta/header/16608 | http://xx.xx.xx.xx:8040/api/compaction/show?tablet_id=16608 | -1 | | 0 | +-----------+-----------+---------+-------------------+------------------+---------------+------------+---------------+----------------+----------+--------+-------+------------+--------------+----------------------+------------------------------------------------+--------------------------------------------------------------+-------------------+----------------+-----------+ ``` As we can see, tablet 16608 has four replicas, but replica 16611 is redundant and ought to be removed as its corresponding backend, 10148, has been dropped. However, replica 16611 remains due to its higher version number, 441345, which is greater than the versions of the other replicas, 441343. Consequently, it cannot be automatically deleted, and the FE received the following message: 2024-06-07 16:13:58,568 INFO (tablet scheduler|40) [TabletScheduler.deleteReplicaInternal():1090] can not delete only one replica, tabletId =16608 replicaId =16611 2024-06-07 16:13:58,568 INFO (tablet scheduler|40) [TabletScheduler.removeTabletCtx():1594] remove the tablet tablet id:16608, status: REDUNDANT, state: PENDING, type: REPAIR, priority: VERY_HIGH, tablet size: 0, visible version:441345, committed version:441345. err: the only one latest replia can not be dropped, tabletId =16608, replicaId =16611. because: the only one latest replia can not be dropped, tabletId =16608, replicaId =16611 <!--Describe your changes.--> optimize: update replica version after restore -- 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