Skip to content

[opt](cloud) Add warm up job count metric on BE - #64734

Merged
liaoxin01 merged 2 commits into
apache:masterfrom
liaoxin01:warmup-job-num-metric
Jul 27, 2026
Merged

[opt](cloud) Add warm up job count metric on BE#64734
liaoxin01 merged 2 commits into
apache:masterfrom
liaoxin01:warmup-job-num-metric

Conversation

@liaoxin01

Copy link
Copy Markdown
Contributor

Proposed changes

Add a file_cache_warm_up_job_num bvar metric that tracks the number of warm up jobs currently held in a BE's memory. This gives operators per-BE visibility into how many warm up jobs each backend is currently holding.

What changed

In be/src/cloud/cloud_warm_up_manager.cpp:

  • New bvar::Adder<int64_t> g_file_cache_warm_up_job_num("file_cache_warm_up_job_num").
  • +1 when FE dispatches a new job to this BE:
    • check_and_set_job_id — regular (cluster/table) warm up SET_JOB, on _cur_job_id transition 0 -> job_id.
    • check_and_set_batch_id — defensive, same 0 -> job_id transition (e.g. if a SET_BATCH were to arrive first).
    • set_event — event-driven SET_JOB, when a new job_id is inserted into _tablet_replica_cache.
  • -1 when the job is cleared:
    • clear_job — regular CLEAR_JOB, only when a live job actually existed.
    • set_event (clear) — event-driven CLEAR_JOB, only when _tablet_replica_cache.erase() actually removed an entry.

Why it is dedup-safe

All increments/decrements are gated on real state transitions rather than on RPC arrival:

  • _cur_job_id is a single slot whose only reset to 0 is in clear_job (which carries the matching -1), so a regular job contributes exactly one +1 and one -1 per lifecycle. Repeated SET_JOB (retry, FE failover replay) hits the _cur_job_id != 0 guard and does not double count.
  • Event-driven counting is guarded by !_tablet_replica_cache.contains(job_id) (add) and erase(job_id) > 0 (clear), so duplicate SET_JOB/CLEAR_JOB are no-ops.

The metric is process-local: on BE restart it resets to 0 along with _cur_job_id / _tablet_replica_cache, so an abandoned-but-not-cleared job (e.g. BE down during CLEAR_JOB) self-heals on restart.

The value is exposed via the BE /vars endpoint as file_cache_warm_up_job_num.

CopilotAI review requested due to automatic review settings June 23, 2026 08:58
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@liaoxin01liaoxin01 changed the title [feature](cloud) Add warm up job count metric on BE[opt](cloud) Add warm up job count metric on BEJun 23, 2026
@liaoxin01

Copy link
Copy Markdown
ContributorAuthor

/review

@liaoxin01

Copy link
Copy Markdown
ContributorAuthor

run buildall

CopilotAI 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.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds a new BE-local bvar metric to track how many file-cache warm-up jobs are currently resident in backend memory, incrementing/decrementing on state transitions so retries/dedup don’t skew counts.

Changes:

  • Introduces file_cache_warm_up_job_num as a process-local bvar::Adder<int64_t>.
  • Increments the metric when a job is first accepted (regular SET_JOB/SET_BATCH and event-driven LOAD add).
  • Decrements the metric when a job is actually cleared (regular CLEAR_JOB and event-driven LOAD clear on successful erase).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadbe/src/cloud/cloud_warm_up_manager.cpp
github-actions[bot]
github-actionsBot previously requested changes Jun 23, 2026

@github-actionsgithub-actionsBot 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.

I found one correctness issue in the new metric lifecycle accounting.

Critical checkpoint conclusions:

  • Goal/test: the PR adds a BE-local bvar for warm-up jobs currently held in memory, but the event-driven lazy cancellation path can remove a held job without decrementing the metric. Existing tests cover the lazy cleanup behavior, but not this new bvar value.
  • Scope: the code change is small and focused on CloudWarmUpManager metric bookkeeping.
  • Concurrency/lifecycle: the touched state is protected by _mtx; the issue is lifecycle completeness, not a lock race. Event-driven jobs can be cleared both by explicit CLEAR_JOB and by lazy FE CANCELLED cleanup, and only the explicit path updates the new metric.
  • Config/protocol/compatibility/storage: no new config, protocol, storage format, or rolling-upgrade compatibility concern found.
  • Parallel paths: regular once/periodic job accounting and explicit event clear were checked; the missed parallel path is event-driven lazy cancellation.
  • Observability: the added metric is useful, but currently misleading after missed/expired event-driven clears.
  • Tests/CI: git diff --check is clean for the changed file. GitHub formatting/checkstyle and TeamCity compile checks are passing; the macOS BE UT job failed before tests because the runner has JDK 25 instead of required JDK 17, which appears unrelated. Several TeamCity regression/BE UT jobs are still pending.

User focus: no additional user-provided focus was supplied.

Subagent conclusions: TSC-1 and OR-1 were verified and merged into the single inline comment below. OR-2 was recorded as a duplicate. The existing Copilot comment on the redundant _cur_job_id != 0 guard was treated as already-known and not duplicated. Convergence round 1 ended with both subagents replying NO_NEW_VALUABLE_FINDINGS for the same final ledger/comment set.

Comment threadbe/src/cloud/cloud_warm_up_manager.cpp
@liaoxin01

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29496 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 5baed1b9f9e4594ef30d1b257a0c2a84073e9615, data reload: false
------ Round 1 ----------------------------------
============================================
q1	17605	4111	4079	4079
q2	1990	319	182	182
q3	10379	1392	835	835
q4	4682	472	341	341
q5	7524	877	563	563
q6	183	178	136	136
q7	799	858	616	616
q8	9450	1658	1636	1636
q9	6007	4515	4500	4500
q10	6821	1817	1524	1524
q11	447	266	247	247
q12	635	423	295	295
q13	18101	3731	2758	2758
q14	270	260	242	242
q15	q16	790	778	713	713
q17	1030	908	959	908
q18	6807	5659	5734	5659
q19	1322	1438	1160	1160
q20	486	400	263	263
q21	5931	2646	2546	2546
q22	452	356	293	293
Total cold run time: 101711 ms
Total hot run time: 29496 ms
----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4462	4398	4436	4398
q2	311	340	220	220
q3	4579	4959	4389	4389
q4	2032	2137	1365	1365
q5	4540	4396	4370	4370
q6	260	196	132	132
q7	1742	2086	1725	1725
q8	2630	2274	2223	2223
q9	8176	8223	8099	8099
q10	4795	4736	4238	4238
q11	567	590	373	373
q12	776	756	541	541
q13	3317	3537	2877	2877
q14	318	318	287	287
q15	q16	708	774	637	637
q17	1374	1363	1350	1350
q18	8179	7267	7003	7003
q19	1121	1093	1115	1093
q20	2238	2207	1957	1957
q21	5310	4635	4436	4436
q22	514	445	407	407
Total cold run time: 57949 ms
Total hot run time: 52120 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 172553 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 5baed1b9f9e4594ef30d1b257a0c2a84073e9615, data reload: false
query5	4358	651	488	488
query6	437	190	170	170
query7	4832	581	318	318
query8	363	211	195	195
query9	8751	4050	4052	4050
query10	427	299	256	256
query11	5894	2361	2106	2106
query12	159	100	97	97
query13	1256	610	437	437
query14	6339	5422	5101	5101
query14_1	4385	4407	4404	4404
query15	201	194	179	179
query16	975	438	408	408
query17	1090	685	564	564
query18	2436	471	339	339
query19	199	184	144	144
query20	110	105	103	103
query21	211	134	113	113
query22	13591	13450	13333	13333
query23	17265	16426	15992	15992
query23_1	16186	16180	16300	16180
query24	7512	1816	1320	1320
query24_1	1343	1336	1298	1298
query25	540	441	372	372
query26	1281	327	164	164
query27	2678	582	352	352
query28	4449	2054	2025	2025
query29	1073	611	464	464
query30	302	243	203	203
query31	1120	1079	947	947
query32	105	58	61	58
query33	508	313	265	265
query34	1175	1176	686	686
query35	758	782	682	682
query36	1350	1409	1231	1231
query37	161	109	94	94
query38	1892	1726	1681	1681
query39	925	931	894	894
query39_1	881	878	867	867
query40	231	128	107	107
query41	72	66	67	66
query42	85	90	88	88
query43	338	340	285	285
query44	1510	775	782	775
query45	196	186	179	179
query46	1166	1228	781	781
query47	2399	2430	2251	2251
query48	416	386	300	300
query49	639	478	369	369
query50	1091	386	270	270
query51	4516	4437	4330	4330
query52	81	87	72	72
query53	260	269	199	199
query54	293	235	215	215
query55	75	72	69	69
query56	257	235	246	235
query57	1411	1404	1304	1304
query58	249	227	217	217
query59	1669	1703	1509	1509
query60	300	252	245	245
query61	186	176	176	176
query62	692	656	585	585
query63	231	194	198	194
query64	2604	839	606	606
query65	4891	4773	4821	4773
query66	1798	475	336	336
query67	29773	29765	29588	29588
query68	3203	1501	910	910
query69	414	302	266	266
query70	1083	995	997	995
query71	294	238	216	216
query72	2906	2627	2295	2295
query73	869	816	417	417
query74	5098	4993	4809	4809
query75	2625	2609	2220	2220
query76	2312	1232	818	818
query77	358	390	289	289
query78	12348	12507	11788	11788
query79	1440	1166	770	770
query80	1264	516	379	379
query81	531	277	240	240
query82	660	159	121	121
query83	325	274	252	252
query84	263	139	115	115
query85	925	509	423	423
query86	419	293	283	283
query87	1840	1820	1775	1775
query88	3754	2807	2789	2789
query89	444	390	341	341
query90	2000	192	184	184
query91	171	162	128	128
query92	62	60	54	54
query93	1567	1399	888	888
query94	727	318	323	318
query95	689	392	343	343
query96	1066	760	345	345
query97	2688	2690	2575	2575
query98	221	206	197	197
query99	1205	1161	1040	1040
Total cold run time: 259091 ms
Total hot run time: 172553 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.26 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 5baed1b9f9e4594ef30d1b257a0c2a84073e9615, data reload: false
query1	0.01	0.00	0.00
query2	0.09	0.05	0.05
query3	0.26	0.14	0.13
query4	1.60	0.14	0.14
query5	0.24	0.22	0.24
query6	1.28	1.11	1.03
query7	0.04	0.02	0.01
query8	0.06	0.04	0.04
query9	0.37	0.32	0.31
query10	0.55	0.54	0.53
query11	0.20	0.13	0.14
query12	0.18	0.15	0.15
query13	0.47	0.47	0.46
query14	1.02	1.04	0.98
query15	0.61	0.59	0.59
query16	0.31	0.31	0.34
query17	1.06	1.16	1.11
query18	0.22	0.21	0.21
query19	2.00	1.99	2.01
query20	0.02	0.01	0.01
query21	15.41	0.23	0.13
query22	4.74	0.05	0.05
query23	16.13	0.31	0.12
query24	2.91	0.43	0.34
query25	0.11	0.04	0.03
query26	0.73	0.21	0.16
query27	0.04	0.04	0.03
query28	3.53	0.92	0.53
query29	12.50	4.33	3.49
query30	0.27	0.15	0.16
query31	2.78	0.59	0.30
query32	3.23	0.60	0.49
query33	3.17	3.17	3.25
query34	15.56	4.18	3.52
query35	3.52	3.56	3.53
query36	0.55	0.43	0.44
query37	0.09	0.07	0.06
query38	0.06	0.04	0.04
query39	0.03	0.03	0.03
query40	0.19	0.16	0.16
query41	0.09	0.03	0.04
query42	0.03	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 96.3 s
Total hot run time: 25.26 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 30.77% (4/13) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage72.36% (27740/38338)
Line Coverage55.68% (297314/534007)
Region Coverage52.39% (247914/473226)
Branch Coverage53.51% (107371/200661)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 30.77% (4/13) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage72.36% (27742/38338)
Line Coverage55.69% (297374/534007)
Region Coverage52.39% (247905/473226)
Branch Coverage53.52% (107395/200661)

gavinchou
gavinchou previously approved these changes Jun 30, 2026
@gavinchou

Copy link
Copy Markdown
Contributor

/review

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Jun 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

github-actions[bot]
github-actionsBot previously requested changes Jun 30, 2026

@github-actionsgithub-actionsBot 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.

I found one issue: the new BE warm-up job count metric is added without direct coverage for the lifecycle balance it depends on.

Critical checkpoint conclusions:

  • Goal/test: the PR adds file_cache_warm_up_job_num to report warm-up jobs currently held in BE memory, but no test directly proves the new counter balances across its lifecycle paths.
  • Scope: the implementation is small and focused on CloudWarmUpManager metric bookkeeping.
  • Concurrency/lifecycle: the touched manager state is protected by _mtx; the reviewed risk is lifecycle completeness across the regular job slot, event-driven cache, and FE-CANCELLED lazy cleanup.
  • Config/protocol/compatibility/storage: no new config, protocol, storage format, persistence, or rolling-upgrade compatibility concern found.
  • Parallel paths: regular SET_JOB/SET_BATCH/CLEAR_JOB, event SET/CLEAR, duplicate event updates, and lazy cancellation were inspected. The current head addresses the previously raised lazy-cleanup decrement path, but tests do not lock that contract down.
  • Observability: the new bvar is useful, but it becomes misleading if any future cleanup path forgets to decrement.
  • Tests/CI: git diff --check HEAD -- be/src/cloud/cloud_warm_up_manager.cpp is clean. Live PR checks show compile, formatter, main BE UT, cloud regression, and P0 regression passing; macOS BE UT and coverage are currently failing in external checks and were not diagnosed here. Local BE tests were not run because this checkout is missing thirdparty/installed.

User focus: no additional user-provided review focus was supplied.

Subagent conclusions: optimizer-rewrite reported NO_NEW_VALUABLE_FINDINGS. tests-session-config proposed TSC-001, which was accepted as main-001 and submitted as the inline comment. Convergence round 1 ended with both live subagents reporting NO_NEW_VALUABLE_FINDINGS for the same final ledger/comment set.

Comment threadbe/src/cloud/cloud_warm_up_manager.cpp
Add a `file_cache_warm_up_job_num` bvar that tracks the number of warm
up jobs currently held in a BE's memory. It is incremented when FE
dispatches a new job to the BE (SET_JOB / SET_BATCH / event-driven
SET_JOB) and decremented when the job is cleared (CLEAR_JOB /
event-driven CLEAR_JOB).
The increment/decrement are gated on actual state transitions
(`_cur_job_id` going 0 -> job_id, and `_tablet_replica_cache.erase()`
returning > 0), so retries, FE failover replays, and duplicate
CLEAR_JOB requests do not skew the count.
Address review: the event-driven `_tablet_replica_cache` can also be
erased in `get_replica_info()` when FE reports a warm up job as
CANCELLED (lazy cleanup used when an explicit CLEAR_JOB is missed).
That erase did not decrement `g_file_cache_warm_up_job_num`, so the
metric could stay at 1 after the job is no longer held.
Decrement the metric when this erase actually removes an entry, and
erase the matching `_event_driven_filters` entry to stay consistent
with the explicit CLEAR_JOB path in set_event().
@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Jul 9, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@liaoxin01

Copy link
Copy Markdown
ContributorAuthor

/review

@github-actionsgithub-actionsBot 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.

Automated review summary for PR #64734.

I reviewed the single changed file, be/src/cloud/cloud_warm_up_manager.cpp, plus the BE service dispatch and FE warm-up request paths. I am not adding new inline comments: the only substantiated concern found in this pass is already covered by existing inline thread discussion_r3496071818, which requests direct lifecycle tests for file_cache_warm_up_job_num. The lazy cancellation decrement added in get_replica_info() matches the explicit event CLEAR path and addresses the earlier metric-leak thread at discussion_r3459320733.

Critical checkpoint conclusions:

  • Goal/test: the change adds a BE metric for warm-up jobs held in memory. The code gates increments on _cur_job_id going from 0 to a real job or event cache insertion, and gates decrements on clear/cache erase/lazy cancel. Direct metric lifecycle coverage is still missing, already tracked by the existing inline thread.
  • Scope: the implementation is narrowly scoped to one BE cloud file and follows the existing bvar/manager-state pattern.
  • Concurrency/lifecycle: changed regular and event-driven state transitions are under _mtx; no new lock order or shutdown lifecycle issue was found.
  • Compatibility/config/session: no persisted format, thrift schema, config, or session propagation change is introduced.
  • Parallel paths: regular SET_JOB/SET_BATCH/CLEAR_JOB, event SET/CLEAR, retry/duplicate clear, and FE-CANCELLED lazy cleanup paths were checked.
  • Observability/performance: this is observability-only; no meaningful hot-path cost beyond bvar updates on existing state transitions was found.
  • Tests: not run in this checkout because .worktree_initialized and thirdparty/installed are missing. Validation was static.

Subagent conclusions:

  • optimizer-rewrite: no new valuable findings; no optimizer, join, aggregate, or Nereids rewrite paths are touched.
  • tests-session-config: recorded TSC-DUP-001, a duplicate of existing thread discussion_r3496071818; no new non-duplicate finding.
  • Convergence round 1 ended with both live subagents returning NO_NEW_VALUABLE_FINDINGS for the same ledger/comment set.

User focus: .code-review.KbTfY8/review_focus.txt contains no additional user-provided focus.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 30.77% (4/13) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage56.54% (23213/41054)
Line Coverage40.10% (225276/561745)
Region Coverage36.03% (177908/493713)
Branch Coverage37.11% (79081/213117)

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29635 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 98978fb114e1e83e92805c5dba3d5f31cdc188b6, data reload: false
------ Round 1 ----------------------------------
============================================
q1	17633	4162	4176	4162
q2	2028	329	204	204
q3	10281	1426	861	861
q4	4681	476	337	337
q5	7500	860	574	574
q6	182	177	140	140
q7	766	840	609	609
q8	9363	1575	1500	1500
q9	5638	4462	4410	4410
q10	6788	1813	1537	1537
q11	503	342	317	317
q12	711	565	434	434
q13	18106	3529	2765	2765
q14	273	265	244	244
q15	q16	788	798	707	707
q17	1036	995	968	968
q18	7066	5810	5510	5510
q19	1301	1303	1069	1069
q20	747	675	535	535
q21	5964	2618	2446	2446
q22	434	355	306	306
Total cold run time: 101789 ms
Total hot run time: 29635 ms
----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4531	4459	4412	4412
q2	304	318	232	232
q3	4579	4935	4409	4409
q4	2109	2196	1385	1385
q5	4522	4389	4303	4303
q6	243	175	130	130
q7	1804	2198	1641	1641
q8	2716	2341	2287	2287
q9	8125	8135	7900	7900
q10	4699	4720	4280	4280
q11	602	477	420	420
q12	770	800	540	540
q13	3337	3577	3037	3037
q14	311	299	287	287
q15	q16	713	731	647	647
q17	1410	1333	1384	1333
q18	8049	7569	7314	7314
q19	1167	1137	1137	1137
q20	2212	2210	1927	1927
q21	5309	4783	4562	4562
q22	553	489	411	411
Total cold run time: 58065 ms
Total hot run time: 52594 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 179709 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 98978fb114e1e83e92805c5dba3d5f31cdc188b6, data reload: false
query5	4320	641	487	487
query6	459	243	212	212
query7	4889	603	335	335
query8	349	204	173	173
query9	8785	4005	4026	4005
query10	458	358	316	316
query11	5913	2359	2176	2176
query12	167	107	100	100
query13	1261	594	442	442
query14	6286	5345	4999	4999
query14_1	4353	4285	4265	4265
query15	209	201	175	175
query16	992	466	433	433
query17	940	741	560	560
query18	2449	467	339	339
query19	201	193	144	144
query20	107	106	106	106
query21	229	167	134	134
query22	13712	13671	13494	13494
query23	17447	16539	16061	16061
query23_1	16311	16316	16175	16175
query24	7475	1783	1278	1278
query24_1	1314	1259	1294	1259
query25	529	438	363	363
query26	1311	335	218	218
query27	2631	592	355	355
query28	4475	2006	1976	1976
query29	1072	637	534	534
query30	339	264	226	226
query31	1115	1104	989	989
query32	110	64	66	64
query33	536	361	253	253
query34	1171	1172	667	667
query35	776	802	668	668
query36	1398	1376	1251	1251
query37	153	111	88	88
query38	1846	1700	1651	1651
query39	924	922	877	877
query39_1	889	873	902	873
query40	241	159	141	141
query41	66	64	64	64
query42	91	90	90	90
query43	324	340	291	291
query44	1433	787	774	774
query45	214	194	177	177
query46	1071	1238	728	728
query47	2387	2399	2257	2257
query48	412	427	302	302
query49	596	418	319	319
query50	1070	425	326	326
query51	10954	10775	10778	10775
query52	91	88	80	80
query53	260	292	205	205
query54	285	240	214	214
query55	75	72	66	66
query56	297	285	269	269
query57	1402	1413	1319	1319
query58	278	260	275	260
query59	1625	1672	1482	1482
query60	302	278	244	244
query61	150	153	146	146
query62	697	653	575	575
query63	249	210	206	206
query64	2890	1016	848	848
query65	4861	4790	4758	4758
query66	1812	526	390	390
query67	29622	29617	29325	29325
query68	3239	1560	1025	1025
query69	411	296	272	272
query70	1110	964	975	964
query71	359	324	306	306
query72	3028	2301	2502	2301
query73	891	752	422	422
query74	5145	4978	4735	4735
query75	2627	2590	2260	2260
query76	2351	1195	790	790
query77	372	389	295	295
query78	12413	12372	11720	11720
query79	1288	1119	752	752
query80	675	533	468	468
query81	458	316	282	282
query82	242	165	127	127
query83	322	317	292	292
query84	315	159	129	129
query85	894	589	530	530
query86	330	299	277	277
query87	1834	1841	1752	1752
query88	3757	2813	2773	2773
query89	434	396	357	357
query90	2169	203	195	195
query91	196	189	168	168
query92	66	60	60	60
query93	1533	1652	954	954
query94	544	346	320	320
query95	787	588	487	487
query96	1039	804	347	347
query97	2698	2673	2562	2562
query98	206	210	202	202
query99	1144	1169	1045	1045
Total cold run time: 264763 ms
Total hot run time: 179709 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.17 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 98978fb114e1e83e92805c5dba3d5f31cdc188b6, data reload: false
query1	0.01	0.01	0.01
query2	0.09	0.05	0.05
query3	0.26	0.14	0.14
query4	1.61	0.14	0.14
query5	0.24	0.23	0.22
query6	1.30	1.10	1.09
query7	0.03	0.01	0.00
query8	0.06	0.04	0.04
query9	0.38	0.32	0.32
query10	0.54	0.56	0.55
query11	0.20	0.15	0.16
query12	0.19	0.14	0.15
query13	0.47	0.48	0.48
query14	1.01	1.02	1.04
query15	0.63	0.60	0.61
query16	0.31	0.33	0.32
query17	1.10	1.09	1.13
query18	0.22	0.21	0.21
query19	2.10	1.90	1.93
query20	0.02	0.01	0.01
query21	15.48	0.22	0.14
query22	4.75	0.06	0.06
query23	16.12	0.31	0.14
query24	3.02	0.43	0.32
query25	0.11	0.05	0.04
query26	0.74	0.21	0.16
query27	0.04	0.04	0.04
query28	3.47	0.91	0.59
query29	12.49	4.11	3.22
query30	0.27	0.16	0.16
query31	2.77	0.59	0.31
query32	3.22	0.60	0.50
query33	3.22	3.32	3.15
query34	15.53	4.26	3.53
query35	3.52	3.52	3.52
query36	0.56	0.44	0.42
query37	0.09	0.07	0.07
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.17	0.16
query41	0.09	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 96.6 s
Total hot run time: 25.17 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 30.77% (4/13) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.06% (29277/40071)
Line Coverage56.67% (316473/558482)
Region Coverage53.13% (263299/495549)
Branch Coverage54.13% (115489/213346)

@liaoxin01

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29895 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 98978fb114e1e83e92805c5dba3d5f31cdc188b6, data reload: false
------ Round 1 ----------------------------------
============================================
q1	17643	4082	4069	4069
q2	2049	331	208	208
q3	10306	1478	865	865
q4	4676	470	344	344
q5	7499	848	577	577
q6	179	172	136	136
q7	783	841	615	615
q8	9348	1728	1477	1477
q9	5656	4359	4357	4357
q10	6761	1774	1493	1493
q11	517	364	343	343
q12	748	598	459	459
q13	18192	3397	2772	2772
q14	270	259	235	235
q15	q16	793	785	701	701
q17	994	1074	1047	1047
q18	6938	5840	5767	5767
q19	1308	1275	1164	1164
q20	832	693	565	565
q21	5853	2592	2403	2403
q22	420	353	298	298
Total cold run time: 101765 ms
Total hot run time: 29895 ms
----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4376	4304	4291	4291
q2	284	323	211	211
q3	4706	4959	4389	4389
q4	2084	2165	1359	1359
q5	4377	4276	4273	4273
q6	232	175	127	127
q7	1720	2099	1853	1853
q8	2566	2188	2196	2188
q9	7946	8094	7830	7830
q10	4724	4638	4213	4213
q11	584	434	384	384
q12	762	774	544	544
q13	3303	3540	3019	3019
q14	302	316	274	274
q15	q16	708	734	634	634
q17	1319	1333	1311	1311
q18	7871	7240	7329	7240
q19	1199	1109	1138	1109
q20	2194	2205	1935	1935
q21	5243	4566	4396	4396
q22	505	451	399	399
Total cold run time: 57005 ms
Total hot run time: 51979 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 178048 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 98978fb114e1e83e92805c5dba3d5f31cdc188b6, data reload: false
query5	4344	650	471	471
query6	469	222	199	199
query7	4920	566	355	355
query8	345	187	171	171
query9	8769	4019	4017	4017
query10	493	352	306	306
query11	5892	2322	2112	2112
query12	166	104	102	102
query13	1293	628	438	438
query14	6232	5216	4838	4838
query14_1	4233	4214	4222	4214
query15	218	203	178	178
query16	1019	523	471	471
query17	939	769	599	599
query18	2447	482	353	353
query19	214	188	157	157
query20	112	112	104	104
query21	246	172	138	138
query22	13662	13523	13366	13366
query23	17289	16447	16152	16152
query23_1	16359	16147	16255	16147
query24	7476	1810	1286	1286
query24_1	1332	1318	1294	1294
query25	570	481	400	400
query26	1349	359	216	216
query27	2576	612	370	370
query28	4483	1997	1989	1989
query29	1106	632	508	508
query30	347	268	234	234
query31	1115	1100	1005	1005
query32	117	67	65	65
query33	516	328	259	259
query34	1204	1155	649	649
query35	770	787	672	672
query36	1207	1164	1070	1070
query37	154	110	95	95
query38	1871	1751	1658	1658
query39	868	854	867	854
query39_1	857	843	870	843
query40	245	163	142	142
query41	72	73	78	73
query42	93	97	95	95
query43	328	323	279	279
query44	1388	761	760	760
query45	205	196	175	175
query46	1025	1236	718	718
query47	2185	2156	2075	2075
query48	398	391	272	272
query49	586	420	319	319
query50	1124	425	329	329
query51	11001	10912	10747	10747
query52	86	87	81	81
query53	257	280	203	203
query54	299	233	222	222
query55	80	75	66	66
query56	322	304	287	287
query57	1344	1317	1206	1206
query58	295	275	258	258
query59	1555	1674	1514	1514
query60	305	292	255	255
query61	148	151	187	151
query62	541	494	435	435
query63	244	203	203	203
query64	2855	1058	843	843
query65	4699	4623	4600	4600
query66	1837	506	380	380
query67	29339	29259	29145	29145
query68	3252	1503	956	956
query69	407	295	262	262
query70	1075	912	920	912
query71	387	323	310	310
query72	3033	2665	2411	2411
query73	854	745	405	405
query74	5057	4958	4748	4748
query75	2526	2521	2118	2118
query76	2334	1152	760	760
query77	361	363	283	283
query78	11894	11987	11223	11223
query79	1350	1169	770	770
query80	1284	548	462	462
query81	537	344	278	278
query82	656	156	118	118
query83	386	327	297	297
query84	336	154	129	129
query85	1039	602	508	508
query86	436	304	270	270
query87	1826	1816	1746	1746
query88	3681	2757	2749	2749
query89	437	379	324	324
query90	1934	193	195	193
query91	199	184	161	161
query92	59	59	54	54
query93	1676	1591	991	991
query94	717	338	312	312
query95	820	581	481	481
query96	1038	770	364	364
query97	2625	2611	2509	2509
query98	213	219	199	199
query99	1088	1123	983	983
Total cold run time: 264270 ms
Total hot run time: 178048 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.07 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 98978fb114e1e83e92805c5dba3d5f31cdc188b6, data reload: false
query1	0.01	0.00	0.00
query2	0.10	0.05	0.04
query3	0.28	0.14	0.14
query4	1.60	0.14	0.14
query5	0.24	0.22	0.23
query6	1.23	1.09	1.09
query7	0.04	0.01	0.01
query8	0.06	0.03	0.03
query9	0.38	0.32	0.31
query10	0.55	0.58	0.54
query11	0.19	0.13	0.14
query12	0.18	0.14	0.14
query13	0.47	0.47	0.48
query14	1.03	1.01	0.99
query15	0.61	0.61	0.61
query16	0.32	0.33	0.32
query17	1.12	1.13	1.09
query18	0.23	0.21	0.21
query19	2.05	1.96	1.89
query20	0.01	0.01	0.02
query21	15.51	0.22	0.13
query22	4.81	0.06	0.05
query23	16.10	0.30	0.12
query24	2.96	0.45	0.35
query25	0.11	0.04	0.04
query26	0.74	0.20	0.14
query27	0.04	0.04	0.03
query28	3.56	0.96	0.51
query29	12.51	4.15	3.30
query30	0.28	0.15	0.16
query31	2.77	0.59	0.32
query32	3.22	0.59	0.49
query33	3.15	3.15	3.20
query34	15.58	4.22	3.58
query35	3.59	3.54	3.54
query36	0.56	0.44	0.40
query37	0.08	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.17	0.16
query41	0.08	0.03	0.04
query42	0.05	0.03	0.03
query43	0.05	0.04	0.04
Total cold run time: 96.72 s
Total hot run time: 25.07 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 30.77% (4/13) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage58.12% (24633/42381)
Line Coverage42.18% (246135/583519)
Region Coverage38.07% (195457/513446)
Branch Coverage39.18% (88173/225051)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 30.77% (4/13) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage75.29% (31114/41326)
Line Coverage59.82% (346700/579619)
Region Coverage56.63% (291738/515199)
Branch Coverage57.95% (130422/225057)

@liaoxin01
liaoxin01 merged commit e7b7f1d into apache:masterJul 27, 2026
32 of 33 checks passed
@liaoxin01
liaoxin01 deleted the warmup-job-num-metric branch July 27, 2026 12:52
yiguolei pushed a commit that referenced this pull request Jul 29, 2026
Backport #64734 to branch-4.1.
### What problem does this PR solve?
Issue Number: None
Related PR: #64734
Problem Summary: Add the per-BE `file_cache_warm_up_job_num` bvar so
operators can see how many warm-up jobs are currently held in BE memory.
The count changes only on real job state transitions, so retry/replay
and duplicate clear requests do not skew it. The lazy cancellation
cleanup path also decrements the metric and removes the matching event
filter.
### Release note
Add the `file_cache_warm_up_job_num` BE metric.
### Check List (For Author)
- Test: Manual test
- clang-format 16 dry-run check passed for
`be/src/cloud/cloud_warm_up_manager.cpp`
- `git diff --check` passed
- Local build was not run because this target-branch worktree does not
provide `hooks/setup_worktree.sh` or `thirdparty/installed`; CI is
pending
- Behavior changed: Yes. A new per-BE warm-up job count metric is
exposed.
- Does this need documentation: No
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Aug 17, 2026
## Proposed changes
Add a `file_cache_warm_up_job_num` bvar metric that tracks the number of
warm up jobs currently held in a BE's memory. This gives operators
per-BE visibility into how many warm up jobs each backend is currently
holding.
### What changed
In `be/src/cloud/cloud_warm_up_manager.cpp`:
- New `bvar::Adder<int64_t>
g_file_cache_warm_up_job_num("file_cache_warm_up_job_num")`.
- **+1** when FE dispatches a new job to this BE:
- `check_and_set_job_id` — regular (cluster/table) warm up `SET_JOB`, on
`_cur_job_id` transition `0 -> job_id`.
- `check_and_set_batch_id` — defensive, same `0 -> job_id` transition
(e.g. if a `SET_BATCH` were to arrive first).
- `set_event` — event-driven `SET_JOB`, when a new `job_id` is inserted
into `_tablet_replica_cache`.
- **-1** when the job is cleared:
- `clear_job` — regular `CLEAR_JOB`, only when a live job actually
existed.
- `set_event` (clear) — event-driven `CLEAR_JOB`, only when
`_tablet_replica_cache.erase()` actually removed an entry.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.dev/4.1.4-mergedreviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@liaoxin01@hello-stephen@gavinchou@yiguolei