Skip to content

Commit 42ce25b

Browse files
committed
Fix python tests for pg10
1 parent b587e48 commit 42ce25b

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

tests/python/partitioning_test.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
import subprocess
1717
import threading
1818

19-
from testgres import get_new_node, stop_all
19+
from testgres import get_new_node, stop_all, get_config
2020

21+
version = get_config().get("VERSION_NUM")
2122

2223
# Helper function for json equality
2324
def ordered(obj):
@@ -68,11 +69,17 @@ def init_test_data(self, node):
6869

6970
def catchup_replica(self, master, replica):
7071
"""Wait until replica synchronizes with master"""
71-
master.poll_query_until(
72-
'postgres',
73-
'SELECT pg_current_xlog_location() <= replay_location '
74-
'FROM pg_stat_replication WHERE application_name = \'%s\''
75-
% replica.name)
72+
if version >= 100000:
73+
wait_lsn_query = \
74+
'SELECT pg_current_wal_lsn() <= replay_lsn ' \
75+
'FROM pg_stat_replication WHERE application_name = \'%s\'' \
76+
% replica.name
77+
else:
78+
wait_lsn_query = \
79+
'SELECT pg_current_xlog_location() <= replay_location ' \
80+
'FROM pg_stat_replication WHERE application_name = \'%s\'' \
81+
% replica.name
82+
master.poll_query_until('postgres', wait_lsn_query)
7683

7784
def printlog(self, logfile):
7885
with open(logfile, 'r') as log:
@@ -482,7 +489,6 @@ def test_parallel_nodes(self):
482489

483490
# Check version of postgres server
484491
# If version < 9.6 skip all tests for parallel queries
485-
version = int(node.psql("postgres", "show server_version_num")[1])
486492
if version < 90600:
487493
return
488494

@@ -512,7 +518,10 @@ def test_parallel_nodes(self):
512518
# Test parallel select
513519
with node.connect() as con:
514520
con.execute('set max_parallel_workers_per_gather = 2')
515-
con.execute('set min_parallel_relation_size = 0')
521+
if version >= 100000:
522+
con.execute('set min_parallel_table_scan_size = 0')
523+
else:
524+
con.execute('set min_parallel_relation_size = 0')
516525
con.execute('set parallel_setup_cost = 0')
517526
con.execute('set parallel_tuple_cost = 0')
518527

0 commit comments

Comments
 (0)