-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MINOR: regression in export field setter #27447
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -2227,6 +2227,7 @@ public final ResultList<T> listEntityHistoryByTimestamp( | |||||||
| fetchLimit); | ||||||||
|
|
||||||||
| List<T> entities = JsonUtils.readObjects(jsons, getEntityClass()); | ||||||||
| setFieldsInBulk(putFields, entities); | ||||||||
|
||||||||
| setFieldsInBulk(putFields, entities); | |
| setFieldsInBulk(putFields, entities); | |
| hydrateHistoryEntities(entities); |
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.
@copilot hydrateHistoryEntities is a no-op operations and entities come without their fields. Serialization of the json then fails (i.e. Database entities would come without the service field)
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.
Calling setFieldsInBulk(putFields, entities) here will re-hydrate relationship-backed fields from the current DB state (owners/tags/domains/etc.) and can overwrite the historical snapshot data returned by the /history-by-timestamp query. It also increases the cost of the endpoint significantly compared to returning the stored snapshots.
Consider switching to a minimal history hydration strategy (e.g., only populate required default references like
servicewhen missing, without fetching other relationship fields), or restoring the previous lightweight hook-based approach so that /history continues to reflect the stored version snapshots.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.
@copilot
hydrateHistoryEntitiesis a no-op operations and entities come without their fields. Serialization of the json then fails (i.e. Database entities would come without the service field)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.
Agreed —
setFieldsInBulkis essential since the deserialized history snapshots don't carry populated relationship fields (e.g.service). In commit3fb282cI restored thehydrateHistoryEntities(entities)call aftersetFieldsInBulk(as the reviewer suggested) and updated the Javadoc so the hook is clearly positioned as an extension point for subclasses needing additional hydration on top of the coresetFieldsInBulkpass.