-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 opensearch version info while deserialization #16494
base: main
Are you sure you want to change the base?
Conversation
❌ Gradle check result for f98da36: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16494 +/- ##
============================================
+ Coverage 72.02% 72.18% +0.15%
- Complexity 65000 65117 +117
============================================
Files 5313 5313
Lines 303397 303400 +3
Branches 43902 43902
============================================
+ Hits 218528 219010 +482
+ Misses 66982 66429 -553
- Partials 17887 17961 +74 ☔ View full report in Codecov by Sentry. |
7a49332
to
e448dd3
Compare
❌ Gradle check result for e448dd3: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Sooraj Sinha <[email protected]>
e448dd3
to
64c813f
Compare
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.
Let's use a specific version rather than CURRENT. How does it work for 2.16 given it is already released and the version might not have been added at the time of serialisation.
It would be broken for 2.16 and 2.17 as well. |
I have used |
server/src/test/java/org/opensearch/gateway/remote/RemoteGlobalMetadataManagerTests.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Sooraj Sinha <[email protected]>
Metadata.Custom customMetadata = getCustomMetadata(); | ||
String fileName = randomAlphaOfLength(10); | ||
RemoteCustomMetadata customMetadataForDownload = new RemoteCustomMetadata( | ||
fileName, | ||
IndexGraveyard.TYPE, | ||
CLUSTER_UUID, | ||
compressor, | ||
namedWriteableRegistry | ||
namedWriteableRegistry, | ||
version | ||
); | ||
when(blobStoreTransferService.downloadBlob(anyIterable(), anyString())).thenReturn( | ||
customMetadataForDownload.customBlobStoreFormat.serialize(customMetadata, fileName, compressor).streamInput() |
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.
in this case it will serialize with which version?
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.
serialize will always happen with current version only
@soosinha lets add mixed version mode test if it doesn't exist. |
Created an issue to track mixed version tests: #16497 |
Description
Custom Metadata is serialized
writeTo
and deserialized using thereadFrom
method or a constructor with stream input.For example -
ComposableIndexTemplate
is serialized using ComposableIndexTemplate.writeTo and deserialized using the stream input constructor.Consider a case where a new attribute is added in a version. For example
context
is added in ComposableIndexTemplate from 2.16 onwards. When it serialized from cluster manager of 2.15 version, the context field will not be present. But when the 2.16 cluster manager deserializes the object, it expectscontext
field to be present and breaks.The fix is to set the opensearch version in the stream input so that the deserialization will not look for new fields.
Related Issues
NA
Check List
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.