Skip to content

WPB-28665: add PostGreSQL support for query user search - #5539

Open
blackheaven wants to merge 5 commits into
developfrom
gdifolco/WPB-28655-migrate-user-search-postgresql
Open

blackheaven wants to merge 5 commits into
developfrom
gdifolco/WPB-28655-migrate-user-search-postgresql

Conversation

@blackheaven

@blackheaven blackheaven commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

https://wearezeta.atlassian.net/browse/WPB-28665

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@blackheaven
blackheaven requested review from a team as code owners September 11, 2026 17:47
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Sep 11, 2026
@blackheaven blackheaven changed the title feat(brig): remove ElasticSearch; query user search from Postgres WPB-28665: remove ElasticSearch; query user search from Postgres Sep 11, 2026
@blackheaven blackheaven added the ready-for-review looking actively for reviewer label Sep 11, 2026

@fisx fisx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be awesome, but the ticket doesn't really say anything about re-architecting anything? Also, shouldn't we do some load testing before we merge this? Or maybe after, before the next release?

@blackheaven

Copy link
Copy Markdown
Contributor Author

@fisx as discussed during the meeting this morning, we are not ready yet for load testing, instead, we should support both for a little while, I'll rework my PR in this direction.

@blackheaven
blackheaven force-pushed the gdifolco/WPB-28655-migrate-user-search-postgresql branch from e2fa56a to 7cd6d34 Compare September 24, 2026 14:38
@blackheaven
blackheaven requested a review from fisx September 24, 2026 14:41
…fault, Postgres optional)

Rebased onto develop; restores the ElasticSearch stack removed by the original PR. Keeps the UserSearchStore effect with its Postgres interpreter and adds a thin ElasticSearch adapter delegating to IndexedUserStore, so all search reads (local search, team browse, team size, search-visibility) go through one interface. In Postgres mode the ES index write path is neutralized via a no-op IndexedUserStore interpreter; brig's Postgres user store now maintains wire_user.name_normalized on insert/update. brig-index regains the ES tooling plus a new backfill-normalized-names subcommand. ES backend is deprecated; migration steps documented.
@blackheaven
blackheaven force-pushed the gdifolco/WPB-28655-migrate-user-search-postgresql branch from 7cd6d34 to 6e7477f Compare September 24, 2026 15:08
CREATE INDEX CONCURRENTLY cannot run inside a transaction; the migration runner only exempts scripts listed in nonTransactionMigrations. Move the three index statements to their own script registered there, keeping the transactional DDL (ALTER TABLE wire_user, CREATE TABLE team_search_visibility) in the original file. Fixes the brig/galley PostgresMigrationUsageError crashloop in the integration environment.
Hasql.Session.script sends a whole script as one simple-query message, and Postgres runs multiple statements of one message in a single implicit transaction - so a script containing several CREATE INDEX CONCURRENTLY statements still fails with SQLSTATE 25001 even on the non-transactional path. Split the user-search index migration into three single-statement scripts, all registered in nonTransactionMigrations.
@blackheaven blackheaven changed the title WPB-28665: remove ElasticSearch; query user search from Postgres WPB-28665: add PostGreSQL support for query user search Sep 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist ready-for-review looking actively for reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants