synapse icon indicating copy to clipboard operation
synapse copied to clipboard

Update to 0.24 : database error

Open Linuxine opened this issue 9 years ago • 19 comments

I have tried to upgrade my personal homeserver from version 0.23.1 to the 0.24, but the upgrade did not get well, the server won't launch, with the following error:

2017-10-24 12:53:41,897 - twisted - 131 - ERROR - - Traceback (most recent call last):
2017-10-24 12:53:41,897 - twisted - 131 - ERROR - -   File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
2017-10-24 12:53:41,897 - twisted - 131 - ERROR - -     "__main__", fname, loader, pkg_name)
2017-10-24 12:53:41,897 - twisted - 131 - ERROR - -   File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
2017-10-24 12:53:41,898 - twisted - 131 - ERROR - -     exec code in run_globals
2017-10-24 12:53:41,898 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 450, in <module>
2017-10-24 12:53:41,898 - twisted - 131 - ERROR - -     main()
2017-10-24 12:53:41,898 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 445, in main
2017-10-24 12:53:41,899 - twisted - 131 - ERROR - -     hs = setup(sys.argv[1:])
2017-10-24 12:53:41,899 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 306, in setup
2017-10-24 12:53:41,899 - twisted - 131 - ERROR - -     prepare_database(db_conn, database_engine, config=config)
2017-10-24 12:53:41,899 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 62, in prepare_database
2017-10-24 12:53:41,900 - twisted - 131 - ERROR - -     cur, user_version, delta_files, upgraded, database_engine, config
2017-10-24 12:53:41,900 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 257, in _upgrade_existing_database
2017-10-24 12:53:41,900 - twisted - 131 - ERROR - -     executescript(cur, absolute_path)
2017-10-24 12:53:41,900 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 337, in executescript
2017-10-24 12:53:41,900 - twisted - 131 - ERROR - -     txn.execute(statement)
2017-10-24 12:53:41,901 - twisted - 131 - ERROR - - sqlite3.OperationalError: near "WHERE": syntax error

2017-10-24 12:53:46,130 - twisted - 131 - ERROR - - Traceback (most recent call last):
2017-10-24 12:53:46,131 - twisted - 131 - ERROR - -   File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
2017-10-24 12:53:46,131 - twisted - 131 - ERROR - -     "__main__", fname, loader, pkg_name)
2017-10-24 12:53:46,131 - twisted - 131 - ERROR - -   File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
2017-10-24 12:53:46,132 - twisted - 131 - ERROR - -     exec code in run_globals
2017-10-24 12:53:46,132 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 450, in <module>
2017-10-24 12:53:46,132 - twisted - 131 - ERROR - -     main()
2017-10-24 12:53:46,132 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 445, in main
2017-10-24 12:53:46,132 - twisted - 131 - ERROR - -     hs = setup(sys.argv[1:])
2017-10-24 12:53:46,133 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 306, in setup
2017-10-24 12:53:46,133 - twisted - 131 - ERROR - -     prepare_database(db_conn, database_engine, config=config)
2017-10-24 12:53:46,133 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 62, in prepare_database
2017-10-24 12:53:46,133 - twisted - 131 - ERROR - -     cur, user_version, delta_files, upgraded, database_engine, config
2017-10-24 12:53:46,133 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 257, in _upgrade_existing_database
2017-10-24 12:53:46,134 - twisted - 131 - ERROR - -     executescript(cur, absolute_path)
2017-10-24 12:53:46,134 - twisted - 131 - ERROR - -   File "/home/matrix/synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 337, in executescript
2017-10-24 12:53:46,134 - twisted - 131 - ERROR - -     txn.execute(statement)
2017-10-24 12:53:46,134 - twisted - 131 - ERROR - - sqlite3.OperationalError: near "WHERE": syntax error

I have just made as indicated in https://github.com/matrix-org/synapse/blob/master/UPGRADE.rst, made a pip install -upgrade and tried to restart the service.

Linuxine avatar Oct 24 '17 11:10 Linuxine

Ok, I answer to my own issue : it appear that in lib/python2.7/site-packages/synapse/storage/schema/delta/44/expire_url_cache.sql, there is a new query:

CREATE INDEX local_media_repository_url_idx ON local_media_repository(created_ts) WHERE url_cache IS NOT NULL;

The partial index are only supported by sqlite version 3.8.0, whereas the sqlite version in Centos 7 appear to be providing sqlite 3.7. So I had to remove the "where" clause of the query to be able to init and launch my server.

Linuxine avatar Oct 24 '17 11:10 Linuxine

So, I have a last question : if I manage to install a newer version of sqlite in addition to the old packaged one, is there a way to tell to Matrix the path to the sqlite executable file to use ? Thanks !

Linuxine avatar Oct 24 '17 12:10 Linuxine

It's not using the executable, but the library. How you tell python to use the newer library depends on how you installed it, but most likely you'll have to reinstall the sqlite3 python module, pointing it at the right path for the library - or you might be able to get away with the evil hack of specifying an explicit LD_LIBRARY_PATH which prioritises the newer library. sqlite3 is actually part of core python, so to complicate things further you may want to try installing pysqlite instead (and changing your synapse to import pysqlite) to give you more flexibility about which library version it links against.

ara4n avatar Oct 24 '17 20:10 ara4n

Yes, I meant the library, sorry, my mistake ! Thanks a lot for the answer, I will try to install pysqlite.

Linuxine avatar Oct 25 '17 15:10 Linuxine

Even worser, the first start (after the upgrade to 0.24) fails and leaves the database in a bad state (at least in my case):

2017-10-26 13:45:33,758 - synapse.app.homeserver - 284 - INFO - - Server version: Synapse/0.24.1
2017-10-26 13:45:33,783 - synapse.app.homeserver - 302 - INFO - - Preparing database: sqlite3...
2017-10-26 13:45:33,811 - synapse.storage.prepare_database - 209 - DEBUG - - applied_delta_files: [u'43/blocked_rooms.sql', u'43/quarantine_media.sql', u'43/url_cache.sql']
2017-10-26 13:45:33,814 - synapse.storage.prepare_database - 212 - INFO - - Upgrading schema to v43
2017-10-26 13:45:33,817 - synapse.storage.prepare_database - 227 - DEBUG - - Found file: 43/blocked_rooms.sql
2017-10-26 13:45:33,818 - synapse.storage.prepare_database - 227 - DEBUG - - Found file: 43/quarantine_media.sql
2017-10-26 13:45:33,820 - synapse.storage.prepare_database - 227 - DEBUG - - Found file: 43/url_cache.sql
2017-10-26 13:45:33,821 - synapse.storage.prepare_database - 227 - DEBUG - - Found file: 43/user_share.sql
2017-10-26 13:45:33,823 - synapse.storage.prepare_database - 256 - INFO - - Applying schema 43/user_share.sql
2017-10-26 13:45:33,826 - twisted - 131 - ERROR - - Traceback (most recent call last):
2017-10-26 13:45:33,828 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.python2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
2017-10-26 13:45:33,831 - twisted - 131 - ERROR - -     "__main__", fname, loader, pkg_name)
2017-10-26 13:45:33,833 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.python2.7/lib/python2.7/runpy.py", line 72, in _run_code
2017-10-26 13:45:33,835 - twisted - 131 - ERROR - -     exec code in run_globals
2017-10-26 13:45:33,838 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 450, in <module>
2017-10-26 13:45:33,841 - twisted - 131 - ERROR - -     main()
2017-10-26 13:45:33,843 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 445, in main
2017-10-26 13:45:33,845 - twisted - 131 - ERROR - -     hs = setup(sys.argv[1:])
2017-10-26 13:45:33,848 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 306, in setup
2017-10-26 13:45:33,850 - twisted - 131 - ERROR - -     prepare_database(db_conn, database_engine, config=config)
2017-10-26 13:45:33,852 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 62, in prepare_database
2017-10-26 13:45:33,855 - twisted - 131 - ERROR - -     cur, user_version, delta_files, upgraded, database_engine, config
2017-10-26 13:45:33,857 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 257, in _upgrade_existing_database
2017-10-26 13:45:33,859 - twisted - 131 - ERROR - -     executescript(cur, absolute_path)
2017-10-26 13:45:33,862 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 337, in executescript
2017-10-26 13:45:33,864 - twisted - 131 - ERROR - -     txn.execute(statement)
2017-10-26 13:45:33,867 - twisted - 131 - ERROR - - sqlite3.OperationalError: table users_who_share_rooms already exists
error starting (exit code: 1); see above for logs

...this is really bad.

Tokodomo avatar Oct 26 '17 11:10 Tokodomo

@Linuxine: I solved the issue (on Debian): https://matrix.to/#/!HsxjoYRFsDtWBgDQPh:matrix.org/$15090047462433718MGXqV:matrix.org

Tokodomo avatar Oct 26 '17 11:10 Tokodomo

we've made multiple updates to the upgrade script since 0.24.1 to fix various bugs - please can you try on develop?

For @Tokodomo's mess, it's trying to apply update 43 twice. The best I can suggest is to back off the changes in 43/user_share.sql (i.e. drop table users_who_share_rooms) and run the upgrade script again - although I assume he's found a solution by now.

ara4n avatar Nov 03 '17 09:11 ara4n

I was hitting this issue as well with the sqlite lib that is shipped in centos 7. the develop branch doesn't fix the upgrade, and i'm still stuck on 0.23.1 until i can get a newer sqlite up or migrate to postgres.

jrick avatar Nov 03 '17 13:11 jrick

Hi @jrick, I was able to update to 0.25 this morning, without changing my sqlite version. I guess the changes @ara4n was talking about solves my issue, thanks ! \o/

Linuxine avatar Nov 16 '17 14:11 Linuxine

@erikjohnston says the right fix to this is "i think instead of creating that index directly in the schema file to add a background update that handles the where correctly" - which is a bunch of work.

In the interim, unless you're expecting to send lots of images from your HS, you can probably just comment out the index for now from the schema and hopefully the Right Fix will magically sort it out down the line.

ara4n avatar Nov 16 '17 16:11 ara4n

(and if you're expecting to send lots of images from your HS you should be using postgres rather than sqlite anyway, which should work fine)

ara4n avatar Nov 16 '17 16:11 ara4n

@Linuxine unfortunately, i am still seeing the same failure:

Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,330 - synapse.app.homeserver - 313 - INFO - - Server hostname: zettaport.com
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,330 - synapse.app.homeserver - 314 - INFO - - Server version: Synapse/0.25.0
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,333 - synapse.app.homeserver - 332 - INFO - - Preparing database: sqlite3...
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,336 - synapse.storage.prepare_database - 223 - INFO - - Upgrading schema to v43
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,336 - synapse.storage.prepare_database - 223 - INFO - - Upgrading schema to v44
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,336 - synapse.storage.prepare_database - 267 - INFO - - Applying schema 44/expire_url_cache.sql
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,337 - twisted - 131 - ERROR - - Traceback (most recent call last):
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,337 - twisted - 131 - ERROR - -   File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,337 - twisted - 131 - ERROR - -     "__main__", fname, loader, pkg_name)
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,338 - twisted - 131 - ERROR - -   File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,338 - twisted - 131 - ERROR - -     exec code in run_globals
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,338 - twisted - 131 - ERROR - -   File "/home/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 480, in <module>
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,338 - twisted - 131 - ERROR - -     main()
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,338 - twisted - 131 - ERROR - -   File "/home/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 475, in main
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,339 - twisted - 131 - ERROR - -     hs = setup(sys.argv[1:])
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,339 - twisted - 131 - ERROR - -   File "/home/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 336, in setup
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,339 - twisted - 131 - ERROR - -     prepare_database(db_conn, database_engine, config=config)
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,339 - twisted - 131 - ERROR - -   File "/home/synapse/.synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 69, in prepare_database
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,339 - twisted - 131 - ERROR - -     cur, user_version, delta_files, upgraded, database_engine, config
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,339 - twisted - 131 - ERROR - -   File "/home/synapse/.synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 268, in _upgrade_existing_database
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,339 - twisted - 131 - ERROR - -     executescript(cur, absolute_path)
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,340 - twisted - 131 - ERROR - -   File "/home/synapse/.synapse/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 407, in executescript
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,340 - twisted - 131 - ERROR - -     txn.execute(statement)
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 python2.7[87401]: 2017-11-16 17:56:27,340 - twisted - 131 - ERROR - - sqlite3.OperationalError: near "WHERE": syntax error
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 systemd[4949]: synapse.service: main process exited, code=exited, status=1/FAILURE
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 systemd[4949]: Unit synapse.service entered failed state.
Nov 16 17:56:27 acff5732-3641-6795-ea9f-ec1b48e22d91 systemd[4949]: synapse.service failed.

jrick avatar Nov 16 '17 17:11 jrick

@jrick Your sqlite version is likely out of date. Try upgrading to 3.8.0 or higher.

turt2live avatar Nov 16 '17 18:11 turt2live

@Linuxine @ara4n That is strange, because there is no fix in v0.25.0 regarding this issue. I still run into this error (with SQLite version 3.7.13):

Starting ...
2017-11-16 18:28:16,400 - twisted - 131 - ERROR - - Traceback (most recent call last):
2017-11-16 18:28:16,403 - twisted - 131 - ERROR - -   File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
2017-11-16 18:28:16,406 - twisted - 131 - ERROR - -     "__main__", fname, loader, pkg_name)
2017-11-16 18:28:16,409 - twisted - 131 - ERROR - -   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
2017-11-16 18:28:16,411 - twisted - 131 - ERROR - -     exec code in run_globals
2017-11-16 18:28:16,414 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 480, in <module>
2017-11-16 18:28:16,418 - twisted - 131 - ERROR - -     main()
2017-11-16 18:28:16,420 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 475, in main
2017-11-16 18:28:16,423 - twisted - 131 - ERROR - -     hs = setup(sys.argv[1:])
2017-11-16 18:28:16,426 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 336, in setup
2017-11-16 18:28:16,429 - twisted - 131 - ERROR - -     prepare_database(db_conn, database_engine, config=config)
2017-11-16 18:28:16,431 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/local/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 72, in prepare_database
2017-11-16 18:28:16,434 - twisted - 131 - ERROR - -     _setup_new_database(cur, database_engine)
2017-11-16 18:28:16,437 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/local/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 159, in _setup_new_database
2017-11-16 18:28:16,439 - twisted - 131 - ERROR - -     is_empty=True,
2017-11-16 18:28:16,442 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/local/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 268, in _upgrade_existing_database
2017-11-16 18:28:16,445 - twisted - 131 - ERROR - -     executescript(cur, absolute_path)
2017-11-16 18:28:16,447 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/local/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 407, in executescript
2017-11-16 18:28:16,450 - twisted - 131 - ERROR - -     txn.execute(statement)
2017-11-16 18:28:16,453 - twisted - 131 - ERROR - - sqlite3.OperationalError: near "WHERE": syntax error
error starting (exit code: 1); see above for logs

And after that:

Starting ...
2017-11-16 18:29:15,858 - twisted - 131 - ERROR - - Traceback (most recent call last):
2017-11-16 18:29:15,860 - twisted - 131 - ERROR - -   File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
2017-11-16 18:29:15,862 - twisted - 131 - ERROR - -     "__main__", fname, loader, pkg_name)
2017-11-16 18:29:15,864 - twisted - 131 - ERROR - -   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
2017-11-16 18:29:15,866 - twisted - 131 - ERROR - -     exec code in run_globals
2017-11-16 18:29:15,868 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 480, in <module>
2017-11-16 18:29:15,870 - twisted - 131 - ERROR - -     main()
2017-11-16 18:29:15,872 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 475, in main
2017-11-16 18:29:15,874 - twisted - 131 - ERROR - -     hs = setup(sys.argv[1:])
2017-11-16 18:29:15,876 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 336, in setup
2017-11-16 18:29:15,878 - twisted - 131 - ERROR - -     prepare_database(db_conn, database_engine, config=config)
2017-11-16 18:29:15,880 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/local/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 69, in prepare_database
2017-11-16 18:29:15,882 - twisted - 131 - ERROR - -     cur, user_version, delta_files, upgraded, database_engine, config
2017-11-16 18:29:15,884 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/local/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 268, in _upgrade_existing_database
2017-11-16 18:29:15,886 - twisted - 131 - ERROR - -     executescript(cur, absolute_path)
2017-11-16 18:29:15,888 - twisted - 131 - ERROR - -   File "/home/pi/synapse/.synapse/local/lib/python2.7/site-packages/synapse/storage/prepare_database.py", line 407, in executescript
2017-11-16 18:29:15,890 - twisted - 131 - ERROR - -     txn.execute(statement)
2017-11-16 18:29:15,893 - twisted - 131 - ERROR - - sqlite3.OperationalError: table users_who_share_rooms already exists
error starting (exit code: 1); see above for logs

So, the only "solution" for me (without messing around) is still: https://github.com/matrix-org/synapse/issues/2572#issuecomment-339641325

Tokodomo avatar Nov 16 '17 18:11 Tokodomo

@turt2live right, this is centos 7 (read: old) with the system sqlite. I wouldn't really bother about this but centos 7 is still in the "install from source" instructions in the readme. Maybe some documentation about needing postgres on centos 7 would be good there.

jrick avatar Nov 16 '17 18:11 jrick

I've reported the centos issue here: https://github.com/matrix-org/synapse/issues/2690

The options are to compile a newer version of sqlite manually or to use postgres, unfortunately.

turt2live avatar Nov 16 '17 18:11 turt2live

@jrick if the fix was not with the new version, in my case it must be because I commented the "where" in the index creation, as I indicated in https://github.com/matrix-org/synapse/issues/2572#issuecomment-338963110.

Sqlite 3.7 does not support partial indexes it seems. And yes, this is the default sqlite3 version for Centos 7.0. And I have tried to compile a newer version and to launch Matrix with it, but it ended up with a critical error, so I guess my python connector was not compatible with this version maybe ?

Maybe I have been too daring, I tried to compile directly sqlite 3.20. It would be worth trying with a slightly newer version, like 3.8 for example ?

Linuxine avatar Nov 16 '17 21:11 Linuxine

This will (I hope) be fixed by #2697

richvdh avatar Nov 27 '17 12:11 richvdh

This was introduced in https://github.com/matrix-org/synapse/pull/2478

richvdh avatar Aug 26 '22 09:08 richvdh