diff options
author | Erik Johnston <erik@matrix.org> | 2019-10-21 12:56:42 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-10-21 16:05:06 +0100 |
commit | c66a06ac6b69b0a03f5c6284ded980399e9df94e (patch) | |
tree | 01dfd3b9098a9ace759403744d122c18efbd97ff /synapse/storage/schema/delta/40 | |
parent | Merge branch 'master' into develop (diff) | |
download | synapse-c66a06ac6b69b0a03f5c6284ded980399e9df94e.tar.xz |
Move storage classes into a main "data store".
This is in preparation for having multiple data stores that offer different functionality, e.g. splitting out state or event storage.
Diffstat (limited to 'synapse/storage/schema/delta/40')
-rw-r--r-- | synapse/storage/schema/delta/40/current_state_idx.sql | 17 | ||||
-rw-r--r-- | synapse/storage/schema/delta/40/device_inbox.sql | 21 | ||||
-rw-r--r-- | synapse/storage/schema/delta/40/device_list_streams.sql | 60 | ||||
-rw-r--r-- | synapse/storage/schema/delta/40/event_push_summary.sql | 37 | ||||
-rw-r--r-- | synapse/storage/schema/delta/40/pushers.sql | 39 |
5 files changed, 0 insertions, 174 deletions
diff --git a/synapse/storage/schema/delta/40/current_state_idx.sql b/synapse/storage/schema/delta/40/current_state_idx.sql deleted file mode 100644 index 7ffa189f39..0000000000 --- a/synapse/storage/schema/delta/40/current_state_idx.sql +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright 2017 OpenMarket Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -INSERT INTO background_updates (update_name, progress_json) VALUES - ('current_state_members_idx', '{}'); diff --git a/synapse/storage/schema/delta/40/device_inbox.sql b/synapse/storage/schema/delta/40/device_inbox.sql deleted file mode 100644 index b9fe1f0480..0000000000 --- a/synapse/storage/schema/delta/40/device_inbox.sql +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright 2016 OpenMarket Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --- turn the pre-fill startup query into a index-only scan on postgresql. -INSERT into background_updates (update_name, progress_json) - VALUES ('device_inbox_stream_index', '{}'); - -INSERT into background_updates (update_name, progress_json, depends_on) - VALUES ('device_inbox_stream_drop', '{}', 'device_inbox_stream_index'); diff --git a/synapse/storage/schema/delta/40/device_list_streams.sql b/synapse/storage/schema/delta/40/device_list_streams.sql deleted file mode 100644 index dd6dcb65f1..0000000000 --- a/synapse/storage/schema/delta/40/device_list_streams.sql +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright 2017 OpenMarket Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --- Cache of remote devices. -CREATE TABLE device_lists_remote_cache ( - user_id TEXT NOT NULL, - device_id TEXT NOT NULL, - content TEXT NOT NULL -); - --- The last update we got for a user. Empty if we're not receiving updates for --- that user. -CREATE TABLE device_lists_remote_extremeties ( - user_id TEXT NOT NULL, - stream_id TEXT NOT NULL -); - --- we used to create non-unique indexes on these tables, but as of update 52 we create --- unique indexes concurrently: --- --- CREATE INDEX device_lists_remote_cache_id ON device_lists_remote_cache(user_id, device_id); --- CREATE INDEX device_lists_remote_extremeties_id ON device_lists_remote_extremeties(user_id, stream_id); - - --- Stream of device lists updates. Includes both local and remotes -CREATE TABLE device_lists_stream ( - stream_id BIGINT NOT NULL, - user_id TEXT NOT NULL, - device_id TEXT NOT NULL -); - -CREATE INDEX device_lists_stream_id ON device_lists_stream(stream_id, user_id); - - --- The stream of updates to send to other servers. We keep at least one row --- per user that was sent so that the prev_id for any new updates can be --- calculated -CREATE TABLE device_lists_outbound_pokes ( - destination TEXT NOT NULL, - stream_id BIGINT NOT NULL, - user_id TEXT NOT NULL, - device_id TEXT NOT NULL, - sent BOOLEAN NOT NULL, - ts BIGINT NOT NULL -- So that in future we can clear out pokes to dead servers -); - -CREATE INDEX device_lists_outbound_pokes_id ON device_lists_outbound_pokes(destination, stream_id); -CREATE INDEX device_lists_outbound_pokes_user ON device_lists_outbound_pokes(destination, user_id); diff --git a/synapse/storage/schema/delta/40/event_push_summary.sql b/synapse/storage/schema/delta/40/event_push_summary.sql deleted file mode 100644 index 3918f0b794..0000000000 --- a/synapse/storage/schema/delta/40/event_push_summary.sql +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2017 OpenMarket Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --- Aggregate of old notification counts that have been deleted out of the --- main event_push_actions table. This count does not include those that were --- highlights, as they remain in the event_push_actions table. -CREATE TABLE event_push_summary ( - user_id TEXT NOT NULL, - room_id TEXT NOT NULL, - notif_count BIGINT NOT NULL, - stream_ordering BIGINT NOT NULL -); - -CREATE INDEX event_push_summary_user_rm ON event_push_summary(user_id, room_id); - - --- The stream ordering up to which we have aggregated the event_push_actions --- table into event_push_summary -CREATE TABLE event_push_summary_stream_ordering ( - Lock CHAR(1) NOT NULL DEFAULT 'X' UNIQUE, -- Makes sure this table only has one row. - stream_ordering BIGINT NOT NULL, - CHECK (Lock='X') -); - -INSERT INTO event_push_summary_stream_ordering (stream_ordering) VALUES (0); diff --git a/synapse/storage/schema/delta/40/pushers.sql b/synapse/storage/schema/delta/40/pushers.sql deleted file mode 100644 index 054a223f14..0000000000 --- a/synapse/storage/schema/delta/40/pushers.sql +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2017 Vector Creations Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -CREATE TABLE IF NOT EXISTS pushers2 ( - id BIGINT PRIMARY KEY, - user_name TEXT NOT NULL, - access_token BIGINT DEFAULT NULL, - profile_tag TEXT NOT NULL, - kind TEXT NOT NULL, - app_id TEXT NOT NULL, - app_display_name TEXT NOT NULL, - device_display_name TEXT NOT NULL, - pushkey TEXT NOT NULL, - ts BIGINT NOT NULL, - lang TEXT, - data TEXT, - last_stream_ordering INTEGER, - last_success BIGINT, - failing_since BIGINT, - UNIQUE (app_id, pushkey, user_name) -); - -INSERT INTO pushers2 SELECT * FROM PUSHERS; - -DROP TABLE PUSHERS; - -ALTER TABLE pushers2 RENAME TO pushers; |