Skip to content

[fix](orc) handle cancellation during condition cache seek - #67141

Open
Gabriel39 wants to merge 1 commit into
apache:masterfrom
Gabriel39:fix/orc-condition-cache-cancel
Open

[fix](orc) handle cancellation during condition cache seek#67141
Gabriel39 wants to merge 1 commit into
apache:masterfrom
Gabriel39:fix/orc-condition-cache-cancel

Conversation

@Gabriel39

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: DORIS-28199

Problem Summary:

Condition-cache granule skipping can call ORC seekToRow before the existing nextBatch exception boundary. When a query is cancelled during that I/O, the ORC input stream throws a stop exception that escapes get_block and may terminate the BE process.

Release note

Fix BE process termination when an ORC scan is cancelled during condition-cache seeking.

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test
    • No need to test or manual test.

    Verification: NewOrcReaderTest.* passed 163/163 under ASAN_UT. Clang-format 16 passed for both affected C++ files.

  • Behavior changed:

    • No.
    • Yes. Cancellation during a condition-cache seek now returns clean EOF instead of allowing the ORC stop exception to escape.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

Condition-cache granule skipping may perform ORC I/O before nextBatch. Keep those seeks inside the existing cancellation boundary so a stop exception returns clean EOF instead of escaping.

Add a deterministic regression test for cancellation during seek.

Jira: DORIS-28199
@Gabriel39
Gabriel39 requested a review from yiguolei as a code owner August 26, 2026 02:22
@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?

@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/review

@Gabriel39 Gabriel39 changed the title fix(orc): handle cancellation during condition cache seek [fix](orc) handle cancellation during condition cache seek Aug 26, 2026

@github-actions github-actions Bot 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 result: no actionable code findings. The implementation is suitable for approval, subject to the remaining required CI checks.

Critical checkpoint conclusions:

  • Goal and proof: The change prevents a cancellation exception raised during a condition-cache seekToRow() from escaping OrcReader::get_block(). The focused BE unit test enters that exact cancellation window and verifies OK status, clean EOF, zero rows, and an empty block.
  • Scope and clarity: The production change is narrowly limited to moving condition-cache seeking into the existing ORC stop-aware exception boundary; the added debug hook exists only to exercise that boundary in the regression test.
  • Concurrency and lifecycle: No new threads, locks, shared ownership, or static initialization are introduced. On cancellation, output is cleared, _eof becomes terminal, successful-seek cursor/counter updates are skipped, and TableReader does not publish an incompletely visited condition-cache result.
  • Error semantics and parallel paths: All three condition-cache seek branches now share the boundary. Only the exact production stop signal (should_stop plus "stop") becomes clean EOF; other ORC exceptions remain non-OK failures. This matches the established v1 ORC behavior.
  • Compatibility and configuration: No storage format, schema, FE/BE protocol, persisted metadata, configuration, rolling-upgrade, SARG, Split/stripe, delete, or residual-predicate contract changes.
  • Performance and observability: The widened try adds no material work. Existing filtered-row accounting changes only after successful seeks, and non-cancellation errors retain their reason. No additional metric or log is needed for the expected cancellation path.
  • Test and gate status: The focused unit coverage is appropriate and adjacent tests cover ordinary condition-cache skipping and pre-read cancellation. Clang Formatter and the corrected PR-title check pass. BE UT, compile, and performance checks were still pending at review time; no builds or tests were rerun in this review-only runner.
  • Transactions, writes, persistence, and new FE/BE variables: Not applicable to this reader-only cancellation fix.
  • User focus: No additional focus was provided. One normal full-review agent and one separate risk-focused agent both returned NO_NEW_VALUABLE_FINDINGS in round 1 after rechecking missed paths.

Completion status: complete for code review at head cc7590f1b1e23cff10780613ec2e5817e7a8ba5c. No inline comments or critical code blockers were found; merge remains subject to the pending required CI checks.

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 16993 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit cc7590f1b1e23cff10780613ec2e5817e7a8ba5c, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17572	3111	3147	3111
q2	2405	267	231	231
q3	9991	930	519	519
q4	4674	262	198	198
q5	7676	572	398	398
q6	141	115	100	100
q7	543	503	390	390
q8	9253	884	904	884
q9	3499	2405	2387	2387
q10	6486	865	707	707
q11	419	198	182	182
q12	631	255	196	196
q13	18131	1540	1182	1182
q14	160	150	137	137
q15	q16	434	396	364	364
q17	1425	835	801	801
q18	3135	2242	2247	2242
q19	1113	872	733	733
q20	361	280	202	202
q21	5291	1797	1902	1797
q22	337	268	232	232
Total cold run time: 93677 ms
Total hot run time: 16993 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3524	3445	3429	3429
q2	528	413	365	365
q3	2219	2338	2288	2288
q4	1194	1167	913	913
q5	2194	2133	2119	2119
q6	172	120	87	87
q7	1065	934	849	849
q8	1623	1419	1435	1419
q9	3149	3141	3113	3113
q10	1852	1785	1621	1621
q11	366	277	260	260
q12	452	435	348	348
q13	1496	1535	1181	1181
q14	171	162	153	153
q15	q16	395	394	356	356
q17	3575	3284	3223	3223
q18	4900	4452	4856	4452
q19	4623	883	854	854
q20	972	932	824	824
q21	3827	3033	3278	3033
q22	404	352	335	335
Total cold run time: 38701 ms
Total hot run time: 31222 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 82478 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 cc7590f1b1e23cff10780613ec2e5817e7a8ba5c, data reload: false

query5	4285	412	333	333
query6	433	137	123	123
query7	4908	434	243	243
query8	351	122	117	117
query9	8698	2895	2912	2895
query10	407	224	184	184
query11	5462	1030	904	904
query12	125	70	73	70
query13	1201	456	315	315
query14	6042	2191	2082	2082
query14_1	1997	1980	1974	1974
query15	182	119	114	114
query16	972	385	360	360
query17	871	459	372	372
query18	2357	329	241	241
query19	194	140	114	114
query20	74	69	69	69
query21	214	106	88	88
query22	5578	5373	5344	5344
query23	6538	6193	6061	6061
query23_1	6143	6214	6183	6183
query24	7360	1092	782	782
query24_1	784	742	772	742
query25	521	311	260	260
query26	1312	236	139	139
query27	2715	416	260	260
query28	4703	1502	1494	1494
query29	1094	467	368	368
query30	287	155	129	129
query31	849	403	333	333
query32	185	71	72	71
query33	539	230	192	192
query34	1134	850	473	473
query35	413	410	350	350
query36	591	570	501	501
query37	133	84	74	74
query38	1102	853	794	794
query39	509	474	463	463
query39_1	455	458	457	457
query40	262	97	79	79
query41	58	56	57	56
query42	75	72	71	71
query43	250	244	222	222
query44	1141	541	559	541
query45	116	108	98	98
query46	832	862	524	524
query47	761	781	722	722
query48	309	305	217	217
query49	606	232	181	181
query50	763	267	194	194
query51	8336	8204	8158	8158
query52	69	65	62	62
query53	192	218	196	196
query54	300	177	195	177
query55	94	61	54	54
query56	246	164	161	161
query57	690	671	664	664
query58	253	166	160	160
query59	1220	1243	1091	1091
query60	294	180	160	160
query61	117	117	128	117
query62	573	203	181	181
query63	168	142	142	142
query64	2907	674	681	674
query65	1699	1685	1549	1549
query66	1878	284	218	218
query67	10132	9677	9643	9643
query68	2782	1235	747	747
query69	415	223	182	182
query70	661	643	609	609
query71	283	191	166	166
query72	2508	1798	1577	1577
query73	782	565	338	338
query74	1858	1223	1121	1121
query75	1179	1103	966	966
query76	2317	748	542	542
query77	255	259	219	219
query78	4028	3957	3264	3264
query79	2331	824	608	608
query80	1588	336	278	278
query81	501	155	139	139
query82	1048	133	94	94
query83	295	209	186	186
query84	305	116	89	89
query85	889	376	286	286
query86	598	177	173	173
query87	1030	968	895	895
query88	2888	2096	2098	2096
query89	342	197	175	175
query90	2019	130	119	119
query91	135	122	115	115
query92	81	69	72	69
query93	1725	1138	671	671
query94	880	255	209	209
query95	603	321	241	241
query96	839	595	287	287
query97	1055	1063	1005	1005
query98	169	137	133	133
query99	514	357	306	306
Total cold run time: 182448 ms
Total hot run time: 82478 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 15.01 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit cc7590f1b1e23cff10780613ec2e5817e7a8ba5c, data reload: false

query1	0.01	0.00	0.00
query2	0.09	0.04	0.03
query3	0.25	0.12	0.11
query4	1.61	0.10	0.10
query5	0.17	0.16	0.16
query6	1.20	0.70	0.68
query7	0.04	0.00	0.00
query8	0.06	0.03	0.03
query9	0.30	0.21	0.23
query10	0.34	0.34	0.36
query11	0.17	0.11	0.11
query12	0.16	0.12	0.11
query13	0.31	0.30	0.30
query14	0.48	0.46	0.45
query15	0.37	0.35	0.35
query16	0.22	0.23	0.23
query17	0.68	0.71	0.70
query18	0.18	0.17	0.16
query19	1.20	1.13	1.18
query20	0.02	0.01	0.01
query21	15.52	0.15	0.12
query22	5.00	0.04	0.04
query23	16.14	0.26	0.10
query24	3.69	0.36	0.35
query25	0.14	0.06	0.04
query26	0.87	0.16	0.13
query27	0.04	0.03	0.04
query28	3.46	0.61	0.33
query29	12.41	3.18	2.56
query30	0.30	0.12	0.12
query31	2.76	0.37	0.18
query32	3.47	0.32	0.24
query33	1.51	1.53	1.55
query34	15.37	2.13	1.78
query35	1.72	1.72	1.73
query36	0.56	0.31	0.30
query37	0.08	0.04	0.04
query38	0.05	0.03	0.03
query39	0.04	0.02	0.02
query40	0.13	0.07	0.08
query41	0.08	0.02	0.02
query42	0.04	0.03	0.02
query43	0.04	0.03	0.03
Total cold run time: 91.28 s
Total hot run time: 15.01 s

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.

2 participants