mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-26 03:25:53 +03:00
Fix port script fails when DB has no backfilled events. (#8729)
Fixes #8618
This commit is contained in:
parent
5829872bec
commit
41a389934e
2 changed files with 6 additions and 7 deletions
1
changelog.d/8729.bugfix
Normal file
1
changelog.d/8729.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix port script fails when DB has no backfilled events. Broke in v1.21.0.
|
|
@ -876,13 +876,11 @@ class Porter(object):
|
|||
"ALTER SEQUENCE events_stream_seq RESTART WITH %s", (next_id,)
|
||||
)
|
||||
|
||||
txn.execute("SELECT -MIN(stream_ordering) FROM events")
|
||||
txn.execute("SELECT GREATEST(-MIN(stream_ordering), 1) FROM events")
|
||||
curr_id = txn.fetchone()[0]
|
||||
if curr_id:
|
||||
next_id = curr_id + 1
|
||||
txn.execute(
|
||||
"ALTER SEQUENCE events_backfill_stream_seq RESTART WITH %s",
|
||||
(next_id,),
|
||||
"ALTER SEQUENCE events_backfill_stream_seq RESTART WITH %s", (next_id,),
|
||||
)
|
||||
|
||||
return self.postgres_store.db_pool.runInteraction(
|
||||
|
|
Loading…
Reference in a new issue