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

Commitccdf25e

Browse files
committed
Adapt to PG 12 where recovery.conf is obsolete.
1 parent568603c commitccdf25e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

‎testgres/node.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,15 @@ def _create_recovery_conf(self, username, slot=None):
336336

337337
line= (
338338
"primary_conninfo='{}'\n"
339-
"standby_mode=on\n"
340339
).format(options_string(**conninfo))# yapf: disable
340+
# Since 12 recovery.conf had disappeared
341+
ifself.version>='12':
342+
signal_name=os.path.join(self.data_dir,"standby.signal")
343+
# cross-python touch(). It is vulnerable to races, but who cares?
344+
withopen(signal_name,'a'):
345+
os.utime(signal_name,None)
346+
else:
347+
line+="standby_mode=on\n"
341348

342349
ifslot:
343350
# Connect to master for some additional actions
@@ -363,7 +370,10 @@ def _create_recovery_conf(self, username, slot=None):
363370

364371
line+="primary_slot_name={}\n".format(slot)
365372

366-
self.append_conf(filename=RECOVERY_CONF_FILE,line=line)
373+
ifself.version>='12':
374+
self.append_conf(line=line)
375+
else:
376+
self.append_conf(filename=RECOVERY_CONF_FILE,line=line)
367377

368378
def_maybe_start_logger(self):
369379
iftestgres_config.use_python_logging:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp