Skip to content

Commit 4733e14

Browse files
committed
fix(multipart): defer persistent listing from public requests
Signed-off-by: Feng Ruohang <[email protected]>
1 parent 4189869 commit 4733e14

12 files changed

Lines changed: 358 additions & 140 deletions

‎.github/workflows/go.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ jobs:
9393
- name: Run conditional PUT tests under race detector
9494
run: go test -race ./cmd -run '^Test(PoolsConditionalPut|SinglePoolConditionalPutHTTP)' -count=1 -timeout=5m
9595

96-
- name: Run multipart listing and cancellation tests under race detector
97-
run: go test -race ./cmd -run '^Test(MultipartListing|MultipartAbort|PaginateMultipartUploads|ListMultipartUploads)' -count=1 -timeout=5m
96+
- name: Run multipart listing, cancellation and cleanup tests under race detector
97+
env:
98+
MINIO_API_REQUESTS_MAX: "10000"
99+
run: go test -race ./cmd -run '^Test(Multipart|PaginateMultipartUploads|ListMultipartUploads|CleanupStaleUploads|ExtractModTime)' -count=1 -timeout=5m
98100

99101
- name: Run listing metadata recovery, pagination and cancellation tests under race detector
100102
run: go test -race ./cmd -run '^Test(ListFallback|ListingCache|ListingMerge|ListingRecovery|ListingPending|ListingEntry|ListingSecondLock|StreamMetadataParts|LocalLockerListing|DistributedListing|MergeXLV2LatestNullCrossParity|CountXLV2MixedECGroups|ListCrossParity)' -count=1 -timeout=5m

‎CHANGELOG.md‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,16 @@ candidate's exact delta.
7676

7777
### Object storage and replication
7878

79-
- Make durable `ListMultipartUploads` scanning the only listing path (#79):
80-
apply prefix, delimiter, markers, ordering and the 1,000-entry page limit
81-
globally across pools and sets, independently of node-local caches. Omit
82-
readable historical uploads only when both bucket/key identity fields are
83-
absent; malformed identities, uncertain coverage and resource limits remain
84-
errors. Old uploads still support part upload, completion and cancellation
85-
with a known bucket/key/upload ID. No backfill or new storage layout is added.
86-
`MINIO_API_MULTIPART_LISTING` is retired and ignored with a startup warning;
87-
historical shared `api multipart_listing` keys remain tolerated. The read-only
88-
admin `multipart-preflight` reports `mode=persistent`; `ready` diagnoses the
89-
absence of old records and no longer gates listing. Each page still scans
90-
durable state within the existing 100,000-directory-entry, 30-second and
91-
per-process concurrency budgets. See the
79+
- Withdraw default persistent `ListMultipartUploads` scanning (#79). Restore
80+
node-local cache listing for an empty prefix and exact-key lookup otherwise;
81+
restart omissions, true-prefix and cache-pagination limitations remain.
82+
Preserve bucket/key identity metadata, path safety and stale-upload cleanup.
83+
`MINIO_API_MULTIPART_LISTING` stays retired and ignored with a startup warning;
84+
obsolete shared `api multipart_listing` keys remain tolerated. **Existing
85+
opt-in strict users lose durable listing and strict cancellation.** The
86+
read-only admin `multipart-preflight` reports `mode=legacy`; its scan budgets
87+
and readiness do not gate public listing or startup. Durable, complete,
88+
scalable enumeration remains deferred. See the
9289
[design and limits](https://silo.pgsty.com/blog/design/list-multipart-uploads/#implementation).
9390
Thanks to mr javad seydi (@mrjavadseydi) for the original metadata-and-scan
9491
implementation (#198).

‎cmd/common-main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ func serverHandleEnvVars() {
883883
}
884884
globalInplaceUpdateDisabled = true
885885
if env.IsSet(api.EnvAPIMultipartListing) {
886-
logger.Warning("%s is ignored: multipart listing always uses persistent metadata; uploads without identity fields are omitted", api.EnvAPIMultipartListing)
886+
logger.Warning("%s is ignored: multipart listing uses the legacy cache/exact-key behavior; persistent listing is deferred", api.EnvAPIMultipartListing)
887887
}
888888

889889
// Check if the supported credential env vars,

‎cmd/erasure-multipart-listing-benchmark_test.go‎

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
// Run explicitly with -benchtime=1x. Fixture creation is excluded from timing;
1515
// each request still discovers real on-disk metadata. The 16-drive/10k case
1616
// deliberately exceeds the existing aggregate directory-entry budget.
17-
func BenchmarkMultipartListingCapacity(b *testing.B) {
17+
func BenchmarkMultipartDiagnosticScanCapacity(b *testing.B) {
1818
for _, tc := range []struct {
1919
drives, uploads int
2020
mixed, limited bool
@@ -67,7 +67,7 @@ func BenchmarkMultipartListingCapacity(b *testing.B) {
6767
}
6868
b.ResetTimer()
6969
for range b.N {
70-
got, err := z.ListMultipartUploads(b.Context(), bucket, "dir/", "", "", "", 1000)
70+
got, err := z.scanMultipartUploadsForTest(b.Context(), bucket, "dir/", "", "", "", 1000)
7171
if tc.limited {
7272
var limited SlowDown
7373
if !errors.As(err, &limited) || len(got.Uploads) != 0 {
@@ -83,3 +83,88 @@ func BenchmarkMultipartListingCapacity(b *testing.B) {
8383
})
8484
}
8585
}
86+
87+
// The public path is measured with a populated cache as well as after cache
88+
// loss. An empty post-restart response alone is not capacity acceptance.
89+
func BenchmarkMultipartPublicListingCapacity(b *testing.B) {
90+
for _, tc := range []struct {
91+
drives, uploads int
92+
sameKey bool
93+
}{
94+
{4, 10_000, false},
95+
{16, 3_126, false},
96+
{16, 10_000, true},
97+
} {
98+
b.Run(fmt.Sprintf("drives=%d/uploads=%d/same-key=%t", tc.drives, tc.uploads, tc.sameKey), func(b *testing.B) {
99+
obj, dirs, err := prepareErasure(b.Context(), tc.drives)
100+
if err != nil {
101+
b.Fatal(err)
102+
}
103+
z := obj.(*erasureServerPools)
104+
b.Cleanup(func() { z.Shutdown(context.Background()); removeRoots(dirs) })
105+
const bucket, other = "multipart-public-capacity", "multipart-public-other"
106+
for _, name := range []string{bucket, other} {
107+
if err := z.MakeBucket(b.Context(), name, MakeBucketOptions{}); err != nil {
108+
b.Fatal(err)
109+
}
110+
}
111+
wantCached, wantExact := 0, 1
112+
for n := range tc.uploads {
113+
target, key := bucket, fmt.Sprintf("dir/%05d", n)
114+
if tc.sameKey {
115+
key = "dir/00000"
116+
} else if n%2 != 0 {
117+
target = other
118+
}
119+
if target == bucket {
120+
wantCached++
121+
}
122+
if _, err := z.NewMultipartUpload(b.Context(), target, key, ObjectOptions{}); err != nil {
123+
b.Fatal(err)
124+
}
125+
}
126+
if tc.sameKey {
127+
wantExact = 1000
128+
}
129+
if tc.drives == 16 && !tc.sameKey {
130+
_, err := z.scanMultipartUploadsForTest(b.Context(), bucket, "", "", "", "", 1000)
131+
var limited SlowDown
132+
if !errors.As(err, &limited) {
133+
b.Fatalf("fixture did not reproduce the previous global budget failure: %v", err)
134+
}
135+
}
136+
var directoryCalls, metadataCalls atomic.Int64
137+
for _, set := range z.serverPools[0].sets {
138+
original := set.getDisks
139+
set.getDisks = func() []StorageAPI {
140+
disks := append([]StorageAPI(nil), original()...)
141+
for i, disk := range disks {
142+
disks[i] = multipartListingCountingDisk{disk, &directoryCalls, &metadataCalls}
143+
}
144+
return disks
145+
}
146+
b.Cleanup(func() { set.getDisks = original })
147+
}
148+
measure := func(name, prefix string, want int) {
149+
b.Run(name, func(b *testing.B) {
150+
directoryCalls.Store(0)
151+
metadataCalls.Store(0)
152+
b.ResetTimer()
153+
for range b.N {
154+
got, err := z.ListMultipartUploads(b.Context(), bucket, prefix, "", "", "", 1000)
155+
if err != nil || len(got.Uploads) != want {
156+
b.Fatalf("public listing: count=%d want=%d err=%v", len(got.Uploads), want, err)
157+
}
158+
}
159+
b.StopTimer()
160+
b.ReportMetric(float64(directoryCalls.Load())/float64(b.N), "ListDir/op")
161+
b.ReportMetric(float64(metadataCalls.Load())/float64(b.N), "ReadVersion/op")
162+
})
163+
}
164+
measure("populated-cache", "", wantCached)
165+
z.mpCache.Clear()
166+
measure("lost-cache", "", 0)
167+
measure("known-key", "dir/00000", wantExact)
168+
})
169+
}
170+
}

‎cmd/erasure-multipart-listing.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func (z *erasureServerPools) multipartPreflight(ctx context.Context) (multipartP
359359
return multipartPreflightReport{}, err
360360
}
361361
defer s.close()
362-
report := multipartPreflightReport{Complete: true, Mode: "persistent"}
362+
report := multipartPreflightReport{Complete: true, Mode: "legacy"}
363363
for p, pool := range z.serverPools {
364364
for i, set := range pool.sets {
365365
_, _ = set.scanMultipartUploads(s, "", p, i)

0 commit comments

Comments
 (0)