This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
synapse_port_db fails on room_depth
table #3214
Copy link
Copy link
Closed
Description
Description
On a synapse
homeserver which has previously joined #matrix-hq
there is an entry in the room_depth
table w/ a depth of INT_MAX
. When running synapse_port_db
this fails to import into a postgresql database since SQLite's integer
type is 8 bytes wide if necessary, whereas PostgreSQL's integer
type is fixed at 4 bytes wide.
Steps to reproduce
- Create a homeserver with SQLite database
- Join
#matrix-hq
and sync it - Create a PostgreSQL database
- Follow the instructions as described in the conversion documentation.
Observe the output of synapse_port_db
has failed:
2018-05-12 18:47:04,837 - synapse_port_db - 175 - ERROR - Failed to insert: room_depth
Traceback (most recent call last):
File "/usr/bin/synapse_port_db", line 171, in insert_many_txn
txn.executemany(sql, rows)
File "/usr/lib/python2.7/dist-packages/synapse/storage/_base.py", line 85, in executemany
self._do_execute(self.txn.executemany, sql, *args)
File "/usr/lib/python2.7/dist-packages/synapse/storage/_base.py", line 112, in _do_execute
sql, *args
DataError: integer out of range
2018-05-12 18:47:04,840 - synapse_port_db - 562 - ERROR -
Traceback (most recent call last):
File "/usr/bin/synapse_port_db", line 552, in run
consumeErrors=True,
FirstError: FirstError[#88, [Failure instance: Traceback: <class 'psycopg2.DataError'>: integer out of range
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:498:errback
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:565:_startRunCallbacks
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:651:_runCallbacks
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1355:gotResult
--- <exception caught here> ---
/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1297:_inlineCallbacks
/usr/lib/python2.7/dist-packages/twisted/python/failure.py:389:throwExceptionIntoGenerator
/usr/bin/synapse_port_db:356:handle_table
/usr/lib/python2.7/dist-packages/twisted/python/threadpool.py:246:inContext
/usr/lib/python2.7/dist-packages/twisted/python/threadpool.py:262:<lambda>
/usr/lib/python2.7/dist-packages/twisted/python/context.py:118:callWithContext
/usr/lib/python2.7/dist-packages/twisted/python/context.py:81:callWithContext
/usr/lib/python2.7/dist-packages/twisted/enterprise/adbapi.py:307:_runWithConnection
/usr/lib/python2.7/dist-packages/twisted/enterprise/adbapi.py:298:_runWithConnection
/usr/bin/synapse_port_db:138:r
/usr/bin/synapse_port_db:343:insert
/usr/bin/synapse_port_db:171:insert_many_txn
/usr/lib/python2.7/dist-packages/synapse/storage/_base.py:85:executemany
/usr/lib/python2.7/dist-packages/synapse/storage/_base.py:112:_do_execute
]]
The error is caused by the following entry in room_depth
:
sqlite> select * from room_depth
...> where room_id = '!cURbafjkfsMDVwdRDQ:matrix.org';
!cURbafjkfsMDVwdRDQ:matrix.org|9223372036854775807
sqlite>
Which cannot be imported into the following table w/ an INT_MAX of (2^31) - 1
:
synapse=# \d+ room_depth;
Table "public.room_depth"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
-----------+---------+-----------+----------+---------+----------+--------------+-------------
room_id | text | | not null | | extended | |
min_depth | integer | | not null | | plain | |
Indexes:
"room_depth_room_id_key" UNIQUE CONSTRAINT, btree (room_id)
"room_depth_room" btree (room_id)
Version information
- Debian 9
- Synapse v0.28.1
- PostgreSQL 10.3
- SQLite 3.16.2
gusttt
Metadata
Metadata
Assignees
Labels
No labels