[PGPRO-5691] ptrack-2.3: move mmapped ptrack map into shared postgres memory

In ptrack-2.3 ptrack.map.mmap will be removed and 'incorrect checksum' error
will not be fatal
This commit is contained in:
Mikhail A. Kulagin
2022-02-09 10:26:57 +03:00
parent a454bd7d63
commit 75a221c207
+5 -24
View File
@@ -4338,48 +4338,29 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
node.stop(['-m', 'immediate', '-D', node.data_dir])
ptrack_map = os.path.join(node.data_dir, 'global', 'ptrack.map')
ptrack_map_mmap = os.path.join(node.data_dir, 'global', 'ptrack.map.mmap')
# Let`s do index corruption. ptrack.map, ptrack.map.mmap
# Let`s do index corruption. ptrack.map
with open(ptrack_map, "rb+", 0) as f:
f.seek(42)
f.write(b"blablahblahs")
f.flush()
f.close
with open(ptrack_map_mmap, "rb+", 0) as f:
f.seek(42)
f.write(b"blablahblahs")
f.flush()
f.close
# os.remove(os.path.join(node.logs_dir, node.pg_log_name))
try:
node.slow_start()
# we should die here because exception is what we expect to happen
self.assertEqual(
1, 0,
"Expecting Error because ptrack.map is corrupted"
"\n Output: {0} \n CMD: {1}".format(
repr(self.output), self.cmd))
except StartNodeException as e:
self.assertIn(
'Cannot start node',
e.message,
'\n Unexpected Error Message: {0}\n'
' CMD: {1}'.format(repr(e.message), self.cmd))
node.slow_start()
log_file = os.path.join(node.logs_dir, 'postgresql.log')
with open(log_file, 'r') as f:
log_content = f.read()
self.assertIn(
'FATAL: ptrack init: incorrect checksum of file "{0}"'.format(ptrack_map),
'WARNING: ptrack read map: incorrect checksum of file "{0}"'.format(ptrack_map),
log_content)
self.set_auto_conf(node, {'ptrack.map_size': '0'})
node.stop(['-D', node.data_dir])
self.set_auto_conf(node, {'ptrack.map_size': '0'})
node.slow_start()
try: