Backup fails with Postgres pg_toast error
search cancel

Backup fails with Postgres pg_toast error

book

Article ID: 444442

calendar_today

Updated On:

Products

Network Observability VMware Smart Assurance

Issue/Introduction

When attempting to run an NCM backup, the operation fails. Error observed on console:

ERROR: unexpected chunk size -4 (expected 380) in chunk [ID] of [ID] for toast value [ID] in pg_toast_[ID]pg_dump: error: Dumping the contents of table "cm_config_file" failed

Environment

All Supported NCM Versions

Cause

This issue occurs due to index corruption within the voyence.cm_config_file table or its associated TOAST. If these pointers or chunks become corrupted, the backup process (pg_dump) will fail when it tries to read the affected records.

Resolution

To resolve the corruption, you must reindex the affected tables and analyze them to refresh the database statistics.

  1. Login to PostgresDB
  2. Run queries one after the another:
    1. REINDEX TABLE voyence.cm_config_file;
    2. REINDEX TABLE pg_toast.[toast_id];
      Example:
      REINDEX TABLE pg_toast.15555555;
    3. ANALYZE voyence.cm_config_file;

Upon successfully completing reindex and analyze, backup will work.