Setting up PTRACK Backups

The PTRACK backup mode can be used only for Postgres Pro Standard and Postgres Pro Enterprise installations, or patched vanilla PostgreSQL.

pg_probackup3 includes two applications for creating backups in the PTRACK mode:

  • The PTRACK application for creating backups in the DIRECT mode.

  • The pb3_ptrack application for creating backups in the PRO mode.

If you are going to use PTRACK backups in the DIRECT mode, complete the following additional steps.

Note

The permissions required for the role that will perform PTRACK backups (the backup role in the examples below) are listed in the section called “Configuring the Database Cluster”. The role must have permissions only in the database used for connection to the Postgres Pro server.

  1. Add ptrack to the shared_preload_libraries variable in the postgresql.conf file:

    shared_preload_libraries = 'ptrack'
    
  2. To enable tracking page updates, set the ptrack.map_size parameter to a positive integer and restart the server.

    For optimal performance, it is recommended to set ptrack.map_size to N / 1024, where N is the size of the Postgres Pro cluster, in MB. If you set this parameter to a lower value, PTRACK is more likely to map several blocks together, which leads to false-positive results when tracking changed blocks and increases the incremental backup size as unchanged blocks can also be copied into the incremental backup. Setting ptrack.map_size to a higher value does not affect PTRACK operation, but it is not recommended to set this parameter to a value higher than 1024.

    Note

    If you change the ptrack.map_size parameter value, the previously created PTRACK map file is cleared, and tracking newly changed blocks starts from scratch. Thus, you have to retake a full backup before taking incremental PTRACK backups after changing ptrack.map_size.

  3. Create PTRACK extension:

    CREATE EXTENSION ptrack;
    

To create PTRACK backups in the PRO mode, set the pb3_ptrack.map_size parameter to a positive integer in the postgresql.conf file and restart the server.

For optimal performance, it is recommended to set pb3_ptrack.map_size to N / 1024, where N is the size of the Postgres Pro cluster, in MB. If you set this parameter to a lower value, pb3_ptrack is more likely to map several blocks together, which leads to false-positive results when tracking changed blocks and increases the incremental backup size as unchanged blocks can also be copied into the incremental backup. Setting pb3_ptrack.map_size to a higher value does not affect pb3_ptrack operation, but it is not recommended to set this parameter to a value higher than 1024.

Note

If you change the pb3_ptrack.map_size parameter value, the previously created pb3_ptrack map file is cleared, and tracking newly changed blocks starts from scratch. Thus, you have to retake a full backup before taking incremental PTRACK backups after changing pb3_ptrack.map_size.

Note

The pgpro_bindump module must be enabled before setting up pbk3_ptrack.

Warning

Enabling both PTRACK and pb3_ptrack applications at the same time will lead to critical errors and backup failure. Make sure only the required application is activated.