Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Change more stream_ordering columns to BIGINT #10286

Merged
merged 1 commit into from
Jun 30, 2021
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
1 change: 1 addition & 0 deletions changelog.d/10286.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a long-standing bug where Synapse would return errors after 2<sup>31</sup> events were handled by the server.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Copyright 2021 The Matrix.org Foundation C.I.C
*
* 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.
*/

-- This migration is closely related to '01recreate_stream_ordering.sql.postgres'.
--
-- It updates the other tables which use an INTEGER to refer to a stream ordering.
-- These tables are all small enough that a re-create is tractable.
ALTER TABLE pushers ALTER COLUMN last_stream_ordering SET DATA TYPE BIGINT;
ALTER TABLE federation_stream_position ALTER COLUMN stream_id SET DATA TYPE BIGINT;

-- these aren't actually event stream orderings, but they are numbers where 2 billion
-- is a bit limiting, application_services_state is tiny, and I don't want to ever have
-- to do this again.
ALTER TABLE application_services_state ALTER COLUMN last_txn SET DATA TYPE BIGINT;
ALTER TABLE application_services_state ALTER COLUMN read_receipt_stream_id SET DATA TYPE BIGINT;
ALTER TABLE application_services_state ALTER COLUMN presence_stream_id SET DATA TYPE BIGINT;