You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
cur.execute("SELECT MAX(%s) FROM %s"% (column, table))
else:
cur.execute("SELECT MIN(%s) FROM %s"% (column, table))
result=cur.fetchone()
assertresultisnotNone
(val,) =result
cur.close()
current_id=int(val) ifvalelsestep
res= (maxifstep>0elsemin)(current_id, step)
logger.info("Initialising stream generator for %s(%s): %i", table, column, res)
returnres
which is the first query, which is smaller.
This means the stream_id has jumped backwards.
I don't think this is necessarily the end of the world, since it looks like the tables don't expect the stream ID to be unique (i.e. they're fine with it being reused). But it is a surprise and makes debugging more confusing.
The text was updated successfully, but these errors were encountered:
Spotted by @kegsay, diagnosed by me.
Synapse writes to the device inbox and outbox tables here:
synapse/synapse/storage/databases/main/deviceinbox.py
Lines 804 to 814 in 3e8531d
synapse/synapse/storage/databases/main/deviceinbox.py
Lines 741 to 802 in 3e8531d
Suppose that:
At this point,
is strictly smaller than
(the latter is the stream ID used in step 1.)
Now Synapse restarts. On sqlite, it populates the to-device stream using
synapse/synapse/storage/databases/main/deviceinbox.py
Lines 104 to 106 in 3e8531d
which will end up calling
synapse/synapse/storage/util/id_generators.py
Lines 78 to 93 in 91587d4
which is the first query, which is smaller.
This means the stream_id has jumped backwards.
I don't think this is necessarily the end of the world, since it looks like the tables don't expect the stream ID to be unique (i.e. they're fine with it being reused). But it is a surprise and makes debugging more confusing.
The text was updated successfully, but these errors were encountered: