Commit cc06340
authored
ConversationStore: Implement migration to postgres (#4810)
* ConversationStore.Migration: Implement function to migrate a conversation
* ConversationStore.Cassandra: Add hybrid interpretter, which will work during migration
Exceptions:
1. Getting a paginated list of qualified conv Ids
2. It will not work well if the migration fails to delete conv data from
Cassandra after copying it to postgres
These problems will be solved in following commits
* ConverastionStore.Cassandra: Fix edge case bug in getLocalConvIds
When fetching `maxIds + 1` convs, it can happen that a user has exactly those
many convs left, in this case the `hasMore` field of the page would be false,
but we'd be sending a truncated list of convs.
* ConverastionStore: Make GetConverastionIds work during migration
This is done by making the pagingState encode last conversation Id served. The
store effect has a new action to list only remote conv ids. The
`GetConverastionIds` action has been removed and implemented generally using
`GetLocalConverastionIds` and `GetRemoteConversationIds`.
This makes `MultiTabelPage` type obsolete for conv ids, but its still kept
around so we don't break any APIs.
* ConversationStore.Cassandra: Save users joining their first remote conv in postgres
This is consistent with creating new conversations in postgres. This way when
the migration is complete already running galley instances won't create more
data in Cassandra
* ConversationStore.Cassandra: Use `embedClient`
* ConversationStore.Migration: Implement function to migrate a remote statuses of a user
* ConversationStore.Migration: Add top level functions to do the migration
* Conversation.{Migration,Cassandra}: Ensure pending deletes from Cassandra are never read
Exception: Listing local conversation ids and listing team conversation ids
* ConverastionStore.Cassandra: Document limitation in listing conv ids
* galley: Allow choosing migration interpreter for ConversationStore
* background-worker: Integrate with ConvSubsystem to allow migrating convs to postgres
* integration: Set cassandra keyspace and pg db names for dyn background worker
* integration: Add a test to test conversation migration
* background-worker: Add some observability to pg migration
* integration: Add another test with more convos, but use proteus for speed
* ConversationStore.{Cassandra,Postgres}: Use same ordering of UUIDs
Cassandra cares for UUID version in ordering. Postgres doesn't, so the Postgres
query needs to be weird.
* wire-subsystems: Move PGConstraints to Wire.Postgres
* ConversationStore.Cassandra: Implement SearchConversation for the migration interpreter
It returns empty.
* galley-integration: Change assertions about pagination
Because sometimes we don't have to get an empty page to realize we're at the end
* integration-setup: More CPU/memory for postgresql
Also stop any throttling, OOMKilling
* charts/integration: Mount background-worker secrets
* integration: Set cassandra keyspace for dynamic cannons
* integration-setup: Allow tests to run for 5 more mins
* galley-integration: Produce better error message
* docs: Add steps for migrations
* galley-integration: Relax the requirement that getConvs returns convs in same order as IDs1 parent c1480bf commit cc06340
File tree
49 files changed
+2187
-251
lines changed- changelog.d
- 0-release-notes
- 2-features
- charts
- background-worker
- templates
- integration/templates
- docs/src/developer/reference
- hack
- bin
- helm_vars
- postgresql
- wire-server
- integration
- test
- MLS
- Testlib
- Test/Conversation
- libs
- polysemy-wire-zoo/src/Wire/Sem/Paging
- wire-api/src/Wire/API/Conversation
- wire-subsystems
- postgres-migrations
- src/Wire
- ConversationStore
- Cassandra
- Migration
- services
- background-worker
- src/Wire
- BackgroundWorker
- test/Test/Wire
- galley
- src/Galley
- API
- test/integration
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
49 files changed
+2187
-251
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
33 | 51 | | |
34 | 52 | | |
35 | 53 | | |
| |||
46 | 64 | | |
47 | 65 | | |
48 | 66 | | |
| 67 | + | |
| 68 | + | |
49 | 69 | | |
50 | 70 | | |
51 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
51 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
| |||
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
67 | 80 | | |
68 | 81 | | |
69 | 82 | | |
70 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
71 | 87 | | |
72 | 88 | | |
73 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
34 | 67 | | |
35 | 68 | | |
36 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
| |||
250 | 255 | | |
251 | 256 | | |
252 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
253 | 261 | | |
254 | 262 | | |
255 | 263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1683 | 1683 | | |
1684 | 1684 | | |
1685 | 1685 | | |
1686 | | - | |
1687 | | - | |
| 1686 | + | |
1688 | 1687 | | |
1689 | | - | |
| 1688 | + | |
1690 | 1689 | | |
1691 | 1690 | | |
1692 | 1691 | | |
| |||
1696 | 1695 | | |
1697 | 1696 | | |
1698 | 1697 | | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
1699 | 1753 | | |
1700 | 1754 | | |
1701 | 1755 | | |
| |||
0 commit comments