Skip to main content

ADMIN SET REPLICA VERSION

Description​

This statement is used to manually set the version, last successful version, and last failed version of a specified replica. It is primarily used for recovering replicas from an abnormal state when an issue occurs in the system.

Syntax​

ADMIN SET REPLICA VERSION PROPERTIES ("<key>"="<value>" [,...])

Required Parameters​

** 1. "<key>"="<value>"**

keyvalue typeNotes
tablet_idIntThe ID of the tablet whose replica version needs to be modified.
backend_idIntThe ID of the BE node where the replica is located.

Optional Parameters​

** 1. "<key>"="<value>"**

keyvalue typeNotes
versionIntSets the version of the replica.
last_success_versionIntSets the last successful version of the replica.
last_failed_versionIntSets the last failed version of the replica.

Notes

  • If the specified replica does not exist, the operation will be ignored.

  • Modifying these values may cause subsequent data read and write failures, leading to data inconsistency. Please proceed with caution!

  • Record the original values before making modifications. After making changes, verify table read and write operations. If they fail, revert to the original values. However, reverting may also fail.

  • Do not perform this operation on a tablet that is currently writing data!

Access Control Requirements​

The user executing this SQL command must have at least the following privileges:

PrivilegeObjectNotes
Admin_privDatabaseRequired to execute administrative operations on the database, including managing tables, partitions, and system-level commands.

Examples​

  • Clear the failed status flag for the replica of tablet 10003 on BE 10001

    ADMIN SET REPLICA VERSION PROPERTIES("tablet_id" = "10003", "backend_id" = "10001", "last_failed_version" = "-1");
  • Set the replica version of tablet 10003 on BE 10001 to 1004

    ADMIN SET REPLICA VERSION PROPERTIES("tablet_id" = "10003", "backend_id" = "10001", "version" = "1004");