launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23458
[Merge] lp:~cjwatson/launchpad/postgresql-10-more-replication into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/postgresql-10-more-replication into lp:launchpad.
Commit message:
Handle renaming of pg_stat_replication.replay_location to pg_stat_replication.replay_lsn in PostgreSQL 10.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/postgresql-10-more-replication/+merge/365074
Spotted in staging logs:
Traceback (most recent call last):
File "./full-update.py", line 232, in <module>
sys.exit(main())
File "./full-update.py", line 116, in main
if not NoConnectionCheckPreflight(log, controller).check_all():
File "/srv/staging.launchpad.net/staging/launchpad/database/schema/preflight.py", line 313, in check_all
if not self.replication_paused and not self.check_can_sync():
File "/srv/staging.launchpad.net/staging/launchpad/database/schema/preflight.py", line 281, in check_can_sync
streaming_success = streaming_sync(self.lpmain_master_node.con, 30)
File "/srv/staging.launchpad.net/staging/launchpad/database/schema/dbcontroller.py", line 52, in streaming_sync
""", (wal_point,))
psycopg2.ProgrammingError: column "replay_location" does not exist
LINE 3: WHERE replay_location < E'4B61/FF003210' LIMIT 1
^
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/postgresql-10-more-replication into lp:launchpad.
=== modified file 'database/schema/dbcontroller.py'
--- database/schema/dbcontroller.py 2019-03-05 13:30:42 +0000
+++ database/schema/dbcontroller.py 2019-03-25 21:18:51 +0000
@@ -46,10 +46,16 @@
wal_point = cur.fetchone()[0]
start_time = time.time()
while timeout is None or time.time() < start_time + timeout:
- cur.execute("""
- SELECT FALSE FROM pg_stat_replication
- WHERE replay_location < %s LIMIT 1
- """, (wal_point,))
+ if con.server_version >= 100000:
+ cur.execute("""
+ SELECT FALSE FROM pg_stat_replication
+ WHERE replay_lsn < %s LIMIT 1
+ """, (wal_point,))
+ else:
+ cur.execute("""
+ SELECT FALSE FROM pg_stat_replication
+ WHERE replay_location < %s LIMIT 1
+ """, (wal_point,))
if cur.fetchone() is None:
# All slaves, possibly 0, are in sync.
return True
Follow ups