Updated on 2024-05-29 GMT+08:00

Checking and Repairing Index Consistency

Scenarios

You can use the global secondary index tool to check the consistency between user data and index data. If the index data is inconsistent with user data, this tool can be used to rebuild index data.

How to Use

Run the following command on the HBase client to check data consistency. If data is inconsistent, index data will be rebuilt. The consistency check result is saved to the {NameSpace where the data table is located}:GSI_INCONSISTENCY_TABLE table.

hbase org.apache.hadoop.hbase.hindex.global.tools.GlobalHIndexConsistencyTool -dt table1 -n idx3 -src BOTH -r

The parameters are described as follows:

  • -dt,--data-table: indicates the name of the data table to be checked.
  • -n,--index-name: indicates the name of the index for which the consistency check is to be performed.
  • -src,--source: indicates the check mode. The default value is BOTH. The following modes are supported:
    • INDEX_TABLE_SOURCE: The index table is used as the source table.
    • DATA_TABLE_SOURCE: The data table is used as the source table.
    • BOTH: Both index tables and data tables are source tables.
  • -r,--repair: index data repair option. If this parameter is added, the index data is repaired after the check.
  • (Optional) -sc,--scan-caching: size of scan caching in a MapReduce job for consistency check or repair.