Skip to content

refactor(amber, service): simplify CU, Iceberg, engine - #9519

Merged
aglinxinyuan merged 4 commits into
apache:mainfrom
aglinxinyuan:refactor/cu-storage-engine-cleanup
Nov 21, 2026
Merged

aglinxinyuan merged 4 commits into
apache:mainfrom
aglinxinyuan:refactor/cu-storage-engine-cleanup

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Simplifies query round-trips, redundant allocations, exception rethrows, and unused test scaffolding across computing-unit-managing-service, common/workflow-core, and amber (+228/−252 lines across 12 production files; +309/−267 total across 19 files including characterization tests and Iceberg/timer spec cleanups) without changing observable API or engine behavior:

  • Computing unit & curated image services (ComputingUnitManagingResource, CuratedImageResource): Fetch a ready curated image's ref and display name in a single query (readyImageFor returns a ReadyImage, replacing nameOf), take the new unit's generated cuid from Dao.insert's write-back so one WorkflowComputingUnit drives the row and the response without lastID() or a re-fetch, drop the identity rethrow after createPod, filter TERMINATE_TIME IS NULL and join COMPUTING_UNIT_USER_ACCESS in listComputingUnits, execute terminateComputingUnit with a single transactional read returning Either, return (name, normalizedRef) directly from CuratedImageResource.validate, share selectImageSummaries, check image name uniqueness with fetchExists, drop the redundant Status.Pending setter, and mark unused @Auth parameters.
  • Iceberg storage & specs (VFSURIFactory, OnIceberg, IcebergDocument, IcebergTableWriter, IcebergDocumentSpec, IcebergDocumentConsoleMessagesSpec): Share requireTable on OnIceberg between IcebergDocument and expireSnapshots, compute field schemas and snapshot statistics in single passes, compare and format partition date bounds once, return getTotalFileSize directly without a mutable accumulator, stream tuple ZIP exports via iterator.zipWithIndex (each part still loads its table, so the export never holds one past its catalog, per [BYO-S3] Bound the per-warehouse catalog cache and release evicted catalogs #7290), remove IcebergTableWriter.recordId and the redundant close() guard, drop the unused warehouse default parameter in VFSURIFactory, and remove redundant afterAll() forwarders in the two Iceberg integration specs.
  • Amber engine & WebSocket handshake (CoordinatorTimerService, CoordinatorTimerServiceSpec, AmberRuntime, Utils, ReplayLogManager, AsyncRPCServer, ServletAwareConfigurator): Cancel through foreach and return None from CoordinatorTimerService.disableTimer and drop unused fixture defaults in CoordinatorTimerServiceSpec; remove redundant identity-rethrow catch blocks while preserving lock release, cursor advancement, cause unwrapping, and outer RPC error logging; and replace the trailing .map(...) with .foreach(...) in ServletAwareConfigurator.

Any related issues, documentation, discussions?

Closes #9516.

How was this PR tested?

Added characterization tests first (1daf62da5c) covering unit listing/termination exclusivity and privilege precedence, IcebergTableWriter overwrite/close behavior, IcebergDocument getCount and invalid-input errors, Utils.retry lock release, and CoordinatorTimerService timer cancellation. Verified two negative controls against those tests before applying the cleanup commit (5f3d6285f3): dropping the TERMINATE_TIME.isNull filter failed ComputingUnitManagingResourceSpec (51 passed, 1 failed), and omitting the cancel() call in disableTimer failed CoordinatorTimerServiceSpec (10 passed, 4 failed). 6139b06bc0 pins the first ZIP entry name, part-00000.parquet, in WorkflowCore's IcebergDocumentSpec before the switch from String.format to the f interpolator; it passes on that commit's String.format code (25/25) and fails once the padding is cut to %04d (24 passed, 1 failed).

Verified all formatting, Scalafix, unit suites, and Hadoop-catalog Iceberg integration tests on final HEAD (5c890204d5, with a clean git merge-tree against bf6bf9fc3a):

sbt "ComputingUnitManagingService/scalafix --check" "ComputingUnitManagingService/Test/scalafix --check" "ComputingUnitManagingService/scalafmtCheck" "ComputingUnitManagingService/Test/scalafmtCheck" \
    "WorkflowCore/scalafix --check" "WorkflowCore/Test/scalafix --check" "WorkflowCore/scalafmtCheck" "WorkflowCore/Test/scalafmtCheck" \
    "WorkflowExecutionService/scalafix --check" "WorkflowExecutionService/Test/scalafix --check" "WorkflowExecutionService/scalafmtCheck" "WorkflowExecutionService/Test/scalafmtCheck"
STORAGE_ICEBERG_CATALOG_TYPE=hadoop UDF_PYTHON_PATH="<python3.12>" sbt \
    "ComputingUnitManagingService/test" \
    "WorkflowCore/testOnly * -- -l org.apache.texera.common.tags.NonParallelTest" \
    "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.common.UtilsSpec org.apache.texera.amber.engine.common.rpc.AsyncRPCServerSpec org.apache.texera.amber.engine.architecture.logreplay.* org.apache.texera.amber.engine.architecture.coordinator.CoordinatorTimerServiceSpec org.apache.texera.amber.engine.architecture.coordinator.CoordinatorSpec org.apache.texera.amber.engine.architecture.worker.WorkerTimerServiceSpec org.apache.texera.web.ServletAwareConfiguratorSpec"
AMBER_TEST_FILTER=integration-only STORAGE_ICEBERG_CATALOG_TYPE=hadoop UDF_PYTHON_PATH="<python3.12>" sbt \
    "WorkflowExecutionService/testOnly org.apache.texera.amber.storage.result.iceberg.IcebergDocumentSpec org.apache.texera.amber.storage.result.iceberg.IcebergDocumentConsoleMessagesSpec"
  • scalafix --check & scalafmtCheck (Compile & Test across all 3 modules): all 12 checks passed.
  • ComputingUnitManagingService/test: 15 suites, 322 succeeded, 0 failed.
  • WorkflowCore/testOnly * -- -l org.apache.texera.common.tags.NonParallelTest: 54 suites, 708 succeeded, 0 failed, 1 pre-existing pending.
  • WorkflowExecutionService (engine, timer, replay, RPC, WebSocket unit specs): 10 suites, 96 succeeded, 0 failed.
  • WorkflowExecutionService (IcebergDocumentSpec, IcebergDocumentConsoleMessagesSpec under AMBER_TEST_FILTER=integration-only): 2 suites, 30 succeeded, 0 failed.

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

Generated-by: Antigravity IDE (Gemini 3.8 Flash), Claude Code (Claude Opus 5.5)

Add characterization tests across zero-overlap computing-unit, Iceberg storage, lock, and timer specs before dead-code and allocation cleanups.
@aglinxinyuan aglinxinyuan added the refactor Refactor the code label Nov 17, 2026
Copilot AI balanced review requested due to automatic review settings November 17, 2026 06:41

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

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: @mengw15, @Ma77Ball, @Yicong-Huang
    You can notify them by mentioning @mengw15, @Ma77Ball, @Yicong-Huang in a comment.

@codecov-commenter

codecov-commenter commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.28571% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.54%. Comparing base (4ff82fa) to head (5c89020).
⚠️ Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
...texera/service/resource/CuratedImageResource.scala 26.31% 12 Missing and 2 partials ⚠️
...ache/texera/amber/engine/common/AmberRuntime.scala 0.00% 3 Missing ⚠️
...rvice/resource/ComputingUnitManagingResource.scala 80.00% 1 Missing and 1 partial ⚠️
.../core/storage/result/iceberg/IcebergDocument.scala 94.44% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9519      +/-   ##
============================================
- Coverage     91.62%   91.54%   -0.09%     
- Complexity     5039     5182     +143     
============================================
  Files          1284     1299      +15     
  Lines         56979    57918     +939     
  Branches       7402     7579     +177     
============================================
+ Hits          52207    53021     +814     
- Misses         2904     2955      +51     
- Partials       1868     1942      +74     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.56% <ø> (ø) Carriedforward from 5f3d628
amber 85.46% <85.18%> (+0.06%) ⬆️
computing-unit-managing-service 63.83% <44.82%> (-0.23%) ⬇️
config-service 87.50% <ø> (-0.24%) ⬇️
file-service 82.16% <ø> (ø)
frontend 96.41% <ø> (ø) Carriedforward from 5f3d628
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.44% <ø> (ø) Carriedforward from 5f3d628
result-service 85.71% <ø> (?)
workflow-compiling-service 78.30% <ø> (ø)

*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 Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ No material benchmark regressions detected

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

Compared against main 82cea12 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 406 0.248 23,246/32,634/32,634 us 🟢 -53.6% / 🔴 +135.5%
🟢 bs=100 sw=10 sl=64 862 0.526 114,867/128,332/128,332 us 🟢 -6.9% / 🔴 +47.5%
⚪ bs=1000 sw=10 sl=64 974 0.594 1,020,285/1,124,063/1,124,063 us ⚪ within ±5% / 🔴 +38.1%
Baseline details

Latest main 82cea12 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 406 tuples/sec 360 tuples/sec 1,019 tuples/sec +12.8% -60.2%
bs=10 sw=10 sl=64 MB/s 0.248 MB/s 0.22 MB/s 0.622 MB/s +12.7% -60.1%
bs=10 sw=10 sl=64 p50 23,246 us 24,791 us 10,136 us -6.2% +129.3%
bs=10 sw=10 sl=64 p95 32,634 us 70,288 us 13,860 us -53.6% +135.5%
bs=10 sw=10 sl=64 p99 32,634 us 70,288 us 16,484 us -53.6% +98.0%
bs=100 sw=10 sl=64 throughput 862 tuples/sec 877 tuples/sec 1,363 tuples/sec -1.7% -36.8%
bs=100 sw=10 sl=64 MB/s 0.526 MB/s 0.535 MB/s 0.832 MB/s -1.7% -36.8%
bs=100 sw=10 sl=64 p50 114,867 us 112,100 us 79,194 us +2.5% +45.0%
bs=100 sw=10 sl=64 p95 128,332 us 137,801 us 87,022 us -6.9% +47.5%
bs=100 sw=10 sl=64 p99 128,332 us 137,801 us 106,894 us -6.9% +20.1%
bs=1000 sw=10 sl=64 throughput 974 tuples/sec 964 tuples/sec 1,407 tuples/sec +1.0% -30.8%
bs=1000 sw=10 sl=64 MB/s 0.594 MB/s 0.588 MB/s 0.859 MB/s +1.0% -30.8%
bs=1000 sw=10 sl=64 p50 1,020,285 us 1,027,622 us 776,422 us -0.7% +31.4%
bs=1000 sw=10 sl=64 p95 1,124,063 us 1,107,721 us 814,091 us +1.5% +38.1%
bs=1000 sw=10 sl=64 p99 1,124,063 us 1,107,721 us 860,577 us +1.5% +30.6%
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,493.09,200,128000,406,0.248,23246.32,32633.61,32633.61
1,100,10,64,20,2319.90,2000,1280000,862,0.526,114866.77,128331.80,128331.80
2,1000,10,64,20,20539.91,20000,12800000,974,0.594,1020285.09,1124063.27,1124063.27

@aglinxinyuan
aglinxinyuan force-pushed the refactor/cu-storage-engine-cleanup branch from d1d9d25 to 5f3d628 Compare November 17, 2026 06:48
@aglinxinyuan
aglinxinyuan requested review from aicam and kunwp1 November 17, 2026 08:18

@kunwp1 kunwp1 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.

LGTM!

Share requireTable on OnIceberg, keep = 0 initializers, inline the planning
catalog, format part names with f"", and note why each part reloads the
table (apache#7290). Let Dao.insert write the generated cuid back into the unit
instead of a hand-written insert and update, drop the identity rethrow
after createPod, return a ReadyImage from readyImageFor and remove nameOf,
and cancel timers with foreach.
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Nov 21, 2026
Merged via the queue into apache:main with commit 4a537f0 Nov 21, 2026
41 checks passed
@aglinxinyuan
aglinxinyuan deleted the refactor/cu-storage-engine-cleanup branch November 21, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

amber-integration common engine platform Non-amber Scala service paths refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify computing-unit queries, Iceberg storage, and engine paths

4 participants