filer.remote.sync: classify refused stamps by gRPC status only

A FailedPrecondition substring in an unrelated error would have been
swallowed as a skipped stamp; status.FromError already unwraps.
This commit is contained in:
Chris Lu committed 2026-09-23 17:07:02 -07:00
1 parent 8cc3e299fc
commit b6dd48403e
2 files changed
+3 -5

No files matched your search

+2 -4
View File
@@ -460,10 +460,8 @@ func isFailedPrecondition(err error) bool {
if err == nil {
return false
}
if st, ok := status.FromError(err); ok && st.Code() == codes.FailedPrecondition {
return true
}
return strings.Contains(err.Error(), "precondition failed")
st, ok := status.FromError(err)
return ok && st.Code() == codes.FailedPrecondition
}
func isMultipartUploadFile(dir string, name string) bool {
+1 -1
View File
@@ -839,7 +839,7 @@ func TestIsFailedPrecondition(t *testing.T) {
{"nil", nil, false},
{"status", refused, true},
{"wrapped status", fmt.Errorf("update entry: %w", refused), true},
{"message only", errors.New("rpc error: code = FailedPrecondition desc = precondition failed: /f"), true},
{"message only", errors.New("rpc error: code = FailedPrecondition desc = precondition failed: /f"), false},
{"other", status.Error(codes.Unavailable, "filer down"), false},
}
for _, c := range cases {