- Newest
- Most votes
- Most comments
The issue you're experiencing with AWS DMS migration from PostgreSQL to MariaDB is related to character set and collation handling. There are several factors contributing to your problem:
-
AWS DMS is creating tables with mixed collations - utf8mb4_general_ci for some columns and utf16_general_ci for varchar/text columns, which is causing the "Illegal mix of collations" error during ongoing replication.
-
The error about "Unknown system variable 'default_collation_for_utf8mb4'" suggests that DMS is trying to use a system variable that doesn't exist in your MariaDB version.
To resolve this issue, you can try the following approaches:
- Use the CharsetMapping extra connection attribute in your target MariaDB endpoint settings. This allows you to specify character set mapping explicitly. For example:
CharsetMapping=utf8,65001
CharsetMapping=utf16,65001
This would map both utf8 and utf16 to UTF8 code page (65001).
-
Consider pre-creating your tables in the target database with the desired utf8mb4 character set and collation, then set your DMS task's target table preparation mode to "Truncate" or "Do nothing" instead of "Drop tables on target". This way, you control the table structure and collation settings.
-
If you're using AWS DMS engine version 3.6.1, you should have support for utf8mb4 character set (versions prior to 3.1.1 didn't support it), but you might need to explicitly configure it.
-
Check if there are any specific collation settings in your source PostgreSQL database that might be influencing how DMS interprets the character sets.
During data migration, data goes through multiple encoding and decoding phases as it's read from the source, processed in the DMS replication instance, and loaded into the target. If there's an inappropriate configuration, such as Unicode to Latin character set conversion, it can cause issues during replication.
Before making changes to your production setup, it's recommended to test character set updates on a test instance first. Make sure all database objects are properly converted to the utf8mb4 character set.
Sources
Troubleshooting migration tasks in AWS Database Migration Service - AWS Database Migration Service
Troubleshooting - Amazon Aurora MySQL Migration Handbook
Optimize data validation using AWS DMS validation-only tasks | AWS Database Blog
Update the character set to utf8mb4 in RDS for MySQL | AWS re:Post
Relevant content
- asked 3 months ago
