1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-11-24 08:52:38 +02:00

merge branch REL_2_5-PBCKP-336 into REL_2_5-PBCKP-304

This commit is contained in:
Ivan Lazarev 2022-11-15 18:15:11 +03:00
commit f3f83b766a
2 changed files with 40 additions and 1 deletions

View File

@ -1786,6 +1786,8 @@ is_forkname(char *name, size_t *pos, const char *forkname)
}
#define OIDCHARS 10
#define MAXSEGNO (((uint64_t)1<<32)/RELSEG_SIZE-1)
#define SEGNOCHARS 5 /* when BLCKSZ == (1<<15) */
/* Set forkName if possible */
bool
@ -1793,6 +1795,7 @@ set_forkname(pgFile *file)
{
size_t i = 0;
uint64_t oid = 0; /* use 64bit to not check for overflow in a loop */
uint64_t segno = 0;
/* pretend it is not relation file */
file->relOid = 0;
@ -1823,8 +1826,15 @@ set_forkname(pgFile *file)
/* /^\d+(_(vm|fsm|init|ptrack))?\.\d+$/ */
if (file->name[i] == '.' && isdigit(file->name[i+1]))
{
size_t start = i+1;
for (i++; isdigit(file->name[i]); i++)
;
{
if (i == start && file->name[i] == '0')
return false;
segno = segno * 10 + file->name[i] - '0';
}
if (i - start > SEGNOCHARS || segno > MAXSEGNO)
return false;
}
/* CFS "fork name" */
@ -1843,6 +1853,7 @@ set_forkname(pgFile *file)
}
file->relOid = oid;
file->segno = segno;
file->is_datafile = file->forkName == none;
return true;
}

View File

@ -10,6 +10,34 @@ import subprocess
class BackupTest(ProbackupTest, unittest.TestCase):
def test_basic_full_backup(self):
"""
Just test full backup with at least two segments
"""
node = self.make_simple_node(
base_dir=os.path.join(self.module_name, self.fname, 'node'),
initdb_params=['--data-checksums'],
# we need to write a lot. Lets speedup a bit.
pg_options={"fsync": "off", "synchronous_commit": "off"})
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
self.set_archiving(backup_dir, 'node', node)
node.slow_start()
# Fill with data
# Have to use scale=100 to create second segment.
node.pgbench_init(scale=100, no_vacuum=True)
# FULL
backup_id = self.backup_node(backup_dir, 'node', node)
out = self.validate_pb(backup_dir, 'node', backup_id)
self.assertIn(
"INFO: Backup {0} is valid".format(backup_id),
out)
# @unittest.skip("skip")
# @unittest.expectedFailure
# PGPRO-707