Skip to content
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

Add sourceQuery in metadata cache #988

Merged
merged 4 commits into from
Dec 12, 2024

Conversation

seankao-az
Copy link
Collaborator

@seankao-az seankao-az commented Dec 10, 2024

Description

For MV index, add a query string field into metadata cache.

In addition, preserves content in index mapping when updating the cache.
Before: FlintOpenSearchMetadataCacheWriter tries to serialize the FlintMetadata by itself, ignoring what's currently inside index mapping.
After: No longer tries to serialize FlintMetadata into the json string used for update index mapping. Instead, read the current index mapping, and add the required cache fields into it.

Related Issues

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

"metadataCacheVersion",
FlintMetadataCache.metadataCacheVersion),
Entry("lastRefreshTime", testLastRefreshCompleteTime))
properties should not contain key("refreshInterval")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

change because it's actually what this case is supposed to test. Test for other fields is covered in other cases

@seankao-az seankao-az marked this pull request as ready for review December 12, 2024 11:39
@seankao-az seankao-az self-assigned this Dec 12, 2024
@seankao-az seankao-az added enhancement New feature or request 0.7 labels Dec 12, 2024
*/
private def buildPropertiesMap(metadata: FlintMetadata): util.Map[String, AnyRef] = {
val metadataCacheProperties = FlintMetadataCache(metadata).toMap
private def mergeMapping(
Copy link
Collaborator

Choose a reason for hiding this comment

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

just wonder is it easier to do merge at existingMapping._meta.properties in place directly?

Copy link
Collaborator

@dai-chen dai-chen left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@seankao-az seankao-az merged commit 5052ffe into opensearch-project:main Dec 12, 2024
4 checks passed
seankao-az added a commit to seankao-az/opensearch-spark that referenced this pull request Dec 17, 2024
* add sourceQuery in metadata cache

Signed-off-by: Sean Kao <[email protected]>

* preserve index mapping content when updating cache

Signed-off-by: Sean Kao <[email protected]>

* syntax and comment

Signed-off-by: Sean Kao <[email protected]>

* merge index mapping in place

Signed-off-by: Sean Kao <[email protected]>

---------

Signed-off-by: Sean Kao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.7 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants