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
[MM-55744] postgres-migration: add findings from mysql8 migration (#6820)
* postgres-migration: add findings from mysql8 migration
* Update source/deploy/postgres-migration.rst
* [MM-55998] incorporate more findings from community (#6822)
* incorporate more findings from community
* Update source/deploy/postgres-migration.rst
* Update source/deploy/postgres-migration.rst
* reflect review comments
---------
Co-authored-by: Carrie Warner (Mattermost) <[email protected]>
* Update source/deploy/postgres-migration.rst
Co-authored-by: Neil B <[email protected]>
---------
Co-authored-by: Carrie Warner (Mattermost) <[email protected]>
Co-authored-by: Neil B <[email protected]>
- If you are using MySQL v8: Due to a `known bug <https://github.com/dimitri/pgloader/issues/1183>`__ in pgLoader compiled binaries, you need to compile pgLoader from the source. Please follow the steps `here <https://pgloader.readthedocs.io/en/latest/install.html#build-from-sources>`__ to build from the source.
28
+
- We have received reports that the pgloader Docker image can be limited in terms of memory resources. Please use pgloader directly instead of a Docker container.
29
+
25
30
- Install morph CLI by running the following command:
- Determine the migration window needed. This process requires you to stop the Mattermost Server during the migration.
42
47
- See the `schema-diffs <#schema-diffs>`__ section to ensure data compatibility between schemas.
43
48
- Prepare your PostgreSQL environment by creating a database and user. See the `database </install/prepare-mattermost-database.html>`__ documentation for details.
49
+
- If you are planning to run an iterative migration (running the pgloader several times), please see :ref:`iterative-migrations` section.
44
50
45
51
Prepare target database
46
52
-----------------------
@@ -102,13 +108,23 @@ Full-text indexes
102
108
103
109
It's possible that some words in the ``Posts`` and ``FileInfo`` tables can exceed the `limits of the maximum token length <https://www.postgresql.org/docs/11/textsearch-limitations.html>`__ for full text search indexing. In these cases, we recommend dropping the ``idx_posts_message_txt`` and ``idx_fileinfo_content_txt`` indexes from the PostgreSQL schema, and creating these indexes after the migration by running the following queries:
104
110
105
-
To drop indexes, run the following commands before the migration (These are included in the script, so you may not need to run these manually):
111
+
To drop indexes, run the following commands before the migration. Although these statements are included in the script, we recommend running these manually to prevent errors:
106
112
107
113
.. code:: sql
108
114
109
115
DROP INDEX IF EXISTS idx_posts_message_txt;
110
116
DROP INDEX IF EXISTS idx_fileinfo_content_txt;
111
117
118
+
Also make sure these indexes are re-created after the migration is completed. You can simply run the following queries to re-create these indexes:
119
+
120
+
.. code:: sql
121
+
122
+
CREATE INDEX IF NOT EXISTS idx_posts_message_txt ON {{ .source_schema }}.posts USING gin(to_tsvector('english', message));
123
+
CREATE INDEX IF NOT EXISTS idx_fileinfo_content_txt ON {{ .source_schema }}.fileinfo USING gin(to_tsvector('english', content));
124
+
125
+
.. note::
126
+
If any of the entries in your ``Posts`` and ``FileInfo`` tables exceed the limit, ``pgloader`` will fail with ``ERROR: string is too long for tsvector`` error while trying to create these indexes. You should remove these statements from the ``pgloader`` configuration.
127
+
112
128
Artifacts may remain from previous configurations/versions
There are several steps in the pgloader configuration file that assume migration will take place in one go. If you are planning to run the migration over and over again, please complete the changes defined below:
420
+
421
+
- Discard all of the statments defined in the ``BEFORE LOAD DO`` and ``AFTER LOAD DO`` sections.
422
+
- Run the statments defined in ``BEFORE LOAD DO`` section only once before the migration.
423
+
- Once the migration is completed, run the statments defined in the ``AFTER LOAD DO`` section manually.
424
+
425
+
Troubleshooting
426
+
-----------------
427
+
428
+
Unsupported authentication for MySQL
429
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
430
+
431
+
If you are facing an error due to authentication with MySQL v8, it may be related to a `known issue <https://github.com/dimitri/pgloader/issues/782>`__ with the pgLoader. The fix is to set default authentication method to ``mysql_native_password`` in your MySQL configuration. To do so, add the ``default-authentication-plugin=mysql_native_password`` value to your ``mysql.cnf`` file. Also do not forget to update your user to use this authentication method.
432
+
433
+
.. code:: sql
434
+
435
+
ALTER USER '<mysql_user>'@'%' IDENTIFIED WITH mysql_native_password BY '<mysql_password>';
0 commit comments