B-tree Index Faults

Symptom

The following error message is displayed, indicating that the index is lost occasionally.

ERROR: index 'xxxx_index' contains unexpected zero page
Or
ERROR: index 'pg_xxxx_index' contains unexpected zero page
Or
ERROR: compressed data is corrupt

Cause Analysis

This type of error is caused by the index fault. The possible causes are as follows:

  • The index is unavailable due to software bugs or hardware faults.
  • The index contains many empty pages or almost empty pages.
  • During concurrent DDL execution, the network is intermittently disconnected.
  • The index failed to be created when indexes are concurrently created.
  • A network fault occurs when a DDL or DML operation is performed.

Procedure

Run the REINDEX command to rebuild the index.

  1. Log in to the host as the OS user omm.

  2. Run the following command to connect to the database:

    gsql -d postgres -p 8000 -r
    
  3. Rebuild the index.

    • During DDL or DML operations, if index problems occur due to software or hardware faults, run the following command to rebuild the index:

      REINDEX TABLE tablename;
      
    • If the error message contains xxxx_index, the index of a user table is faulty. xxxx indicates the name of the user table. Run either of the following commands to rebuild the index:

      REINDEX INDEX indexname; 
      

      Or

      REINDEX TABLE tablename;
      
    • If the error message contains pg_xxxx_index, the index of the system catalog is faulty. Run the following command to rebuild the index:

REINDEX SYSTEM databasename;
Feedback
编组 3备份
    openGauss 2024-04-24 00:46:07
    cancel