Skip to content
Snippets Groups Projects
Unverified Commit 28d96cb2 authored by David Robertson's avatar David Robertson Committed by GitHub
Browse files

Ensure portdb selects _all_ rows with negative rowids (#13226)

parent 739adf15
No related branches found
No related tags found
No related merge requests found
Fix a long-standing bug where the `synapse_port_db` script could fail to copy rows with negative row ids.
......@@ -418,12 +418,15 @@ class Porter:
self.progress.update(table, table_size) # Mark table as done
return
# We sweep over rowids in two directions: one forwards (rowids 1, 2, 3, ...)
# and another backwards (rowids 0, -1, -2, ...).
forward_select = (
"SELECT rowid, * FROM %s WHERE rowid >= ? ORDER BY rowid LIMIT ?" % (table,)
)
backward_select = (
"SELECT rowid, * FROM %s WHERE rowid <= ? ORDER BY rowid LIMIT ?" % (table,)
"SELECT rowid, * FROM %s WHERE rowid <= ? ORDER BY rowid DESC LIMIT ?"
% (table,)
)
do_forward = [True]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment