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

Commit b6dbf89

Browse files
authored
Change more stream_ordering columns to BIGINT (#10286)
1 parent 859dc05 commit b6dbf89

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

changelog.d/10286.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a long-standing bug where Synapse would return errors after 2<sup>31</sup> events were handled by the server.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Copyright 2021 The Matrix.org Foundation C.I.C
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
-- This migration is closely related to '01recreate_stream_ordering.sql.postgres'.
17+
--
18+
-- It updates the other tables which use an INTEGER to refer to a stream ordering.
19+
-- These tables are all small enough that a re-create is tractable.
20+
ALTER TABLE pushers ALTER COLUMN last_stream_ordering SET DATA TYPE BIGINT;
21+
ALTER TABLE federation_stream_position ALTER COLUMN stream_id SET DATA TYPE BIGINT;
22+
23+
-- these aren't actually event stream orderings, but they are numbers where 2 billion
24+
-- is a bit limiting, application_services_state is tiny, and I don't want to ever have
25+
-- to do this again.
26+
ALTER TABLE application_services_state ALTER COLUMN last_txn SET DATA TYPE BIGINT;
27+
ALTER TABLE application_services_state ALTER COLUMN read_receipt_stream_id SET DATA TYPE BIGINT;
28+
ALTER TABLE application_services_state ALTER COLUMN presence_stream_id SET DATA TYPE BIGINT;
29+
30+

0 commit comments

Comments
 (0)