mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
durable: a plain seal's retry after a deadline commits the first attempt's uploads without putting them again
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0349b930ec
commit
f829e8751e
1 file changed
+8
-10
@@ -122,26 +122,24 @@ func TestPlainSealDeadlineRetryUploadsOnlyRemainingChunks(t *testing.T) {
|
||||
t.Fatalf("first attempt progress: calls=%d successful=%d bytes=%d", remote.calls, len(remote.keys), remote.bytes)
|
||||
}
|
||||
firstKeys := append([]string(nil), remote.keys...)
|
||||
if _, _, err := p.DetachVolumePlain(parent, "v1"); !errors.Is(err, durable.ErrDetachAborted) || !errors.Is(err, storage.ErrChunkHeadPrecondition) {
|
||||
t.Fatalf("staged chunks from the ended session were accepted: %v", err)
|
||||
}
|
||||
// The retry runs in a new session and commits what the first attempt
|
||||
// uploaded in its ended one: the commit adopts those objects, so only
|
||||
// the remaining chunks are put, and the seal completes in one retry.
|
||||
r, last, err := p.DetachVolumePlain(parent, "v1")
|
||||
if err != nil || r.Head.State != storage.ChunkHeadDetached || r.H != last || r.Head.RemoteLSN != last {
|
||||
t.Fatalf("plain seal retry failed: %+v last=%d err=%v", r, last, err)
|
||||
}
|
||||
if len(remote.keys) != 2*chunks || remote.bytes != 2*chunks*chunkBytes {
|
||||
t.Fatalf("the refused cut did not restage in its new session: successful=%d bytes=%d", len(remote.keys), remote.bytes)
|
||||
if len(remote.keys) != chunks || remote.bytes != chunks*chunkBytes {
|
||||
t.Fatalf("the retry put %d chunks in all (%d bytes); want %d: the first attempt's 2 adopted, only the rest put", len(remote.keys), remote.bytes, chunks)
|
||||
}
|
||||
if len(remote.images) != chunks {
|
||||
t.Fatalf("restaged image has %d distinct payloads, want %d", len(remote.images), chunks)
|
||||
t.Fatalf("sealed image has %d distinct payloads, want %d", len(remote.images), chunks)
|
||||
}
|
||||
for _, n := range remote.images {
|
||||
if n != 2 {
|
||||
t.Fatalf("unexpected session PUT count %d", n)
|
||||
if n != 1 {
|
||||
t.Fatalf("a chunk was put %d times; want once", n)
|
||||
}
|
||||
}
|
||||
// The kernel requires a Put in the new session, but the content-named
|
||||
// filer entry is reused by a conditional metadata update, not a blob PUT.
|
||||
c.blobs.Lock()
|
||||
physical := map[[32]byte]int{}
|
||||
for _, raw := range c.blobs.blobs {
|
||||
|
||||
Reference in new issue
Block a user