Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[PGPRO-5691] ptrack-2.3: move mmapped ptrack map into shared postgres…#471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kulaginm merged 2 commits intomasterfrompgpro-5691
Feb 12, 2022
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 36 additions & 27 deletionstests/ptrack.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4314,6 +4314,8 @@ def test_corrupt_ptrack_map(self):
"postgres",
"CREATE EXTENSION ptrack")

ptrack_version = self.get_ptrack_version(node)

# Create table
node.safe_psql(
"postgres",
Expand All@@ -4338,48 +4340,55 @@ def test_corrupt_ptrack_map(self):
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:
if self.verbose:
print('Ptrack version:', ptrack_version)
if ptrack_version >= self.version_to_num("2.3"):
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:

log_file = os.path.join(node.logs_dir, 'postgresql.log')
with open(log_file, 'r') as f:
log_content = f.read()

self.assertIn(
'Cannot start node',
e.message,
'\n Unexpected Error Message: {0}\n'
' CMD: {1}'.format(repr(e.message), self.cmd))
'WARNING: ptrack read map: incorrect checksum of file "{0}"'.format(ptrack_map),
log_content)

log_file = os.path.join(node.logs_dir, 'postgresql.log')
with open(log_file, 'r') as f:
log_content = f.read()
node.stop(['-D', node.data_dir])
else:
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))

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),
log_content)
self.assertIn(
'FATAL: ptrack init: incorrect checksum of file "{0}"'.format(ptrack_map),
log_content)

self.set_auto_conf(node, {'ptrack.map_size': '0'})

node.slow_start()

try:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp