Fix listBlobsByPrefixInSortedOrder in EncryptedBlobContainer to adhere limit#20514
Conversation
…e limit Signed-off-by: Pranshu Shukla <pranshushukla06@gmail.com>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
📝 WalkthroughWalkthroughThe changes introduce a synchronous variant of the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #20514 +/- ##
============================================
- Coverage 73.33% 73.31% -0.02%
+ Complexity 72125 72119 -6
============================================
Files 5798 5798
Lines 329654 329731 +77
Branches 47491 47519 +28
============================================
+ Hits 241741 241743 +2
- Misses 68504 68549 +45
- Partials 19409 19439 +30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rajiv-kv
left a comment
There was a problem hiding this comment.
Looks good. Some minor comments.
server/src/main/java/org/opensearch/common/blobstore/EncryptedBlobContainer.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/common/blobstore/EncryptedBlobContainer.java
Show resolved
Hide resolved
server/src/test/java/org/opensearch/gateway/remote/RemoteManifestManagerTests.java
Show resolved
Hide resolved
…entation if it defaults to listing all blobs and sorting in memory Signed-off-by: Pranshu Shukla <pranshushukla06@gmail.com>
|
❌ Gradle check result for 7426255: 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? |
|
Result - Flaky - #20005 |
Signed-off-by: Pranshu Shukla <pranshushukla06@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@server/src/test/java/org/opensearch/gateway/remote/RemoteManifestManagerTests.java`:
- Around line 128-137: The test is stubbing a real EncryptedBlobContainer
instance (encryptedBlobContainer.path()) which causes NotAMockException; replace
that stub with one on the underlying mock (mockBlobContainer.path()).
Specifically, remove the when(encryptedBlobContainer.path()) stub and add
when(mockBlobContainer.path()).thenReturn(blobPath); keep the
EncryptedBlobContainer constructed with new
EncryptedBlobContainer<>(mockBlobContainer, cryptoHandler) and continue
returning that instance from blobStore.blobContainer(any()) so
encryptedBlobContainer.path() will delegate to the mocked
mockBlobContainer.path().
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
server/src/main/java/org/opensearch/common/blobstore/BlobContainer.javaserver/src/main/java/org/opensearch/common/blobstore/EncryptedBlobContainer.javaserver/src/test/java/org/opensearch/common/blobstore/EncryptedBlobContainerTests.javaserver/src/test/java/org/opensearch/gateway/remote/RemoteManifestManagerTests.java
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: udabhas
Repo: opensearch-project/OpenSearch PR: 20095
File: server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java:4146-4165
Timestamp: 2026-01-14T09:31:12.773Z
Learning: For OpenSearch’s S3 path, index-level CryptoMetadata is passed from BlobStoreRepository to S3BlobContainer, and the final KMS key/context merge with repository settings is performed in SseKmsUtil.configureEncryptionSettings. Do not merge in BlobStoreRepository to avoid double-merging.
📚 Learning: 2026-01-14T09:31:12.773Z
Learnt from: udabhas
Repo: opensearch-project/OpenSearch PR: 20095
File: server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java:4146-4165
Timestamp: 2026-01-14T09:31:12.773Z
Learning: For OpenSearch’s S3 path, index-level CryptoMetadata is passed from BlobStoreRepository to S3BlobContainer, and the final KMS key/context merge with repository settings is performed in SseKmsUtil.configureEncryptionSettings. Do not merge in BlobStoreRepository to avoid double-merging.
Applied to files:
server/src/main/java/org/opensearch/common/blobstore/BlobContainer.javaserver/src/test/java/org/opensearch/gateway/remote/RemoteManifestManagerTests.javaserver/src/test/java/org/opensearch/common/blobstore/EncryptedBlobContainerTests.java
📚 Learning: 2026-01-13T17:40:27.167Z
Learnt from: reta
Repo: opensearch-project/OpenSearch PR: 20411
File: server/src/main/java/org/opensearch/index/codec/CodecService.java:112-133
Timestamp: 2026-01-13T17:40:27.167Z
Learning: Avoid capturing or evaluating a supplier (e.g., this::defaultCodec) upfront when passing it to a registry during object construction. If registries may replace defaults during iteration (as in EnginePlugin.getAdditionalCodecs), pass the supplier itself and only resolve it at use time. This ensures dynamic behavior is preserved during initialization and prevents premature binding of defaults in codecs/registry setup. This pattern should apply to similar initialization paths in Java server code where registries may mutate defaults during construction.
Applied to files:
server/src/main/java/org/opensearch/common/blobstore/BlobContainer.javaserver/src/main/java/org/opensearch/common/blobstore/EncryptedBlobContainer.java
🔇 Additional comments (5)
server/src/main/java/org/opensearch/common/blobstore/BlobContainer.java (1)
355-363: Helpful visibility into the in-memory fallback.server/src/main/java/org/opensearch/common/blobstore/EncryptedBlobContainer.java (1)
251-268: Clean delegation and wrapping for the sync list API.server/src/test/java/org/opensearch/common/blobstore/EncryptedBlobContainerTests.java (2)
12-25: Imports align with the new list-based tests.
255-313: Good coverage for the sync list-by-prefix behavior.server/src/test/java/org/opensearch/gateway/remote/RemoteManifestManagerTests.java (1)
16-17: Imports are consistent with the new encrypted-wrapper test.Also applies to: 42-43
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
server/src/test/java/org/opensearch/gateway/remote/RemoteManifestManagerTests.java
Show resolved
Hide resolved
Signed-off-by: Pranshu Shukla <pranshushukla06@gmail.com>
…ntainer-list-all-objects Signed-off-by: Pranshu Shukla <pranshushukla06@gmail.com>
Signed-off-by: Pranshu Shukla <pranshushukla06@gmail.com>
|
❌ Gradle check result for 8b785d1: 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: Pranshu Shukla <pranshushukla06@gmail.com>
|
Appears to be stuck |
Signed-off-by: Pranshu Shukla <pranshushukla06@gmail.com>
…e limit (opensearch-project#20514) * Fix listBlobsByPrefixInSortedOrder in EncryptedBlobContainer to adhere limit Signed-off-by: Pranshu Shukla <pranshushukla06@gmail.com>
…e limit (opensearch-project#20514) * Fix listBlobsByPrefixInSortedOrder in EncryptedBlobContainer to adhere limit Signed-off-by: Pranshu Shukla <pranshushukla06@gmail.com>
Description
As S3BlobContainer already provides an implementation to directly get the latest blob after sorting in Lexicographic order, we do not need to load all the files to memory, sort and return the latest. This will help in not only improving bootstrapping time in cases when there is a manifest pile-up but also prevent JVM exhaustion
Before the change (~500k files in S3)

After the change

Related Issues
Resolves #20543 20543
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.