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.
Migration to postgresql is broken on table users, column shadow_banned #8384
Copy link
Copy link
Closed
Labels
Description
Description
Migrating from sqlite to postgresql is broken, most probably since version v1.20.0, which introduced shadowbanning
Steps to reproduce
- Boot up a new server with a database in sqlite
- Attempt to migrate this database to postgresql
- Observe error
Version information
-
Homeserver: v1.20.0
-
Install method: Docker
-
Platform: Debian 10
Traceback
2020-09-23 14:39:56,457 - synapse_port_db - 298 - INFO - Table group_attestations_renewals: 0/6 (rows 1-0) already ported
user_directory_stream_pos: 100% (1/1)
event_push_summary_stream_ordering: 100% (1/1)
2020-09-23 14:39:56,496 - synapse.metrics - 545 - INFO - Collecting gc 1
appservice_stream_position: 100% (1/1)
event_push_summary: 100% (20/20)
room_tags: 100% (36/36)
pushers: 100% (1/1)
event_reports: 100% (1/1)
user_filters: 100% (11/11)
room_aliases: 100% (30/30)
deleted_pushers: 100% (4/4)
room_tags_revisions: 100% (41/41)
e2e_one_time_keys_json: 100% (300/300)
local_group_membership: 100% (86/86)
2020-09-23 14:39:57,043 - synapse.metrics - 545 - INFO - Collecting gc 1
2020-09-23 14:39:57,061 - synapse.metrics - 545 - INFO - Collecting gc 2
2020-09-23 14:39:57,498 - synapse.metrics - 545 - INFO - Collecting gc 1
2020-09-23 14:39:57,592 - synapse_port_db - 195 - ERROR - Failed to insert: users
Traceback (most recent call last):
File "./scripts/synapse_port_db", line 193, in insert_many_txn
txn.executemany(sql, rows)
File "/usr/local/lib/python3.7/site-packages/synapse/storage/database.py", line 215, in executemany
self._do_execute(self.txn.executemany, sql, *args)
File "/usr/local/lib/python3.7/site-packages/synapse/storage/database.py", line 238, in _do_execute
return func(sql, *args)
psycopg2.errors.DatatypeMismatch: column "shadow_banned" is of type boolean but expression is of type integer
LINE 1: ... 1600800333, 0, NULL, 0, 'telegram', NULL, NULL, NULL, 0, 0)
^
HINT: You will need to rewrite or cast the expression.
2020-09-23 14:39:57,604 - synapse_port_db - 636 - ERROR -
Traceback (most recent call last):
File "./scripts/synapse_port_db", line 622, in run
consumeErrors=True,
twisted.internet.defer.FirstError: FirstError[#14, [Failure instance: Traceback: <class 'psycopg2.errors.DatatypeMismatch'>: column "shadow_banned" is of type boolean but expression is of type integer
LINE 1: ... 1600800333, 0, NULL, 0, 'telegram', NULL, NULL, NULL, 0, 0)
^
HINT: You will need to rewrite or cast the expression.
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:501:errback
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:568:_startRunCallbacks
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:654:_runCallbacks
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:1475:gotResult
--- <exception caught here> ---
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:1416:_inlineCallbacks
/usr/local/lib/python3.7/site-packages/twisted/python/failure.py:512:throwExceptionIntoGenerator
./scripts/synapse_port_db:386:handle_table
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:541:runInteraction
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:590:runWithConnection
/usr/local/lib/python3.7/site-packages/twisted/python/threadpool.py:250:inContext
/usr/local/lib/python3.7/site-packages/twisted/python/threadpool.py:266:<lambda>
/usr/local/lib/python3.7/site-packages/twisted/python/context.py:122:callWithContext
/usr/local/lib/python3.7/site-packages/twisted/python/context.py:85:callWithContext
/usr/local/lib/python3.7/site-packages/twisted/enterprise/adbapi.py:306:_runWithConnection
/usr/local/lib/python3.7/site-packages/twisted/python/compat.py:464:reraise
/usr/local/lib/python3.7/site-packages/twisted/enterprise/adbapi.py:297:_runWithConnection
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:587:inner_func
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:429:new_transaction
./scripts/synapse_port_db:374:insert
./scripts/synapse_port_db:193:insert_many_txn
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:215:executemany
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:238:_do_execute
]]
Traceback (most recent call last):
File "./scripts/synapse_port_db", line 622, in run
consumeErrors=True,
twisted.internet.defer.FirstError: FirstError[#14, [Failure instance: Traceback: <class 'psycopg2.errors.DatatypeMismatch'>: column "shadow_banned" is of type boolean but expression is of type integer
LINE 1: ... 1600800333, 0, NULL, 0, 'telegram', NULL, NULL, NULL, 0, 0)
^
HINT: You will need to rewrite or cast the expression.
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:501:errback
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:568:_startRunCallbacks
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:654:_runCallbacks
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:1475:gotResult
--- <exception caught here> ---
/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:1416:_inlineCallbacks
/usr/local/lib/python3.7/site-packages/twisted/python/failure.py:512:throwExceptionIntoGenerator
./scripts/synapse_port_db:386:handle_table
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:541:runInteraction
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:590:runWithConnection
/usr/local/lib/python3.7/site-packages/twisted/python/threadpool.py:250:inContext
/usr/local/lib/python3.7/site-packages/twisted/python/threadpool.py:266:<lambda>
/usr/local/lib/python3.7/site-packages/twisted/python/context.py:122:callWithContext
/usr/local/lib/python3.7/site-packages/twisted/python/context.py:85:callWithContext
/usr/local/lib/python3.7/site-packages/twisted/enterprise/adbapi.py:306:_runWithConnection
/usr/local/lib/python3.7/site-packages/twisted/python/compat.py:464:reraise
/usr/local/lib/python3.7/site-packages/twisted/enterprise/adbapi.py:297:_runWithConnection
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:587:inner_func
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:429:new_transaction
./scripts/synapse_port_db:374:insert
./scripts/synapse_port_db:193:insert_many_txn
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:215:executemany
/usr/local/lib/python3.7/site-packages/synapse/storage/database.py:238:_do_execute
]]
Traceback (most recent call last):
File "./scripts/synapse_port_db", line 1078, in <module>
sys.stderr.write(end_error)
TypeError: write() argument must be str, not FirstError