P.6. Maintenance #
- How do I backup a Postgres Pro Shardman database?
For information about Postgres Pro Shardman backups, refer to Section 24.4.
- What backup types does Postgres Pro Shardman support?
Postgres Pro Shardman uses the pg_probackup utility to manage backups of the following types:
FULL backup. This contains all the data files required to restore the database cluster and can act as a base for incremental backups.
DELTA backup. pg_probackup reads all data files in the data directory and copies only those pages that have changed since the previous backup. This backup type can impose read-only I/O pressure equal to a full backup.
PAGE backup. pg_probackup scans all WAL files in the archive from the moment the previous full or incremental backup was taken. Newly created backups contain only the pages that were mentioned in WAL records. This requires all the WAL files since the previous backup to be present in the WAL archive. If the size of these files is comparable to the total size of the database cluster files, speedup is smaller, but the backup still takes less space.
PTRACK backup. In this mode, Postgres Pro Shardman tracks page changes on the fly. Continuous archiving is not necessary for it to operate. Each time a relation page is updated, this page is marked in a special PTRACK bitmap. Tracking implies some minor overhead on the database server operation, but speeds up incremental backups significantly.
- Can I restore a backup to a cluster with more nodes or vice versa?
You cannot do that. The topology of the cluster must match that of the backup. Theoretically, you can restore a single replication group instead of the entire cluster, but the data will not be consistent.
- Does Postgres Pro Shardman support automatic data rebalancing when adding or removing nodes?
Yes, the shardmanctl utility supports data rebalancing when adding or removing nodes.
- Is there a downtime when I add a new node and a partition is moved to the new node?
The partition to be moved is accessible except for a short moment when metadata is being changed. In case of a large number of transactions, the write operations might return errors for some time.
A partition is migrated to a new node in the following stages:
A table with the same structure is created on another node.
Logical replication is configured for data migration.
Postgres Pro Shardman waits for migration to complete.
When the subscriber catches up with the publisher (the distance between them is less than 1 WAL) or the distance between them starts to grow, Postgres Pro Shardman blocks write operations.
Postgres Pro Shardman changes the metadata and unlocks the partition on the new node for writing.
- Does
VACUUMhave any peculiarities in Postgres Pro Shardman? VACUUMkeeps old records up to the csn_snapshot_defer_time point if they are required by any transaction in the Postgres Pro Shardman cluster.When
VACUUMis run on a sharded or replicated table, the command is broadcast to all nodes automatically to vacuum all local partitions of the sharded table and all unmanaged tables of the replicated table.