@@ -339,7 +339,7 @@ def _create_recovery_conf(self, username, slot=None):
339
339
"primary_conninfo='{}'\n "
340
340
).format (options_string (** conninfo )) # yapf: disable
341
341
# Since 12 recovery.conf had disappeared
342
- if self .version >= '12' :
342
+ if self .version >= PgVer ( '12' ) :
343
343
signal_name = os .path .join (self .data_dir , "standby.signal" )
344
344
# cross-python touch(). It is vulnerable to races, but who cares?
345
345
with open (signal_name , 'a' ):
@@ -371,7 +371,7 @@ def _create_recovery_conf(self, username, slot=None):
371
371
372
372
line += "primary_slot_name={}\n " .format (slot )
373
373
374
- if self .version >= '12' :
374
+ if self .version >= PgVer ( '12' ) :
375
375
self .append_conf (line = line )
376
376
else :
377
377
self .append_conf (filename = RECOVERY_CONF_FILE , line = line )
@@ -517,9 +517,9 @@ def get_auth_method(t):
517
517
# binary replication
518
518
if allow_streaming :
519
519
# select a proper wal_level for PostgreSQL
520
- wal_level = 'replica' if self ._pg_version >= '9.6' else 'hot_standby'
520
+ wal_level = 'replica' if self ._pg_version >= PgVer ( '9.6' ) else 'hot_standby'
521
521
522
- if self ._pg_version < '13' :
522
+ if self ._pg_version < PgVer ( '13' ) :
523
523
self .append_conf (hot_standby = True ,
524
524
wal_keep_segments = WAL_KEEP_SEGMENTS ,
525
525
wal_level = wal_level ) # yapf: disable
@@ -530,7 +530,7 @@ def get_auth_method(t):
530
530
531
531
# logical replication
532
532
if allow_logical :
533
- if self ._pg_version < '10' :
533
+ if self ._pg_version < PgVer ( '10' ) :
534
534
raise InitNodeException ("Logical replication is only "
535
535
"available on PostgreSQL 10 and newer" )
536
536
@@ -616,7 +616,7 @@ def get_control_data(self):
616
616
617
617
# this one is tricky (blame PG 9.4)
618
618
_params = [get_bin_path ("pg_controldata" )]
619
- _params += ["-D" ] if self ._pg_version >= '9.5' else []
619
+ _params += ["-D" ] if self ._pg_version >= PgVer ( '9.5' ) else []
620
620
_params += [self .data_dir ]
621
621
622
622
data = execute_utility (_params , self .utils_log_file )
@@ -758,7 +758,7 @@ def promote(self, dbname=None, username=None):
758
758
759
759
# for versions below 10 `promote` is asynchronous so we need to wait
760
760
# until it actually becomes writable
761
- if self ._pg_version < '10' :
761
+ if self ._pg_version < PgVer ( '10' ) :
762
762
check_query = "SELECT pg_is_in_recovery()"
763
763
764
764
self .poll_query_until (query = check_query ,
@@ -1158,7 +1158,7 @@ def set_synchronous_standbys(self, standbys):
1158
1158
master.restart()
1159
1159
1160
1160
"""
1161
- if self ._pg_version >= '9.6' :
1161
+ if self ._pg_version >= PgVer ( '9.6' ) :
1162
1162
if isinstance (standbys , Iterable ):
1163
1163
standbys = First (1 , standbys )
1164
1164
else :
@@ -1179,7 +1179,7 @@ def catchup(self, dbname=None, username=None):
1179
1179
if not self .master :
1180
1180
raise TestgresException ("Node doesn't have a master" )
1181
1181
1182
- if self ._pg_version >= '10' :
1182
+ if self ._pg_version >= PgVer ( '10' ) :
1183
1183
poll_lsn = "select pg_catalog.pg_current_wal_lsn()::text"
1184
1184
wait_lsn = "select pg_catalog.pg_last_wal_replay_lsn() >= '{}'::pg_lsn"
1185
1185
else :
0 commit comments