launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23490
[Merge] lp:~cjwatson/launchpad/remove-postgresql-9.x-support into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/remove-postgresql-9.x-support into lp:launchpad.
Commit message:
Remove support for running on PostgreSQL < 10.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/remove-postgresql-9.x-support/+merge/365845
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/remove-postgresql-9.x-support into lp:launchpad.
=== modified file 'database/schema/dbcontroller.py'
--- database/schema/dbcontroller.py 2019-03-25 21:12:02 +0000
+++ database/schema/dbcontroller.py 2019-04-11 09:41:09 +0000
@@ -39,23 +39,14 @@
cur = con.cursor()
# Force a WAL switch, returning the current position.
- if con.server_version >= 100000:
- cur.execute('SELECT pg_switch_wal()')
- else:
- cur.execute('SELECT pg_switch_xlog()')
+ cur.execute('SELECT pg_switch_wal()')
wal_point = cur.fetchone()[0]
start_time = time.time()
while timeout is None or time.time() < start_time + timeout:
- 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,))
+ cur.execute("""
+ SELECT FALSE FROM pg_stat_replication
+ WHERE replay_lsn < %s LIMIT 1
+ """, (wal_point,))
if cur.fetchone() is None:
# All slaves, possibly 0, are in sync.
return True
@@ -112,10 +103,7 @@
try:
con = pg_connect(conn_str)
cur = con.cursor()
- if con.server_version >= 100000:
- cur.execute('select pg_wal_replay_pause()')
- else:
- cur.execute('select pg_xlog_replay_pause()')
+ cur.execute('select pg_wal_replay_pause()')
except psycopg2.Error, x:
self.log.error(
'Unable to pause replication to %s (%s).'
@@ -131,10 +119,7 @@
try:
con = pg_connect(conn_str)
cur = con.cursor()
- if con.server_version >= 100000:
- cur.execute('select pg_wal_replay_resume()')
- else:
- cur.execute('select pg_xlog_replay_resume()')
+ cur.execute('select pg_wal_replay_resume()')
except psycopg2.Error, x:
success = False
self.log.error(
@@ -155,17 +140,11 @@
try:
con = pg_connect(conn_str)
cur = con.cursor()
- if con.server_version >= 100000:
- cur.execute("SELECT pg_is_wal_replay_paused()")
- else:
- cur.execute("SELECT pg_is_xlog_replay_paused()")
+ cur.execute("SELECT pg_is_wal_replay_paused()")
replication_paused = cur.fetchone()[0]
if replication_paused:
self.log.warn("Replication paused on %s. Resuming.", name)
- if con.server_version >= 100000:
- cur.execute("SELECT pg_wal_replay_resume()")
- else:
- cur.execute("SELECT pg_xlog_replay_resume()")
+ cur.execute("SELECT pg_wal_replay_resume()")
wait_for_sync = True
except psycopg2.Error, x:
success = False
=== modified file 'database/schema/full-update.py'
--- database/schema/full-update.py 2019-03-05 13:30:42 +0000
+++ database/schema/full-update.py 2019-04-11 09:41:09 +0000
@@ -175,14 +175,9 @@
# Resume replication.
replication_paused = not controller.resume_replication()
if replication_paused:
- if master_con.server_version >= 100000:
- log.error(
- "Failed to resume replication. Run pg_wal_replay_pause() "
- "on all slaves to manually resume.")
- else:
- log.error(
- "Failed to resume replication. Run pg_xlog_replay_pause() "
- "on all slaves to manually resume.")
+ log.error(
+ "Failed to resume replication. Run pg_wal_replay_pause() "
+ "on all slaves to manually resume.")
else:
if controller.sync():
log.info('Slaves in sync. Updates replicated.')
=== modified file 'test_on_merge.py'
--- test_on_merge.py 2019-03-05 13:03:45 +0000
+++ test_on_merge.py 2019-04-11 09:41:09 +0000
@@ -60,8 +60,8 @@
# Sanity check PostgreSQL version. No point in trying to create a test
# database when PostgreSQL is too old.
con = psycopg2.connect('dbname=template1')
- if con.server_version < 90300:
- print 'Your PostgreSQL version is too old. You need at least 9.3.x'
+ if con.server_version < 100000:
+ print 'Your PostgreSQL version is too old. You need at least 10.x'
print 'You have %s' % con.get_parameter_status('server_version')
return 1
=== modified file 'utilities/launchpad-database-setup'
--- utilities/launchpad-database-setup 2019-03-05 13:36:18 +0000
+++ utilities/launchpad-database-setup 2019-04-11 09:41:09 +0000
@@ -19,7 +19,7 @@
# initial Launchpad setup on an otherwise unconfigured postgresql instance
pgversion=
-for try_pgversion in 9.3 9.5 9.6 10
+for try_pgversion in 10
do
sudo grep -qs "^auto" /etc/postgresql/$try_pgversion/main/start.conf
if [ $? -eq 0 ]; then
Follow ups