launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28311
[Merge] ~cjwatson/launchpad:psycopg2-2.8.6 into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:psycopg2-2.8.6 into launchpad:master.
Commit message:
Upgrade to psycopg2 2.8.6
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/418936
This fixes building that wheel on Python 3.8.
psycopg2 now raises more specific exception types in various situations (see https://github.com/psycopg/psycopg2/issues/682), so some tests need to be adjusted for that, and `lp.testing.pgsql.PgTestSetup` can take advantage of it.
Dependencies MP: https://code.launchpad.net/~cjwatson/lp-source-dependencies/+git/lp-source-dependencies/+merge/418935
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:psycopg2-2.8.6 into launchpad:master.
diff --git a/lib/lp/bugs/doc/bugtask-search.txt b/lib/lp/bugs/doc/bugtask-search.txt
index bf5b046..523956c 100644
--- a/lib/lp/bugs/doc/bugtask-search.txt
+++ b/lib/lp/bugs/doc/bugtask-search.txt
@@ -109,7 +109,7 @@ Passing invalid tsquery expressions as fast_searchtext raises an exception.
>>> list(firefox.searchTasks(bad_search))
Traceback (most recent call last):
...
- storm.database.ProgrammingError:
+ storm.database.SyntaxError:
syntax error in tsquery: "happens pretty often" ...
>>> import transaction
diff --git a/lib/lp/bugs/doc/official-bug-tags.txt b/lib/lp/bugs/doc/official-bug-tags.txt
index 754c045..047a768 100644
--- a/lib/lp/bugs/doc/official-bug-tags.txt
+++ b/lib/lp/bugs/doc/official-bug-tags.txt
@@ -42,7 +42,7 @@ But bug tags must be unique for each product and distribution.
<lp.bugs.model.bugtarget.OfficialBugTag object at...
>>> store.flush()
Traceback (most recent call last):
- storm.database.IntegrityError: ...
+ storm.database.UniqueViolation: ...
>>> import transaction
>>> transaction.abort()
diff --git a/lib/lp/services/database/doc/db-policy.txt b/lib/lp/services/database/doc/db-policy.txt
index fbb9aae..46f3b5d 100644
--- a/lib/lp/services/database/doc/db-policy.txt
+++ b/lib/lp/services/database/doc/db-policy.txt
@@ -41,7 +41,7 @@ a single primary.
>>> transaction.commit()
Traceback (most recent call last):
...
- storm.database.InternalError: ...
+ storm.database.ReadOnlySqlTransaction: ...
>>> transaction.abort()
diff --git a/lib/lp/services/database/doc/multitablecopy.txt b/lib/lp/services/database/doc/multitablecopy.txt
index 4c74ff5..ece80a5 100644
--- a/lib/lp/services/database/doc/multitablecopy.txt
+++ b/lib/lp/services/database/doc/multitablecopy.txt
@@ -329,7 +329,7 @@ which means that the attempt to insert it will violate a unique constraint.
>>> copier.pour(transaction)
Traceback (most recent call last):
...
- storm.database.IntegrityError:
+ storm.database.UniqueViolation:
duplicate ... violates unique constraint ...
Now we have a fun situation! Some data has been copied back into our source
diff --git a/lib/lp/services/database/doc/storm.txt b/lib/lp/services/database/doc/storm.txt
index 2690d05..ae440f5 100644
--- a/lib/lp/services/database/doc/storm.txt
+++ b/lib/lp/services/database/doc/storm.txt
@@ -75,7 +75,7 @@ from a store other than the correct Master.
>>> transaction.commit()
Traceback (most recent call last):
...
- storm.database.InternalError: ...
+ storm.database.ReadOnlySqlTransaction: ...
>>> transaction.abort()
>>> t = transaction.begin()
diff --git a/lib/lp/services/mail/tests/incomingmail.txt b/lib/lp/services/mail/tests/incomingmail.txt
index bd77caa..4805b25 100644
--- a/lib/lp/services/mail/tests/incomingmail.txt
+++ b/lib/lp/services/mail/tests/incomingmail.txt
@@ -446,7 +446,7 @@ out:
ERROR:...:An exception was raised inside the handler: http://...
Traceback (most recent call last):
...
- ...DataError: division by zero
+ ...DivisionByZero: division by zero
<BLANKLINE>
WARNING...
diff --git a/lib/lp/services/webapp/doc/test_adapter.txt b/lib/lp/services/webapp/doc/test_adapter.txt
index 04378eb..d19dfa3 100644
--- a/lib/lp/services/webapp/doc/test_adapter.txt
+++ b/lib/lp/services/webapp/doc/test_adapter.txt
@@ -218,7 +218,7 @@ timeout by sleeping for 200ms with a 100ms statement timeout:
Statement: 'SELECT pg_sleep(0.200)'
Parameters:()
Original error:
- QueryCanceledError('canceling statement due to statement timeout\n',)
+ QueryCanceled('canceling statement due to statement timeout\n'...)
Even though the statement timed out, it is recorded in the statement log:
@@ -292,7 +292,7 @@ timeout being reported by PostgreSQL is actually working:
Statement: 'SELECT pg_sleep(0.2)'
Parameters:()
Original error:
- QueryCanceledError('canceling statement due to statement timeout\n',)
+ QueryCanceled('canceling statement due to statement timeout\n'...)
>>> clear_request_started()
@@ -453,7 +453,7 @@ config section. By default we connect as "launchpad"
... """, noresult=True)
Traceback (most recent call last):
...
- storm.database.ProgrammingError:
+ storm.database.InsufficientPrivilege:
permission denied for relation sourcepackagename
This is not reset at the end of the transaction:
@@ -466,7 +466,7 @@ This is not reset at the end of the transaction:
... """, noresult=True)
Traceback (most recent call last):
...
- storm.database.ProgrammingError:
+ storm.database.InsufficientPrivilege:
permission denied for relation sourcepackagename
>>> transaction.abort()
diff --git a/lib/lp/services/webapp/doc/test_adapter_permissions.txt b/lib/lp/services/webapp/doc/test_adapter_permissions.txt
index 35d35e3..c342188 100644
--- a/lib/lp/services/webapp/doc/test_adapter_permissions.txt
+++ b/lib/lp/services/webapp/doc/test_adapter_permissions.txt
@@ -24,7 +24,7 @@ If a STANDBY_FLAVOR store is requested, it should trap all writes.
>>> transaction.commit()
Traceback (most recent call last):
...
- storm.database.InternalError: ...
+ storm.database.ReadOnlySqlTransaction: ...
Test this once more to ensure the settings stick across transactions.
@@ -34,7 +34,7 @@ Test this once more to ensure the settings stick across transactions.
>>> transaction.commit()
Traceback (most recent call last):
...
- storm.database.InternalError: ...
+ storm.database.ReadOnlySqlTransaction: ...
If a PRIMARY_FLAVOR is requested, it should allow writes to table in that
Store's replication set.
diff --git a/lib/lp/testing/pgsql.py b/lib/lp/testing/pgsql.py
index a6044cf..a13f43b 100644
--- a/lib/lp/testing/pgsql.py
+++ b/lib/lp/testing/pgsql.py
@@ -14,6 +14,10 @@ import time
from breezy.errors import LockContention
from breezy.lock import WriteLock
import psycopg2
+from psycopg2.errors import (
+ InvalidCatalogName,
+ ObjectInUse,
+ )
from lp.services.config import config
from lp.services.database import activity_cols
@@ -381,6 +385,8 @@ rw_main_standby: dbname=%s
try:
con = self.superuser_connection(self.template)
except psycopg2.OperationalError as x:
+ # At least in psycopg2 2.8.6, this doesn't seem to end up as
+ # a more specific exception type.
if 'does not exist' in str(x):
return
raise
@@ -406,17 +412,15 @@ rw_main_standby: dbname=%s
try:
cur = con.cursor()
cur.execute('DROP DATABASE %s' % self.dbname)
- except psycopg2.DatabaseError as x:
- if i == attempts - 1:
+ except InvalidCatalogName:
+ break
+ except ObjectInUse:
+ if i < attempts - 1:
+ time.sleep(0.1)
+ continue
+ else:
# Too many failures - raise an exception
raise
- if 'being accessed by other users' in str(x):
- if i < attempts - 1:
- time.sleep(0.1)
- continue
- if 'does not exist' in str(x):
- break
- raise
PgTestSetup._vacuum_shdepend_counter += 1
if (PgTestSetup._vacuum_shdepend_counter
% PgTestSetup.vacuum_shdepend_every) == 0:
diff --git a/requirements/launchpad.txt b/requirements/launchpad.txt
index 4b474ac..257211b 100644
--- a/requirements/launchpad.txt
+++ b/requirements/launchpad.txt
@@ -110,7 +110,7 @@ patiencediff==0.2.2
pgbouncer==0.0.9
prettytable==0.7.2
psutil==5.4.2
-psycopg2==2.7.4
+psycopg2==2.8.6
pyasn1==0.4.2
pyasn1-modules==0.2.1
pygettextpo==0.2
Follow ups