Skip to content

Conversation

@nshandra
Copy link

@nshandra nshandra commented Oct 7, 2025

Links

Task: [1209] Test maps synchronization
Jira: Map synchronization fails with ConstraintViolationException due to duplicate key

Description

The code of the PR referenced in the task is not used when running syncs, instead is used for Metadata dependency export of Dasboards.

The metadata version object is created by DefaultMetadataExportService.getMetadataAsObjectNode. Issue is that it includes both Map and MapView objects.

Now, before importing the received metadata, the standalone MapView objects are filtered to remove the mapViews present in Maps.

@nshandra nshandra requested a review from tokland October 7, 2025 12:09
@nshandra nshandra self-assigned this Oct 7, 2025
@nshandra nshandra changed the title feat: add filterMapViewObjects to remove mapViews referenced by Maps Fix: mapViews metadata sync fails with ConstraintViolationException due to duplicate key Oct 7, 2025
Copy link

@tokland tokland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. I just added a comment about where filterMapViewObjects should be called. My only concern is that it feels a bit odd that this is the only post-processing done in this file, so I’m not sure this is where upstream would place it. I checked calls from getMetadata, and it doesn’t seem like queryService performs any post-processing either. So we can keep it as is for now and see how upstream approaches it.

Map<Class<? extends IdentifiableObject>, List<? extends IdentifiableObject>> metadata =
getMetadata(params);

filterMapViewObjects(metadata);
Copy link

@tokland tokland Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be invoked at a lower point (getMetadata?) so that any caller receives already filtered metadata without needing post-processing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, it also happens when exporting and importing metadata. Initially i didn't catch it because it works fine when updating existing metadata but fails when creating new objects. I updated the Jira ticket and moved the filtering to the import service.

@nshandra nshandra force-pushed the fix/mapviews_sync_filter_duplicated branch from 2cd1041 to f25d82b Compare October 9, 2025 11:11
@nshandra nshandra requested a review from tokland October 10, 2025 06:15
@nshandra nshandra requested a review from tokland October 10, 2025 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants