Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

galley: Cleanup garbage data in mls_group_member_client table and drop unused member_client table #3648

Merged
merged 4 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.d/5-internal/wpb-5033
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Truncate `galley.mls_group_member_client` table and drop `galley.member_client` table.

The data in `mls_group_member_client` could contain nulls from client testing in prod. So, its OK to truncate it.
The `member_client` table is unused.
1 change: 0 additions & 1 deletion hack/bin/cassandra_dump_schema
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def main():
for keyspace in keyspaces:
if keyspace.endswith('_test'):
s = run_cqlsh(container, f'DESCRIBE keyspace {keyspace}')
print(s.replace('CREATE TABLE galley_test.member_client','-- NOTE: this table is unused. It was replaced by mls_group_member_client\nCREATE TABLE galley_test.member_client'))
print()

if __name__ == '__main__':
Expand Down
5 changes: 2 additions & 3 deletions services/galley/galley.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ library
Galley.Schema.V85_MLSDraft17
Galley.Schema.V86_TeamFeatureMlsMigration
Galley.Schema.V87_TeamFeatureSupportedProtocols
Galley.Schema.V88_TruncateMLSGroupMemberClient
Galley.Schema.V89_RemoveMemberClient
Galley.Types.Clients
Galley.Types.ToUserRole
Galley.Types.UserList
Expand Down Expand Up @@ -563,7 +565,6 @@ executable galley-migrate-data
Paths_galley
Run
V1_BackfillBillingTeamMembers
V2_MigrateMLSMembers
V3_BackfillTeamAdmins

hs-source-dirs: migrate-data/src
Expand All @@ -574,7 +575,6 @@ executable galley-migrate-data
, containers
, exceptions
, extended
, galley
, galley-types
, imports
, lens
Expand All @@ -583,7 +583,6 @@ executable galley-migrate-data
, time
, tinylog
, types-common
, unliftio
, wire-api

if flag(static)
Expand Down
2 changes: 0 additions & 2 deletions services/galley/migrate-data/src/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import Imports
import Options.Applicative
import System.Logger.Extended qualified as Log
import V1_BackfillBillingTeamMembers qualified
import V2_MigrateMLSMembers qualified
import V3_BackfillTeamAdmins qualified

main :: IO ()
Expand All @@ -33,7 +32,6 @@ main = do
l
o
[ V1_BackfillBillingTeamMembers.migration,
V2_MigrateMLSMembers.migration,
V3_BackfillTeamAdmins.migration
]
where
Expand Down
101 changes: 0 additions & 101 deletions services/galley/migrate-data/src/V2_MigrateMLSMembers.hs

This file was deleted.

6 changes: 5 additions & 1 deletion services/galley/src/Galley/Schema/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ import Galley.Schema.V84_MLSSubconversation qualified as V84_MLSSubconversation
import Galley.Schema.V85_MLSDraft17 qualified as V85_MLSDraft17
import Galley.Schema.V86_TeamFeatureMlsMigration qualified as V86_TeamFeatureMlsMigration
import Galley.Schema.V87_TeamFeatureSupportedProtocols qualified as V87_TeamFeatureSupportedProtocols
import Galley.Schema.V88_TruncateMLSGroupMemberClient qualified as V88_TruncateMLSGroupMemberClient
import Galley.Schema.V89_RemoveMemberClient qualified as V89_RemoveMemberClient
import Imports
import Options.Applicative
import System.Logger.Extended qualified as Log
Expand Down Expand Up @@ -175,7 +177,9 @@ migrations =
V84_MLSSubconversation.migration,
V85_MLSDraft17.migration,
V86_TeamFeatureMlsMigration.migration,
V87_TeamFeatureSupportedProtocols.migration
V87_TeamFeatureSupportedProtocols.migration,
V88_TruncateMLSGroupMemberClient.migration,
V89_RemoveMemberClient.migration
-- FUTUREWORK: once #1726 has made its way to master/production,
-- the 'message' field in connections table can be dropped.
-- See also https://github.com/wireapp/wire-server/pull/1747/files
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2023 Wire Swiss GmbH <opensource@wire.com>
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU Affero General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option) any
-- later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-- details.
--
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.
module Galley.Schema.V88_TruncateMLSGroupMemberClient
( migration,
)
where

import Cassandra.Schema
import Imports
import Text.RawString.QQ

-- | This migration exists because the table could have some rogue data in it
-- before MLS Draft-17 was implemented. It was not supposed to be used, but it
-- could've been. This migration just deletes old data. This could break some
-- conversations/users in unknown ways. But those are most likely test users.
migration :: Migration
migration = Migration 88 "Truncate mls_group_member_client" $ do
schema'
[r|TRUNCATE TABLE mls_group_member_client|]
33 changes: 33 additions & 0 deletions services/galley/src/Galley/Schema/V89_RemoveMemberClient.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2023 Wire Swiss GmbH <opensource@wire.com>
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU Affero General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option) any
-- later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-- details.
--
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.
module Galley.Schema.V89_RemoveMemberClient
( migration,
)
where

import Cassandra.Schema
import Imports
import Text.RawString.QQ

-- | This migration exists because the table could have some rogue data in it
-- before MLS Draft-17 was implemented. It was not supposed to be used, but it
-- could've been. This migration just deletes old data. This could break some
-- conversations/users in unknown ways. But those are most likely test users.
migration :: Migration
migration = Migration 88 "Remove member_client" $ do
schema'
[r|DROP TABLE IF EXISTS member_client|]
Loading