Expansion Overview

For distributed databases with massive storage requirements, table data volumes inevitably grow over time. This growth often leads to insufficient cluster capacity and computing power (CPU). In such cases, efficient and reliable cluster expansion becomes essential. While it is ideal to plan for future growth during initial system design, it is usually impractical to over-invest in resources too early. Therefore, we recommend that you regularly plan and perform database expansion operations.

In YMatrix, you can choose between GUI-based expansion or command-line online expansion. We recommend using the GUI for its simplicity and ease of use. Currently, YMatrix supports online smooth expansion (read and write operations are unaffected during expansion) and flexible configuration of table data distribution.

FAQ

  1. Are the catalogs consistent between old and new nodes during expansion?

    • Yes, the catalogs are always consistent. Even if no data has been loaded yet, the catalog exists on each new node.
  2. What is the impact on other queries during expansion?

    • Since expansion is performed online, all running queries continue uninterrupted. However, when adding new nodes, the catalog must be locked temporarily. During this period, DDL operations are not supported. The catalog lock is released immediately after the new nodes are added.
    • During data redistribution, read and write operations are not affected and queries continue normally; DDL on the table must wait until redistribution completes.
  3. After a failed expansion, DDL keeps reporting gpexpand in progress, catalog changes are disallowed. What should I do?

    • This means that after the previous expansion was interrupted, a session still holds the expansion lock. Find the session holding the lock first:

      SELECT pid, state, wait_event_type, now() - xact_start AS duration, query
      FROM pg_stat_activity
      WHERE query ILIKE '%gp_expand_lock_catalog%' AND pid <> pg_backend_pid();
    • After confirming that it is the session to clean up, cancel it. The lock is released after the session's transaction rolls back:

      SELECT pg_cancel_backend(pid)
      FROM pg_stat_activity
      WHERE query ILIKE '%gp_expand_lock_catalog%' AND pid <> pg_backend_pid();
    • After the lock is released, run the DDL again. Starting from 6.8.5, when the expansion tool receives a termination signal (SIGTERM), it actively cancels this session and no longer leaves it in the database.