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 was archived by the owner on Apr 26, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Warning about incorrect database collation/ctype should have a link on how to fix it #6831
[homeserver_1] 2020-02-03 12:13:06,654 - synapse.storage.engines.postgres - 65 - WARNING - None- Database has incorrect collation of 'en_US.UTF-8'. Should be 'C'
[homeserver_1] 2020-02-03 12:13:06,655 - synapse.storage.engines.postgres - 70 - WARNING - None- Database has incorrect ctype of 'en_US.UTF-8'. Should be 'C'
These unfortunately don't say how I should be fixing it :(
Not carefully, but did skim it and thought it would be fine. Updated Synapse, restarted, got the message, opened the issue. A bit of goldfish brain ._.
postgres@vm-synapse:~$ psql --dbname=synapse --username=synapse < "/path/to/backupdir/synapse-db.dump2022-08-07.sql"
...
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
postgres@vm-synapse:~$ psql --dbname=synapse --username=synapse
Password for user synapse:
psql (11.16 (Debian 11.16-0+deb10u1))
Type "help" for help.
synapse=> \l+ synapse
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description
---------+---------+----------+---------+-------+-------------------+---------+------------+-------------
synapse | synapse | UTF8 | C | C | | 2943 MB | pg_default |
(1 row)
synapse=> \q
postgres@vm-synapse:~$
The sizes listed by psql were different in my case but comparing a dump of the new databse with the former one showed the same size so I think everything went well.
Reacted by Darcos, Strange Zombies, andre161292, pgress, Sinkerine, Frank Ruan, Christian Schwarz, Froz and wolfmic
Activity
richvdh commentedon Feb 3, 2020
I'm sure you read https://github.com/matrix-org/synapse/blob/develop/UPGRADE.rst#upgrading-to-v1100 carefully?
udaybansal19 commentedon Feb 24, 2020
Can i work on this?
richvdh commentedon Feb 24, 2020
If you like, sure.
turt2live commentedon Feb 24, 2020
Not carefully, but did skim it and thought it would be fine. Updated Synapse, restarted, got the message, opened the issue. A bit of goldfish brain ._.
https://github.com/matrix-org/synapse/blob/develop/docs/postgres.md#fixing-incorrect-collate-or-ctype was the thing I was looking for
udaybansal19 commentedon Feb 24, 2020
Should i add https://github.com/matrix-org/synapse/blob/develop/docs/postgres.md#fixing-incorrect-collate-or-ctype to the warning. I have just added docs/postgres.md
logger.warning( "Database has incorrect collation of %r. Should be 'C'\n" "See docs/postgres.md for more information.", collation )jakehemmerle commentedon Mar 11, 2020
Looking for first issues. I assume this should be closed?
turt2live commentedon Mar 11, 2020
Looks like it, yea
r4dh4l commentedon Jul 8, 2022
Sorry for bumping but upgrading an
1.47.1installation I stumbled over the collation/ctype problem.Unfortunately I'm not enough advanced to solve the problem with the information provided by https://matrix-org.github.io/synapse/latest/postgres.html#fixing-incorrect-collate-or-ctype ("dump the database and recreate it with the correct locale parameter (as shown above)").
Could someone provide an example like the one provided in https://matrix-org.github.io/synapse/latest/upgrade#adding-a-new-unique-index-to-state_group_edges-could-fail-if-your-database-is-corrupted (-> "Expand this section for steps to resolve this problem")?
DMRobertson commentedon Jul 8, 2022
I don't have an explicit command for you, but here are some clues:
I'd suggest:
sqlfile usingpg_dumpsynapse2following the instructions from (1) above.psql, pointing at the databasesynapse2.For more advice, I think your best bet would be the #synapse-admins:matrix.org room.
r4dh4l commentedon Aug 7, 2022
Here is a "walkthrough" for others who had to do such a fix for the first time. It is not exactly what @DMRobertson suggested but it worked for me:
How to fix incorrect database collation/ctype for upgrade to Synapse 1.56.0
Check the Synapse database status
Example for right collation/ctype
Because the SQL query lists "C" for column "Collate" and "Ctype" in the row "synapse" there is nothing to fix!
Example for wrong collation/ctype
Because the SQL query lists not "C" for "Collate" and column "Ctype" in the row "synapse" you need to recreate the database with correct C type.
Fix the Synapse database
Stop Synapse
(and other processes accessing the Synapse database)
Backup the Synapse database
Check size of the Synapse databse:
As
rootacter confirming you have enough free disk space in the backup directory:Delete the Synapse database
As user
postgres:Example:
Recreate the Synapse database
As user
postgres:Example:
Import the dump of the old Synapse database to the new created synapse database
As user
postgres:Example:
The sizes listed by
psqlwere different in my case but comparing a dump of the new databse with the former one showed the same size so I think everything went well.lamoboos223 commentedon Mar 27, 2023
you should create the database with the proper definition