Repository navigation
fix: bound ListObjectsV2 page size to 100 and raise response-header timeout to 60s - #21
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
AWS SDK configuration can still reject valid retry overrides or impose the wrong attempt budget, and the quota-disabling regression does not exhaust the default limiter.
3 open issues
What changed in this PR
This PR improves migration reliability on slow S3-compatible storage by bounding object-listing pages and making transport timeouts and retry budgets configurable.
Changes:
- Defaults listing pages to 100 keys, response-header timeouts to 60 seconds, and CLI requests to 5 attempts, with YAML, environment, and CLI overrides.
- Disables the shared retry quota and preserves custom CA certificates in pooled HTTP clients.
- Adds pagination and transport regression coverage and updates configuration documentation.
| File | Description |
|---|---|
| README.md | Documents new settings and environment variables. |
| README_ZH.md | Updates Chinese configuration guidance. |
| internal/scanner/scanner.go | Adds configurable scan page sizes. |
| internal/s3client/timeout_test.go | Adds timeout, retry-quota, and custom-CA tests. |
| internal/s3client/client.go | Configures timeouts, retries, and CA-aware transport. |
| internal/fakes3/fakes3.go | Supports paginated fake S3 listings. |
| internal/differ/differ.go | Applies page-size options to diff listings. |
| internal/config/duration.go | Adds duration parsing for configuration. |
| internal/config/config.go | Adds transport defaults, validation, and overrides. |
| internal/config/config_test.go | Tests transport configuration and precedence. |
| internal/cluster/objects.go | Bounds every object-listing request. |
| internal/cluster/objects_test.go | Checks default and custom listing page sizes. |
| docs/MANUAL.md | Documents settings and timeout troubleshooting. |
| docs/MANUAL_ZH.md | Updates Chinese settings and troubleshooting guidance. |
| docs/MANUAL_KO.md | Updates Korean transport documentation. |
| docs/MANUAL_JA.md | Updates Japanese transport documentation. |
| docs/MANUAL_IT.md | Updates Italian transport documentation. |
| docs/MANUAL_FR.md | Updates French transport documentation. |
| docs/MANUAL_ES.md | Updates Spanish transport documentation. |
| docs/MANUAL_DE.md | Updates German transport documentation. |
| docs/DESIGN.md | Describes pagination and transport behavior. |
| config.example.yaml | Adds annotated transport configuration examples. |
| cmd/root.go | Wires CLI overrides into clients and listings. |
| cmd/helptext.go | Documents new flags in bilingual help. |
| cmd/help_test.go | Checks help includes new tuning options. |
| cmd/cli_regression_test.go | Tests pagination and slow-listing recovery through CLI commands. |
Review effort: Balanced
| SkipSourceFrozenEnv: sourceFrozenSet, | ||
| SkipListMaxKeysEnv: listMaxKeysSet, | ||
| SkipResponseHeaderTimeoutEnv: headerTimeoutSet, | ||
| SkipMaxAttemptsEnv: maxAttemptsSet, |
| // Disable the SDK's shared 500-token client retry quota so transient | ||
| // cluster stalls across concurrent workers or multi-hour scans do not | ||
| // exhaust tokens and silently stop retrying later pages/objects. | ||
| o.Retryer = retry.NewStandard(func(ro *retry.StandardOptions) { |
Comment on lines
+173
to
+176
| // Stall the first attempt of every distinct prefix past the 100ms header | ||
| // timeout, and answer the retry immediately. Over 64 logical operations | ||
| // (64 * 10 = 640 timeout cost > 500 default SDK quota, 0 refunded), the | ||
| // SDK's default retry rate limiter would fail later operations. |
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.

Problem
When scanning large buckets with deep directory trees on HDD-backed S3-compatible clusters (such as MinIO/Ceph gateways),
scan/run/diffcould fail midway with:Root Causes
ListObjectsV2page size:cluster.WalkObjectsdid not sendMaxKeys, allowing some S3-compatible servers/gateways to default to oversized pages (e.g., 10,000 keys per page), or forcing HDD backends to stat up to 1,000+ objects before sending response headers.internal/s3client/client.gohardcodedtr.ResponseHeaderTimeout = 30 * time.Secondwith no configuration override.AWS_CA_BUNDLEincompatibility: Passing a raw*http.Clienttoawsconfig.LoadDefaultConfigbroke custom RootCA loading (unable to add custom RootCAs HTTPClient, has no WithTransportOptions, *http.Client).Changes
ListObjectsV2pagination (internal/cluster/objects.go,internal/scanner/scanner.go,internal/differ/differ.go):MaxKeyson everyListObjectsV2request, defaulting to100(DefaultListMaxKeys = 100) instead of omitting it or requesting 1,000 keys per page.1..1000) via YAMLlist_max_keys, envLIST_MAX_KEYS, or CLI--list-max-keys.internal/s3client/client.go,internal/config/):ResponseHeaderTimeoutfrom30sto60s(DefaultResponseHeaderTimeout = 60 * time.Second), configurable up to1hvia YAMLresponse_header_timeout, envRESPONSE_HEADER_TIMEOUT, or CLI--response-header-timeout.max(90s, response_header_timeout).internal/s3client/client.go,internal/config/):max_attemptsfrom3to5(1..100), configurable via YAMLmax_attempts, envMAX_ATTEMPTS(also honoringAWS_MAX_ATTEMPTS), or CLI--max-attempts.ratelimit.None) so sustained transient timeouts across long scans or parallel workers never silently disable retries.internal/s3client/client.go):awshttp.NewBuildableClient()toawsconfig.LoadDefaultConfigand clone its transport soAWS_CA_BUNDLE/ca_bundlecustom RootCAs work cleanly alongside connection pooling, HTTP/1.1, and timeouts.max-keys/continuation-token) tointernal/fakes3.max-keys=100, custom--list-max-keys,60sdefault timeout, transient header-timeout retry recovery, sustained retry quota resilience under-race,AWS_CA_BUNDLETLS verification, and config/env/CLI precedence.config.example.yaml,cmd/helptext.go,docs/DESIGN.md,README.md,README_ZH.md, anddocs/MANUAL*.md.Verification
go vet -tags real_s3 ./...— passedgo test -race -count=1 ./...— all 10 packages passedpython3 -m unittest discover -s scripts -v— 12/12 passedlinux/amd64static binaries (CGO_ENABLED=0) and verified CLI--help/--version