@@ -336,8 +336,15 @@ def _create_recovery_conf(self, username, slot=None):
336336
337337line = (
338338"primary_conninfo='{}'\n "
339- "standby_mode=on\n "
340339 ).format (options_string (** conninfo ))# yapf: disable
340+ # Since 12 recovery.conf had disappeared
341+ if self .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+ with open (signal_name ,'a' ):
345+ os .utime (signal_name ,None )
346+ else :
347+ line += "standby_mode=on\n "
341348
342349if slot :
343350# Connect to master for some additional actions
@@ -363,7 +370,10 @@ def _create_recovery_conf(self, username, slot=None):
363370
364371line += "primary_slot_name={}\n " .format (slot )
365372
366- self .append_conf (filename = RECOVERY_CONF_FILE ,line = line )
373+ if self .version >= '12' :
374+ self .append_conf (line = line )
375+ else :
376+ self .append_conf (filename = RECOVERY_CONF_FILE ,line = line )
367377
368378def _maybe_start_logger (self ):
369379if testgres_config .use_python_logging :