-
Type:
Sub-task
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
App Modernization
-
Fully Compatible
-
None
-
None
-
None
-
None
-
None
-
None
-
None
ISSUE DESCRIPTION AND IMPACT
If a single column is defined in multiple foreign key relationships where at least one is on multiple columns (composite), you may see one of two behaviours:
- The migration may fail to start.
- OR there would be silent data corruption where embedded objects are incorrectly joined based on only a subset of the composite foreign key relationship.
In the below example, ‘category_id’ is used as a part of the two foreign key relationships: ‘stock_items’ to ‘warehouses’ on ‘category_id’, and ‘stock_items’ to ‘products’ on ‘category_id’ and ‘product_id’. ‘Products’ is embedded into ‘stock_items’.
If the migration starts, then RM has incorrectly joined the ‘product’ row based on only the matching ‘product_id’ field, but it should have matched both ‘category_id’ AND ‘product_id’.
DIAGNOSIS AND AFFECTED VERSIONS
This issue affected all versions of Relational Migrator prior to 1.16.0.
If a single column is in multiple foreign key relationships, where at least one foreign key is composite, and that table is used in a mapping, and the migration does start, then target documents/array objects would only match on one field in the composite key relationship. Please manually check your data to confirm whether the foreign key fields match correctly.
Verification would NOT have detected this integrity issue.
REMEDIATION AND WORKAROUNDS
The only way to fix this would be to upgrade to v1.16.0 and re-migrate the affected collections.
Please feel free to open a MongoDB support ticket for direct assistance.
- is related to
-
SERVER-126523 Migrations to sharded migrations have been disabled in Relational Migrator
-
- Closed
-
-
SERVER-126530 Conflicting field name choices can cause omitted and mis-named fields
-
- Closed
-
- related to
-
SERVER-126528 Cyclic mappings with an excluded foreign key under an embedded array will be missing
-
- Closed
-
-
SERVER-126522 Relational Migrator Data Integrity Issues
-
- Closed
-