Syntax
- This statement only means that the system attempts to repair sharding replicas of specified tables or partitions with high priority without the guarantee that the repair will be successful. Users can view the repair status through ADMIN SHOW REPLICA STATUS command.
- The default timeout is 14400 seconds (4 hours). Timeout means the system will not repair sharding replicas of specified tables or partitions with high priority. In case of timeout, the command needs to be used again for the intended settings.
- You can set repair behavior by specifying
PROPERTIESin the statement. Currently, only cloud-native tables in shared-data clusters supportPROPERTIES.
enforce_consistent_version: Whether to enforce all tablets in a partition to roll back to a consistent version. Default:true. If this item is set totrue, the system will search for a consistent version in the history that is valid for all tablets to perform the rollback, ensuring data version alignment across the partition. If it is set tofalse, each tablet in the partition is allowed to rollback to its latest available valid version. The versions of different tablets may be inconsistent, but this maximizes data preservation.allow_empty_tablet_recovery: Whether to allow recovery by creating empty tablets. Default:false. This item takes effect only whenenforce_consistent_versionisfalse. If this item is set totrue, when metadata is missing for all versions of some tablets but valid metadata exists for at least one tablet, the system attempts to create empty tablets to fill the missing versions. If metadata for all versions of all tablets is lost, recovery is impossible.dry_run: Whether to return the repair plan without actually executing the repair. Default:false. If set totrue, the system evaluates the recoverability of each partition and returns the repair plan without performing any actual metadata rollback. The result set contains the following columns:PartitionId: Partition ID.VisibleVersion: Current visible version.RepairStatus: Repair status. Valid values:NORMAL(all tablets are healthy, no repair needed),RECOVERABLE(missing metadata or data files but recoverable),UNRECOVERABLE(missing metadata or data files and unrecoverable),UNKNOWN(an exception occurred during probing).TabletRecoverInfo: JSON array listing the version each tablet will roll back to. Only populated when status isRECOVERABLE.ErrorMsg: Error message. Only populated when status isUNRECOVERABLEorUNKNOWN.
Examples
-
Attempt to repair specified tables
-
Attempt to fix specified partition
-
Attempt to repair a shared-data table, allowing inconsistent versions and creating empty tablets for recovery
-
Preview the repair plan for a shared-data table without executing it