-
Notifications
You must be signed in to change notification settings - Fork 1
Fix: mapViews metadata sync fails with ConstraintViolationException due to duplicate key #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.40.4.1
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
2cd1041 to
f25d82b
Compare
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 bothMapandMapViewobjects.Now, before importing the received metadata, the standalone MapView objects are filtered to remove the mapViews present in Maps.