mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-10 16:40:46 +02:00
* util, pb: classify a filer error by the status the server sent DoSeaweedListWithSnapshot wrapped a failed ListEntries with %v, dropping the gRPC status, so IsTransientError fell back to matching substrings against a message that now held the caller's path. Keep the status with %w and let it decide, reading the server's own text rather than the wrapper's. Claude-Session: https://claude.ai/code/session_01BjDWtZsCoZY6x4pdDmGWxU * s3: keep the bucket and prefix out of the list retry decision A bucket named transport, or a prefix under logs/unavailable/, made a PermissionDenied listing look transient and got it retried; a key holding the not-found sentence suppressed a retry that should have run. Both checks now read the filer's status, and only fall back to the text when there is none. Claude-Session: https://claude.ai/code/session_01BjDWtZsCoZY6x4pdDmGWxU * filer, s3: classify a delete failure before the path is wrapped into it The filer put the non-empty-folder marker behind its own "delete directory %s" wrapper and the gateway matched it as a substring, so a key named after the marker turned a real delete failure into the demote-the-marker no-op and the request answered 204. Keep the marker leading the message that crosses the wire, turn it back into a sentinel where the response is read, and match that. Claude-Session: https://claude.ai/code/session_01BjDWtZsCoZY6x4pdDmGWxU
30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
package filer
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
// The path in a non-empty-folder failure is the client's, so the marker has to
|
|
// lead the message for a caller reading it off the wire to trust it.
|
|
func TestNonEmptyFolderClassification(t *testing.T) {
|
|
err := fmt.Errorf("%w: %s", ErrNonEmptyFolder, "/buckets/b/photos")
|
|
if !IsNonEmptyFolderError(err) {
|
|
t.Errorf("expected the sentinel to be recognized: %v", err)
|
|
}
|
|
if !errors.Is(DeleteEntryError(err.Error()), ErrNonEmptyFolder) {
|
|
t.Errorf("expected the wire text to classify: %v", err)
|
|
}
|
|
|
|
// an entry named after the marker cannot forge one: every other delete
|
|
// failure the filer builds leads with its own wrapper
|
|
spoofed := "delete file /buckets/b/" + MsgFailDelNonEmptyFolder + ": filer store delete: disk full"
|
|
if errors.Is(DeleteEntryError(spoofed), ErrNonEmptyFolder) {
|
|
t.Errorf("expected no forgery from the entry name: %v", spoofed)
|
|
}
|
|
if IsNonEmptyFolderError(errors.New(spoofed)) {
|
|
t.Errorf("expected no forgery from the entry name: %v", spoofed)
|
|
}
|
|
}
|