Skip to content

fix(test, workflow-operator): stop leaking S3 test objects - #8978

Open
ShawnGarello wants to merge 4 commits into
apache:mainfrom
ShawnGarello:fix/large-binary-test-s3-leak
Open

ShawnGarello wants to merge 4 commits into
apache:mainfrom
ShawnGarello:fix/large-binary-test-s3-leak

Conversation

@ShawnGarello

@ShawnGarello ShawnGarello commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

FileScanSourceOpExecSpec's test "create LargeBinary when reading file with LARGE_BINARY type" streams a real object to S3 whenever an endpoint is reachable (s3://texera-large-binaries/objects/8888/<uuid>), and nothing deleted it. Since #7800 made the test actually reach S3, every local run with the dev stack up (bin/local-dev.sh up publishes RustFS on :9000 with the credentials storage.conf uses) has added one more object to the developer's persistent rustfs_data volume.

CI never noticed: the amber job has no S3, so the test cancels at its probe, and the amber-integration jobs start RustFS but only run IntegrationTest-tagged tests (AMBER_TEST_FILTER=integration-only), which this one isn't.

This change is test-only, apart from one doc comment:

  1. Calls LargeBinaryManager.deleteByExecution(testExecutionId) in the test's existing outer finally, so the cleanup also runs when the scan throws. deleteByExecution logs failures instead of throwing, so it can't hide the test's own failure.
  2. Asserts that the produced object's URI is under objects/<testExecutionId>/, and at the end of the test that nothing is left under that prefix (S3StorageClient.directoryExists). Without the cleanup, the test fails.
  3. Changes testExecutionId from 8888L to -8670L. The new cleanup is a prefix delete against whatever S3 the config points at, which outside CI is a developer's own. Real execution ids are positive (workflow_executions.eid is SERIAL), so objects/-8670/ can never hold a real execution's binaries, while 8888 could be a real execution on a long-lived dev instance. directoryExists/deleteDirectory add the trailing /, so -8670 doesn't match -86700. I also considered a random negative id per run, which would also keep two checkouts that share one RustFS apart, but chose a fixed one so that any leftover is easy to find if the cleanup ever fails.
  4. Updates baseUriForExecution's doc in LargeBinaryManager to say tests may use a negative id. Its rule (use a persisted EID) exists to avoid collisions with real executions, which a negative id can't have.

Not covered: objects that earlier runs already left under objects/8888/ are not removed by this change. They can be deleted by hand, e.g. aws s3 rm s3://texera-large-binaries/objects/8888/ --recursive --endpoint-url http://localhost:9000.

Possible follow-ups, not in this PR:

  • Tag this test IntegrationTest, so the amber-integration job (which has RustFS) runs it.
  • Give WorkflowOperator's test scope the S3StorageTestBase testcontainers RustFS, so the test is hermetic and runs in CI.

Any related issues, documentation, discussions?

Closes #8670. Follow-up to #7800.

Backport: not needed. On release/v1.2 and release/v1.3 this spec has no 8888 and no setCurrentBaseUri, so the leak isn't there. @mengw15 @xuang7, if backport labels get auto-applied, please drop them.

How was this PR tested?

Locally against Postgres and RustFS (rustfs/rustfs:1.0.0-rc.6 on localhost:9000, storage.conf defaults), with sbt "WorkflowOperator/testOnly *FileScanSourceOpExecSpec":

  1. Red: with only the new assertion (id 8888, no cleanup), the test fails with directoryExists(...) was true objects/8888/, and one 26-byte object is left behind.
  2. Green: with the full change, on a fresh RustFS, two runs both pass (7/7), and the bucket is empty after each.
  3. With the cleanup line commented out, the test fails with ... was true objects/-8670/, and the object sits at objects/-8670/<uuid>. With the line restored, the next run passes and removes it. An object placed under objects/-86700/ survives.
  4. Without S3: succeeded 6, failed 0, canceled 1 with the existing skip message, the same as the CI amber job.
  5. sbt "WorkflowOperator/test" with S3 up: 2702 succeeded, 0 failed, 12 canceled, 2 pending.
  6. sbt scalafmtCheckAll "scalafixAll --check": clean.
  7. After review: with the scan seeded under a different execution id (1234), the new URI assertion fails with "s3://texera-large-binaries/objects/1234/<uuid>" did not contain "objects/-8670/". On the updated head, steps 2 and 6 and the cleanup-removed check from step 3 give the same results as above.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5.5)

The LARGE_BINARY read test streams a real object to S3 whenever an
endpoint is reachable and never deleted it, so every local run with the
dev stack up left one more object under objects/8888/.

Delete the test execution's objects in the existing outer finally, and
assert at the end of the test that none are left. Use a negative
execution id (-8670): real execution ids are positive, so the prefix
delete can never remove a real run's binaries.

Closes apache#8670

Generated-by: Claude Code (Opus 5.5)
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Ma77Ball, @aglinxinyuan
    You can notify them by mentioning @Ma77Ball, @aglinxinyuan in a comment.

@Yicong-Huang Yicong-Huang added release/v1.3 back porting to release/v1.3 release/v1.2 back porting to release/v1.2 labels Oct 14, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 October 14, 2026 08:49
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
✅ release/v1.3 Already labeled — this fix is queued to backport here. @mengw15 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other.
✅ release/v1.2 Already labeled — this fix is queued to backport here. @xuang7 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other.

Auto-label run.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your first contribution to Texera, @ShawnGarello!

If you're looking for a good place to start, browse issues labeled starter-task; they're scoped to be approachable for newcomers.

You can drive common housekeeping yourself by commenting one of these commands on its own line:

  • Issues. Comment /take to assign an open issue to yourself, or /untake to release it. You can find unclaimed work with the search filter is:issue is:open no:assignee.
  • Sub-issues. To link issues into a parent/child hierarchy, comment /sub-issue #5166 #5222 on the parent to attach those children (or /unsub-issue #5166 #5222 to detach them). From a child issue, comment /parent-issue #5166 to set its parent, or /unparent-issue to clear it (the current parent is detected automatically). References may be written as #5166 or as a bare 5166; cross-repository references are not supported.
  • Pull requests (author only). Comment /request-review @user to request a review from someone, or /unrequest-review @user to withdraw that request.

Each command must match exactly: /take this will not work, only /take does. For the full contribution flow, see CONTRIBUTING.md.

@ShawnGarello

Copy link
Copy Markdown
Contributor Author

/request-review @aglinxinyuan @Yicong-Huang

@Ma77Ball Ma77Ball left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

Test-only change that stops FileScanSourceOpExecSpec from leaking a real S3 object into the developer's rustfs_data volume on every local run. It deletes the uploaded object in the test's existing outer finally (via deleteByExecution, which logs rather than throws, so it can't displace the test's own failure), asserts the prefix is empty afterward, and moves the write prefix off 8888 to a negative id so the prefix-delete can never touch a real execution's binaries (real EIDs are positive SERIAL).

The change is sound. The write (baseUriForExecution), delete (executionPrefix), and assertion all resolve to the same objects/-8670/ prefix, and both S3StorageClient.directoryExists and deleteDirectory add the trailing / only when missing, so there is no double-slash and -8670/ cannot match -86700/ -- the boundary the description relies on holds. The fixed-id vs random-id tradeoff for two checkouts sharing one RustFS is already weighed in the PR description and is a reasonable call for debuggability; no objection. No blocking issues.

Action items: Nothing blocking; the single P3 below is optional polish.


Findings

1 total: 0 P0, 0 P1, 0 P2, 1 P3.

Nit (P3)

  • Tie the produced pointer to the cleaned prefix - common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/scan/file/FileScanSourceOpExecSpec.scala:193 - see inline.

Verification

  • No blocking findings to substantiate. Traced the three paths and confirmed they agree on objects/-8670/: write base URI baseUriForExecution(-8670) = s3://<bucket>/objects/-8670/ with create() appending a UUID; cleanup deleteByExecution(-8670) deletes executionPrefix(-8670) = objects/-8670 (normalized to objects/-8670/); the assertion checks directoryExists(DEFAULT_BUCKET, "objects/-8670/"). Both S3 helpers normalize the trailing slash, so no // and no prefix match against -86700/. Negative id is safe because workflow_executions.eid is positive SERIAL.
  • Did not run the suite (no S3 in this environment). Relied on the author's documented red/green local runs for the empty-bucket result; statically verified the prefix arithmetic and the negative-id safety argument.

Address review: assert that the produced object's URI is under the
test's prefix, so the write side and the cleanup can't drift apart,
and make the comments describe the current behaviour. Update
baseUriForExecution's doc to allow negative test ids.

Generated-by: Claude Code (Opus 5.5)
@ShawnGarello

Copy link
Copy Markdown
Contributor Author

@aglinxinyuan @Yicong-Huang, could one of you take a look when you have a chance? @Ma77Ball approved it, and their comments are addressed in 47f5665.

@Yicong-Huang

Copy link
Copy Markdown
Contributor

Review summary

Test-only change that stops FileScanSourceOpExecSpec from leaking a real S3 object into the developer's rustfs_data volume on every local run. It deletes the uploaded object in the test's existing outer finally (via deleteByExecution, which logs rather than throws, so it can't displace the test's own failure), asserts the prefix is empty afterward, and moves the write prefix off 8888 to a negative id so the prefix-delete can never touch a real execution's binaries (real EIDs are positive SERIAL).

The change is sound. The write (baseUriForExecution), delete (executionPrefix), and assertion all resolve to the same objects/-8670/ prefix, and both S3StorageClient.directoryExists and deleteDirectory add the trailing / only when missing, so there is no double-slash and -8670/ cannot match -86700/ -- the boundary the description relies on holds. The fixed-id vs random-id tradeoff for two checkouts sharing one RustFS is already weighed in the PR description and is a reasonable call for debuggability; no objection. No blocking issues.

Action items: Nothing blocking; the single P3 below is optional polish.

Findings

1 total: 0 P0, 0 P1, 0 P2, 1 P3.

Nit (P3)

  • Tie the produced pointer to the cleaned prefix - common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/scan/file/FileScanSourceOpExecSpec.scala:193 - see inline.

Verification

  • No blocking findings to substantiate. Traced the three paths and confirmed they agree on objects/-8670/: write base URI baseUriForExecution(-8670) = s3://<bucket>/objects/-8670/ with create() appending a UUID; cleanup deleteByExecution(-8670) deletes executionPrefix(-8670) = objects/-8670 (normalized to objects/-8670/); the assertion checks directoryExists(DEFAULT_BUCKET, "objects/-8670/"). Both S3 helpers normalize the trailing slash, so no // and no prefix match against -86700/. Negative id is safe because workflow_executions.eid is positive SERIAL.
  • Did not run the suite (no S3 in this environment). Relied on the author's documented red/green local runs for the empty-bucket result; statically verified the prefix arithmetic and the negative-id safety argument.

That looks like the one we run on spark lol

@Yicong-Huang Yicong-Huang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 0 must-fix · 0 advisory · 0 polish: test-only fix that stops the LARGE_BINARY scan test from leaking S3 objects, with the cleanup pinned by an assertion that fails if it ever stops working.

Verification trace

Traced the write, delete, and assert paths end to end. baseUriForExecution(-8670) writes under s3:///objects/-8670/ with a UUID suffix, deleteByExecution deletes executionPrefix(-8670), and the test asserts directoryExists on objects/-8670/. directoryExists and deleteDirectory both normalize a trailing slash (S3StorageClient.scala:70, 114), so the prefix cannot match objects/-86700/ and there is no double slash. Real execution ids are positive because workflow_executions.eid is a SERIAL primary key (sql/texera_ddl.sql:317), so the negative test id cannot collide with a real execution. deleteByExecution catches Exception and logs at error (LargeBinaryManager.scala:97-108), so a cleanup failure cannot mask the test's own failure, and it sits in the outer finally, so it also runs when the scan throws.

@ShawnGarello

Copy link
Copy Markdown
Contributor Author

Thanks @Yicong-Huang! @mengw15 @xuang7, could you decide on the release/v1.3 and release/v1.2 labels when you have a chance?

@codecov-commenter

codecov-commenter commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.22%. Comparing base (1299992) to head (236c29b).
⚠️ Report is 151 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8978      +/-   ##
============================================
- Coverage     91.81%   91.22%   -0.59%     
- Complexity     5069     6111    +1042     
============================================
  Files          1271     1297      +26     
  Lines         55208    60329    +5121     
  Branches       6987     7855     +868     
============================================
+ Hits          50688    55036    +4348     
- Misses         2800     3376     +576     
- Partials       1720     1917     +197     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.16% <ø> (ø) Carriedforward from 1299992
amber 85.62% <ø> (-0.35%) ⬇️
computing-unit-managing-service 66.04% <ø> (+4.20%) ⬆️
config-service 90.97% <ø> (+3.47%) ⬆️
file-service 84.77% <ø> (+2.85%) ⬆️
frontend 96.50% <ø> (ø) Carriedforward from 1299992
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.54% <ø> (ø) Carriedforward from 1299992
workflow-compiling-service 77.18% <ø> (+4.57%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 0 better · 🔴 7 worse · ⚪ 8 noise (<±5%) · 0 without baseline

Compared against main 1299992 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 364 0.222 24,535/39,051/39,051 us 🔴 +22.4% / 🔴 +170.1%
🔴 bs=100 sw=10 sl=64 826 0.504 118,961/159,371/159,371 us 🔴 +12.4% / 🔴 +70.9%
⚪ bs=1000 sw=10 sl=64 949 0.579 1,037,724/1,189,896/1,189,896 us ⚪ within ±5% / 🔴 +35.6%
Baseline details

Latest main 1299992 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 364 tuples/sec 429 tuples/sec 927.28 tuples/sec -15.2% -60.7%
bs=10 sw=10 sl=64 MB/s 0.222 MB/s 0.262 MB/s 0.566 MB/s -15.3% -60.8%
bs=10 sw=10 sl=64 p50 24,535 us 23,219 us 10,932 us +5.7% +124.4%
bs=10 sw=10 sl=64 p95 39,051 us 31,905 us 14,458 us +22.4% +170.1%
bs=10 sw=10 sl=64 p99 39,051 us 31,905 us 17,274 us +22.4% +126.1%
bs=100 sw=10 sl=64 throughput 826 tuples/sec 849 tuples/sec 1,240 tuples/sec -2.7% -33.4%
bs=100 sw=10 sl=64 MB/s 0.504 MB/s 0.518 MB/s 0.757 MB/s -2.7% -33.4%
bs=100 sw=10 sl=64 p50 118,961 us 115,436 us 85,781 us +3.1% +38.7%
bs=100 sw=10 sl=64 p95 159,371 us 141,837 us 93,231 us +12.4% +70.9%
bs=100 sw=10 sl=64 p99 159,371 us 141,837 us 116,160 us +12.4% +37.2%
bs=1000 sw=10 sl=64 throughput 949 tuples/sec 966 tuples/sec 1,278 tuples/sec -1.8% -25.7%
bs=1000 sw=10 sl=64 MB/s 0.579 MB/s 0.59 MB/s 0.78 MB/s -1.9% -25.8%
bs=1000 sw=10 sl=64 p50 1,037,724 us 1,033,360 us 835,630 us +0.4% +24.2%
bs=1000 sw=10 sl=64 p95 1,189,896 us 1,141,740 us 877,570 us +4.2% +35.6%
bs=1000 sw=10 sl=64 p99 1,189,896 us 1,141,740 us 922,624 us +4.2% +29.0%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,548.94,200,128000,364,0.222,24534.83,39050.92,39050.92
1,100,10,64,20,2421.75,2000,1280000,826,0.504,118961.15,159370.78,159370.78
2,1000,10,64,20,21072.47,20000,12800000,949,0.579,1037724.11,1189896.43,1189896.43

@ShawnGarello

Copy link
Copy Markdown
Contributor Author

@mengw15, CI is green now, so the release labels are the only thing left here. Could you take a look when you have a chance?

@mengw15 mengw15 removed the release/v1.3 back porting to release/v1.3 label Nov 9, 2026
@xuang7

xuang7 commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Removing release/v1.2: test-only.

@xuang7 xuang7 removed the release/v1.2 back porting to release/v1.2 label Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LARGE_BINARY test leaves a real S3 object behind on every S3-reachable run

6 participants