element-hq / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://element-hq.github.io/synapse
GNU Affero General Public License v3.0
1.54k stars 189 forks source link

`allow_unsafe_locale: true` still enforces the check on postgres' encoding #13709

Open matrixbot opened 10 months ago

matrixbot commented 10 months ago

This issue has been migrated from #13709.


Description

allow_unsafe_locale still fails to work when a non-C locale is supplied.

Steps to reproduce

Homeserver

local test setup

Synapse Version

1.66.0

Installation Method

Docker (matrixdotorg/synapse)

Platform

Yugabyte is also from the latest docker.

Relevant log output

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/synapse/app/homeserver.py", line 382, in setup
    hs.setup()
  File "/usr/local/lib/python3.9/site-packages/synapse/server.py", line 308, in setup
    self.datastores = Databases(self.DATASTORE_CLASS, self)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/databases/__init__.py", line 74, in __init__
    prepare_database(
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/prepare_database.py", line 152, in prepare_database
    _setup_new_database(cur, database_engine, databases=databases)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/prepare_database.py", line 213, in _setup_new_database
    database_engine.check_new_database(cur)
  File "/usr/local/lib/python3.9/site-packages/synapse/storage/engines/postgres.py", line 137, in check_new_database
    raise IncorrectDatabaseSetup(
synapse.storage.engines._base.IncorrectDatabaseSetup: Database is incorrectly configured:

    - 'CTYPE' is set to 'en_US.UTF-8'. Should be 'C'

See docs/postgres.md for more information.
******************************************************
 Error during initialisation:
    Database is incorrectly configured:

     - 'CTYPE' is set to 'en_US.UTF-8'. Should be 'C'

 See docs/postgres.md for more information.
 There may be more information in the logs.
******************************************************

Anything else that would be useful to know?

No response

ctr49 commented 5 months ago

Apparently unsafe_locale isn't the only limitation for Yugabyte. Even when skipping the CTYPE check, https://github.com/element-hq/synapse/blob/master/synapse/storage/schema/state/full_schemas/72/full.sql.postgres#L23 leads to

psycopg2.errors.FeatureNotSupported: ALTER TABLE ALTER column not supported yet
LINE 23: ALTER TABLE ONLY state_groups_state ALTER COLUMN state_group...
                                             ^
HINT:  See https://github.com/yugabyte/yugabyte-db/issues/1124. React with thumbs up to raise its priority

(see https://github.com/yugabyte/yugabyte-db/issues/1124#issuecomment-2144022604)