[Fix-18632][Storage-OSS] Paginate listStorageEntity instead of returning only the first page - #18633
Merged
Merged
Conversation
…ing only the first page OssStorageOperator#listStorageEntity issued a single listObjectsV2 call with no max-keys, so the OSS server default of 100 applied and any directory with more than 100 combined objects and sub-directories was silently truncated in the resource center UI. Since max-keys is capped at 1000 by the service, the listing cannot be fixed by widening the page alone. Follow IsTruncated/NextContinuationToken until the result set is exhausted, and deduplicate common prefixes across pages so directory markers are still filtered out.
Contributor
Author
|
Verified in production on a 3.4.2 deployment:
The change is confirmed working against a real OSS bucket. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was this PR generated or assisted by AI?
YES - AI assisted. The issue analysis, the fix proposal and the code change were drafted with AI assistance. I reviewed the change, built the module, deployed the resulting plugin jar to a DolphinScheduler 3.4.2 deployment using OSS as the resource backend, and verified the behaviour manually.
Purpose of the pull request
Close #18632.
When the resource center uses the OSS storage backend,
OssStorageOperator#listStorageEntityissued a singlelistObjectsV2call with no pagination. The OSS server default of 100max-keystherefore applied, and becauseContents(objects) andCommonPrefixes(directories) share that one quota, any directory with more than 100 combined entries was silently truncated in the UI. Widening the page cannot fix this on its own:max-keysis capped at 1000 by the service.Brief change log
OssStorageOperator#listStorageEntitynow loops onIsTruncated/NextContinuationTokenuntil all pages are fetched, settingmax-keysto 1000 per request (MAX_KEYSconstant).Setthat persists across pages, so directory marker objects are still filtered out when they appear on a later page than their common prefix.CommonPrefixescontinue to be excluded from the object listing.Verify this pull request
This change added no automated tests, but was verified manually as follows:
mvn -pl dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss -am -DskipTests installbuilds successfully, andspotless:applyleaves the file unchanged.withMaxKeys,setContinuationToken,isTruncatedandgetNextContinuationTokenare all present inlistStorageEntity.dolphinscheduler-storage-ossplugin jar was swapped into the deployment and the API server restarted. A resource directory containing more than 100 mixed files and sub-directories now lists every entry in the resource center, where before only the first 100 were returned. Nested browsing vialistFileStorageEntityRecursivelyis likewise complete.dolphinscheduler-storage-osscurrently has nosrc/testdirectory, so an automated test would need the Aliyun SDK mocked or a MinIO-style OSS-compatible endpoint. Happy to add one if maintainers would like it in this PR.Pull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md