Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Trial tests against postgres 14 are failing since #11635 #14298

Closed
DMRobertson opened this issue Oct 26, 2022 · 6 comments · Fixed by #14310
Closed

Trial tests against postgres 14 are failing since #11635 #14298

DMRobertson opened this issue Oct 26, 2022 · 6 comments · Fixed by #14310
Assignees
Labels
A-Message-Search Searching messages T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. X-Regression Something broke which worked on a previous release

Comments

@DMRobertson
Copy link
Contributor

DMRobertson commented Oct 26, 2022

Latest deps: https://github.com/matrix-org/synapse/actions/runs/3326877285/jobs/5501039194
Develop: https://github.com/matrix-org/synapse/actions/runs/3323214952/jobs/5493346783

[FAIL]
Traceback (most recent call last):
  File "/home/runner/work/synapse/synapse/tests/storage/test_room_search.py", line 372, in test_postgres_web_search_for_phrase
    self._check_test_cases(store, self.COMMON_CASES + self.POSTGRES_CASES, index=0)
  File "/home/runner/work/synapse/synapse/tests/storage/test_room_search.py", line 323, in _check_test_cases
    self.assertEquals(
  File "/home/runner/.cache/pypoetry/virtualenvs/matrix-synapse-pswDeSvb-py3.10/lib/python3.10/site-packages/twisted/trial/_synctest.py", line 424, in assertEqual
    super().assertEqual(first, second, msg)
  File "/opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/unittest/case.py", line 845, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/unittest/case.py", line 838, in _baseAssertEqual
    raise self.failureException(msg)
twisted.trial.unittest.FailTest: 0 != 1 : expected '"fox quick' to match 'the quick brown fox jumps over the lazy dog'

tests.storage.test_room_search.MessageSearchTest.test_postgres_web_search_for_phrase

From #11635.

@DMRobertson DMRobertson added T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. X-Regression Something broke which worked on a previous release A-Message-Search Searching messages labels Oct 26, 2022
@DMRobertson
Copy link
Contributor Author

I'm assuming that test is to blame---but tests did pass before this was merged in. So not sure what's going on.

@DMRobertson
Copy link
Contributor Author

This didn't happen on the twisted trial job. Do we have a new flakey test---some kind of race?

@DMRobertson
Copy link
Contributor Author

DMRobertson commented Oct 26, 2022

Reproduce with

docker run --rm -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=synapse -p 5432:5432 postgres:14-alpine &
SYNAPSE_POSTGRES=1 SYNAPSE_POSTGRES_HOST=127.0.0.1 SYNAPSE_POSTGRES_USER=postgres SYNAPSE_POSTGRES_PASSWORD=postgres poetry run trial tests.storage.test_room_search.MessageSearchTest.test_postgres_web_search_for_phrase

I tried postgres versions 10--13. On each of these, the test succeeds. I wonder if the FTS behaviour has changed in PG 14?

@clokep clokep self-assigned this Oct 27, 2022
@clokep
Copy link
Member

clokep commented Oct 27, 2022

I'll take a look, thanks for filing! 🎉

@DMRobertson DMRobertson changed the title Trial tests against postgres are failing since #11635 Trial tests against postgres 14 are failing since #11635 Oct 27, 2022
@clokep
Copy link
Member

clokep commented Oct 27, 2022

Starting in Postgres 14 the behavior of a hanging double quote was changed; it used to ignore the double quote while now it treats it like a phrase.

In PostgreSQL 11 - 13:

postgres=# SELECT websearch_to_tsquery('english', '"fox quick');
 websearch_to_tsquery 
----------------------
 'fox' & 'quick'
(1 row)

In PostgreSQL 14:

postgres=# SELECT websearch_to_tsquery('english', '"fox quick');
 websearch_to_tsquery 
----------------------
 'fox' <-> 'quick'
(1 row)

Not sure what the perfect fix is for this...

@clokep
Copy link
Member

clokep commented Oct 27, 2022

See the release notes for psql 14 (and search for tsquery).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Message-Search Searching messages T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. X-Regression Something broke which worked on a previous release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants