Conversation
Motivation:
ListStaged (internal/storage/local.go) walks for "*.part" staging
files, strips PartSuffix, and reports the result as the key the
partial belongs to. DeleteStaged resolves that same key through
stagedPath, which validates the key body with validateKeyBody. A
partial left behind by an older Arc version can belong to a key that
is illegal under today's contract -- for example one containing a
backslash, which validateKeyBody refuses because Azure treats it as a
path separator -- so ListStaged reported it and DeleteStaged then
refused it. reclaimStagedPartials (internal/api/databases.go), which
DROP DATABASE uses to clean up abandoned partials, pipes ListStaged's
output directly into DeleteStaged, so it logged a warning for that
file on every run and never reclaimed it.
Approach:
ListStaged now runs the stripped key through stagedPath -- the exact
validation DeleteStaged applies -- before reporting it, and skips any
entry that call refuses. A partial with an illegal key is not lost
from view: ListUnusable already reports exactly what the ordinary
listings (List/ListObjects) drop, and a ".part" file whose stripped
key fails ValidateKey falls through its "committed object named
*.part" carve-out to being reported there. The legacy
"once-legal-key-is-now-reserved" reclaim path (a partial for a key
that merely collides with the reserved ".part" suffix, not one that
fails validateKeyBody) is unaffected, since stagedPath deliberately
validates without that reserved-suffix rule.
Out of scope, per the issue: a committed object whose real name ends
in ".part" (legal before the suffix was reserved) is indistinguishable
by name from a staging partial and is not addressed here.
Validation:
- go build ./... succeeds.
- gofmt -l on both changed Go files is clean.
- go vet -tags=duckdb_arrow ./internal/storage/... is clean.
- go test ./internal/storage/... and
go test -tags=duckdb_arrow -race ./internal/storage/... both pass,
including the new test.
- Added TestListStagedOmitsWhatDeleteStagedWouldRefuse to
internal/storage/staging_test.go: writes a file
"db/weird\name.part" directly to disk, simulating a legacy orphan,
and asserts ListStaged("db/") returns no entries while
ListUnusable("db/") reports exactly that one file. Confirmed this
test FAILS against the pre-fix ListStaged (reverted local.go alone,
kept the test) and PASSES after the fix, which is the regression
proof.
- Did not run the whole-repo race suite or the MinIO-backed
objectstore-tagged tests: the change is confined to
LocalBackend.ListStaged, which S3Backend and AzureBackend do not
implement.
Report: Basekick-Labs#772
Assisted-by: claude-sonnet-5 (via Claude Code)
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
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.
Motivation:
ListStaged (internal/storage/local.go) walks for "*.part" staging
files, strips PartSuffix, and reports the result as the key the
partial belongs to. DeleteStaged resolves that same key through
stagedPath, which validates the key body with validateKeyBody. A
partial left behind by an older Arc version can belong to a key that
is illegal under today's contract -- for example one containing a
backslash, which validateKeyBody refuses because Azure treats it as a
path separator -- so ListStaged reported it and DeleteStaged then
refused it. reclaimStagedPartials (internal/api/databases.go), which
DROP DATABASE uses to clean up abandoned partials, pipes ListStaged's
output directly into DeleteStaged, so it logged a warning for that
file on every run and never reclaimed it.
Approach:
ListStaged now runs the stripped key through stagedPath -- the exact
validation DeleteStaged applies -- before reporting it, and skips any
entry that call refuses. A partial with an illegal key is not lost
from view: ListUnusable already reports exactly what the ordinary
listings (List/ListObjects) drop, and a ".part" file whose stripped
key fails ValidateKey falls through its "committed object named
*.part" carve-out to being reported there. The legacy
"once-legal-key-is-now-reserved" reclaim path (a partial for a key
that merely collides with the reserved ".part" suffix, not one that
fails validateKeyBody) is unaffected, since stagedPath deliberately
validates without that reserved-suffix rule.
Out of scope, per the issue: a committed object whose real name ends
in ".part" (legal before the suffix was reserved) is indistinguishable
by name from a staging partial and is not addressed here.
Validation:
go test -tags=duckdb_arrow -race ./internal/storage/... both pass,
including the new test.
internal/storage/staging_test.go: writes a file
"db/weird\name.part" directly to disk, simulating a legacy orphan,
and asserts ListStaged("db/") returns no entries while
ListUnusable("db/") reports exactly that one file. Confirmed this
test FAILS against the pre-fix ListStaged (reverted local.go alone,
kept the test) and PASSES after the fix, which is the regression
proof.
objectstore-tagged tests: the change is confined to
LocalBackend.ListStaged, which S3Backend and AzureBackend do not
implement.
Report: #772
Assisted-by: claude-sonnet-5 (via Claude Code)
Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com
Fixes #772