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

Remove deprecated spar table in cassandra. #2768

Merged
merged 10 commits into from
Oct 18, 2022
19 changes: 0 additions & 19 deletions cassandra-schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -1623,24 +1623,6 @@ CREATE TABLE brig_test.service_prefix (

CREATE KEYSPACE spar_test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;

CREATE TABLE spar_test.scim_external_ids (
external text PRIMARY KEY,
user uuid
) WITH bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE spar_test.bind_cookie (
cookie text PRIMARY KEY,
session_owner uuid
Expand Down Expand Up @@ -2010,4 +1992,3 @@ CREATE TABLE spar_test.user (
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

3 changes: 3 additions & 0 deletions changelog.d/5-internal/cleanup-cassandra-schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Remove deprecated table for storing scim external_ids.

Data has been migrated away in [release 2021-03-21](https://github.com/wireapp/wire-server/releases/tag/v2021-03-21) (see `/services/spar/migrate-data/src/Spar/DataMigration/V1_ExternalIds.hs`); last time it has been touched in production is before upgrade to [release 2021-03-23 (Chart Release 2.104.0)](https://github.com/wireapp/wire-server/releases/tag/v2021-03-23).
4 changes: 2 additions & 2 deletions services/spar/migrate-data/src/Spar/DataMigration/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import Imports
import qualified Options.Applicative as Opts
import Spar.DataMigration.Options (settingsParser)
import Spar.DataMigration.Types
import qualified Spar.DataMigration.V1_ExternalIds as V1
import qualified Spar.DataMigration.V2_UserV2 as V2
import qualified System.Logger as Log

Expand All @@ -38,7 +37,8 @@ main = do
settings <- Opts.execParser (Opts.info (Opts.helper <*> settingsParser) desc)
migrate
settings
[ V1.migration,
[ -- V1.migration has been deleted in https://github.com/wireapp/wire-server/pull/2768
-- (because the deprecated source table has been removed).
V2.migration
]
where
Expand Down
199 changes: 0 additions & 199 deletions services/spar/migrate-data/src/Spar/DataMigration/V1_ExternalIds.hs

This file was deleted.

4 changes: 3 additions & 1 deletion services/spar/schema/src/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import qualified V13
import qualified V14
import qualified V15
import qualified V16
import qualified V17
import qualified V2
import qualified V3
import qualified V4
Expand Down Expand Up @@ -65,7 +66,8 @@ main = do
V13.migration,
V14.migration,
V15.migration,
V16.migration
V16.migration,
V17.migration
-- When adding migrations here, don't forget to update
-- 'schemaVersion' in Spar.Data

Expand Down
33 changes: 33 additions & 0 deletions services/spar/schema/src/V17.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) 2022 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 V17
( migration,
)
where

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

migration :: Migration
migration = Migration 17 "Remove table `scim_external_ids` (from db migration V10, deprecated in favor of `scim_external`, data migrated in `/services/spar/migrate-data/src/Spar/DataMigration/V1_ExternalIds.hs`)" $ do
void $
schema'
[r|
DROP TABLE if exists scim_external_ids;
|]
2 changes: 1 addition & 1 deletion services/spar/spar.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ executable spar-migrate-data
Spar.DataMigration.RIO
Spar.DataMigration.Run
Spar.DataMigration.Types
Spar.DataMigration.V1_ExternalIds
Spar.DataMigration.V2_UserV2

hs-source-dirs: migrate-data/src
Expand Down Expand Up @@ -611,6 +610,7 @@ executable spar-schema
V14
V15
V16
V17
V2
V3
V4
Expand Down
2 changes: 1 addition & 1 deletion services/spar/src/Spar/Data.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import Wire.API.User.Saml

-- | A lower bound: @schemaVersion <= whatWeFoundOnCassandra@, not @==@.
schemaVersion :: Int32
schemaVersion = 16
schemaVersion = 17

----------------------------------------------------------------------
-- helpers
Expand Down