You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-07-14 06:54:15 +02:00
Teach pg_probackup to work with ptrack 2.1
This commit is contained in:
committed by
Grigory Smolkin
parent
61b476bb31
commit
583ffaaa30
@ -1168,12 +1168,12 @@ CREATE EXTENSION ptrack;
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
To enable tracking page updates, set <varname>ptrack_map_size</varname>
|
||||
To enable tracking page updates, set <varname>ptrack.map_size</varname>
|
||||
parameter to a positive integer and restart the server.
|
||||
</para>
|
||||
<para>
|
||||
For optimal performance, it is recommended to set
|
||||
<varname>ptrack_map_size</varname> to
|
||||
<varname>ptrack.map_size</varname> to
|
||||
<literal><replaceable>N</replaceable> / 1024</literal>, where
|
||||
<replaceable>N</replaceable> is the size of the
|
||||
<productname>PostgreSQL</productname> cluster, in MB. If you set this
|
||||
@ -1181,7 +1181,7 @@ CREATE EXTENSION ptrack;
|
||||
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 <varname>ptrack_map_size</varname> to a higher value
|
||||
Setting <varname>ptrack.map_size</varname> to a higher value
|
||||
does not affect PTRACK operation. The maximum allowed value is 1024.
|
||||
</para>
|
||||
</listitem>
|
||||
@ -1201,11 +1201,11 @@ GRANT EXECUTE ON FUNCTION pg_ptrack_get_block(oid, oid, oid, bigint) TO backup;
|
||||
|
||||
<note>
|
||||
<para>
|
||||
If you change the <varname>ptrack_map_size</varname> parameter value,
|
||||
If you change the <varname>ptrack.map_size</varname> 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 <varname>ptrack_map_size</varname>.
|
||||
changing <varname>ptrack.map_size</varname>.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
|
@ -436,7 +436,7 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync)
|
||||
/*
|
||||
* Build the page map from ptrack information.
|
||||
*/
|
||||
if (nodeInfo->ptrack_version_num == 20)
|
||||
if (nodeInfo->ptrack_version_num >= 20)
|
||||
make_pagemap_from_ptrack_2(backup_files_list, backup_conn,
|
||||
nodeInfo->ptrack_schema,
|
||||
prev_backup_start_lsn);
|
||||
|
@ -204,6 +204,8 @@ get_ptrack_version(PGconn *backup_conn, PGNodeInfo *nodeInfo)
|
||||
nodeInfo->ptrack_version_num = 17;
|
||||
else if (strcmp(ptrack_version_str, "2.0") == 0)
|
||||
nodeInfo->ptrack_version_num = 20;
|
||||
else if (strcmp(ptrack_version_str, "2.1") == 0)
|
||||
nodeInfo->ptrack_version_num = 21;
|
||||
else
|
||||
elog(WARNING, "Update your ptrack to the version 1.5 or upper. Current version is %s",
|
||||
ptrack_version_str);
|
||||
@ -572,7 +574,7 @@ pg_ptrack_enable2(PGconn *backup_conn)
|
||||
{
|
||||
PGresult *res_db;
|
||||
|
||||
res_db = pgut_execute(backup_conn, "SHOW ptrack_map_size", 0, NULL);
|
||||
res_db = pgut_execute(backup_conn, "SHOW ptrack.map_size", 0, NULL);
|
||||
|
||||
if (strcmp(PQgetvalue(res_db, 0, 0), "0") == 0)
|
||||
{
|
||||
|
@ -366,7 +366,8 @@ class ProbackupTest(object):
|
||||
|
||||
if ptrack_enable:
|
||||
if node.major_version > 11:
|
||||
options['ptrack_map_size'] = '128MB'
|
||||
options['ptrack.map_size'] = '128'
|
||||
options['shared_preload_libraries'] = 'ptrack'
|
||||
else:
|
||||
options['ptrack_enable'] = 'on'
|
||||
|
||||
|
@ -269,7 +269,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
base_dir=os.path.join(module_name, fname, 'node'),
|
||||
set_replication=True, initdb_params=['--data-checksums'],
|
||||
pg_options={
|
||||
'checkpoint_timeout': '30s'})
|
||||
'checkpoint_timeout': '30s',
|
||||
'shared_preload_libraries': 'ptrack'})
|
||||
|
||||
self.init_pb(backup_dir)
|
||||
self.add_instance(backup_dir, 'node', node)
|
||||
@ -336,16 +337,16 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# DISABLE PTRACK
|
||||
if node.major_version >= 12:
|
||||
node.safe_psql('postgres', "alter system set ptrack_map_size to 0")
|
||||
node.safe_psql('postgres', "alter system set ptrack.map_size to 0")
|
||||
else:
|
||||
node.safe_psql('postgres', "alter system set ptrack_enable to off")
|
||||
|
||||
node.stop()
|
||||
node.slow_start()
|
||||
|
||||
# ENABLE PTRACK
|
||||
if node.major_version >= 12:
|
||||
node.safe_psql('postgres', "alter system set ptrack_map_size to '128MB'")
|
||||
node.safe_psql('postgres', "alter system set ptrack.map_size to '128'")
|
||||
node.safe_psql('postgres', "alter system set shared_preload_libraries to 'ptrack'")
|
||||
else:
|
||||
node.safe_psql('postgres', "alter system set ptrack_enable to on")
|
||||
node.stop()
|
||||
@ -4054,7 +4055,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
'FATAL: incorrect checksum of file "{0}"'.format(ptrack_map),
|
||||
log_content)
|
||||
|
||||
self.set_auto_conf(node, {'ptrack_map_size': '0'})
|
||||
self.set_auto_conf(node, {'ptrack.map_size': '0'})
|
||||
|
||||
node.slow_start()
|
||||
|
||||
@ -4082,7 +4083,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
node.stop(['-m', 'immediate', '-D', node.data_dir])
|
||||
|
||||
self.set_auto_conf(node, {'ptrack_map_size': '32'})
|
||||
self.set_auto_conf(node, {'ptrack.map_size': '32', 'shared_preload_libraries': 'ptrack'})
|
||||
|
||||
node.slow_start()
|
||||
|
||||
|
Reference in New Issue
Block a user