mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-24 08:52:38 +02:00
Merge branch 'REL_2_5'
This commit is contained in:
commit
457e06296c
13
src/dir.c
13
src/dir.c
@ -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;
|
||||
}
|
||||
|
@ -13,6 +13,38 @@ module_name = 'backup'
|
||||
|
||||
class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
def test_basic_full_backup(self):
|
||||
"""
|
||||
Just test full backup with at least two segments
|
||||
"""
|
||||
fname = self.id().split('.')[3]
|
||||
node = self.make_simple_node(
|
||||
base_dir=os.path.join(module_name, 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, module_name, 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)
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
# @unittest.expectedFailure
|
||||
# PGPRO-707
|
||||
|
@ -16,7 +16,7 @@ module_name = 'ptrack'
|
||||
class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
def setUp(self):
|
||||
if self.pg_config_version < self.version_to_num('11.0'):
|
||||
return unittest.skip('You need PostgreSQL >= 11 for this test')
|
||||
self.skipTest('You need PostgreSQL >= 11 for this test')
|
||||
self.fname = self.id().split('.')[3]
|
||||
|
||||
# @unittest.skip("skip")
|
||||
|
Loading…
Reference in New Issue
Block a user