|
16 | 16 | import subprocess |
17 | 17 | import threading |
18 | 18 |
|
19 | | -from testgres import get_new_node, stop_all |
| 19 | +from testgres import get_new_node, stop_all, get_config |
20 | 20 |
|
| 21 | +version = get_config().get("VERSION_NUM") |
21 | 22 |
|
22 | 23 | # Helper function for json equality |
23 | 24 | def ordered(obj): |
@@ -68,11 +69,17 @@ def init_test_data(self, node): |
68 | 69 |
|
69 | 70 | def catchup_replica(self, master, replica): |
70 | 71 | """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) |
76 | 83 |
|
77 | 84 | def printlog(self, logfile): |
78 | 85 | with open(logfile, 'r') as log: |
@@ -482,7 +489,6 @@ def test_parallel_nodes(self): |
482 | 489 |
|
483 | 490 | # Check version of postgres server |
484 | 491 | # If version < 9.6 skip all tests for parallel queries |
485 | | - version = int(node.psql("postgres", "show server_version_num")[1]) |
486 | 492 | if version < 90600: |
487 | 493 | return |
488 | 494 |
|
@@ -512,7 +518,10 @@ def test_parallel_nodes(self): |
512 | 518 | # Test parallel select |
513 | 519 | with node.connect() as con: |
514 | 520 | 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') |
516 | 525 | con.execute('set parallel_setup_cost = 0') |
517 | 526 | con.execute('set parallel_tuple_cost = 0') |
518 | 527 |
|
|
0 commit comments