Skip to content

[fix](binlog) Require SELECT privilege for binlog TVF - #68088

Merged
morningman merged 3 commits into
apache:masterfrom
morrySnow:codex/fix-binlog-tvf-privilege
Sep 20, 2026
Merged

morningman merged 3 commits into
apache:masterfrom
morrySnow:codex/fix-binlog-tvf-privilege

Conversation

@morrySnow

@morrySnow morrySnow commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary:

The binlog() table-valued function did not implement the standard TVF authorization hook. As a result, the Nereids privilege-check phase could not enforce table privileges for the target OLAP table, and a user denied direct SELECT could still read its row-binlog contents through the TVF.

This change overrides TableBinlogFunction.checkAuth(ConnectContext) and requires SELECT on the target table. The TVF is therefore authorized through the standard CheckPrivileges flow, independently of constructor and metadata initialization.

Release note

The binlog() table-valued function now requires SELECT privilege on its target table.

Check List (For Author)

  • Test
    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason

Validation performed:

  • ./run-fe-ut.sh --run org.apache.doris.tablefunction.TableBinlogFunctionAuthTest (1 test, 0 failures; full 80-module reactor passed)

  • mvn checkstyle:check -pl fe-core (0 violations)

  • Added test_binlog_tvf_auth; validated its Groovy syntax locally. Cluster execution is left to CI.

  • Behavior changed:

    • No.
    • Yes. Unauthorized users can no longer query row-binlog content through binlog().
  • 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

### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: The binlog() table-valued function resolved and scanned its target table without checking the caller table privileges. A restricted user could therefore read row-binlog content from a table it could not query directly. Check SELECT privilege before loading table metadata so unauthorized calls return the standard table access-denied error.

### Release note

The binlog() table-valued function now requires SELECT privilege on its target table.

### Check List (For Author)

- Test: Unit Test
    - ./run-fe-ut.sh --run org.apache.doris.tablefunction.TableBinlogFunctionAuthTest
    - Added a regression test and validated its Groovy syntax locally; cluster execution is left to CI
- Behavior changed: Yes. Unauthorized users can no longer query row-binlog content through binlog().
- Does this need documentation: No
@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?

@morrySnow morrySnow changed the title [fix](fe) Require SELECT privilege for binlog TVF [fix](binlog) Require SELECT privilege for binlog TVF Sep 17, 2026
### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: The binlog() TVF privilege check should participate in the standard TVF privilege-check phase. Performing authorization in the constructor couples access control to metadata initialization and bypasses the checkAuth contract. Override checkAuth(ConnectContext) to require SELECT privilege and keep construction authorization-free.

### Release note

The binlog() TVF now performs its SELECT privilege check through the standard TVF checkAuth hook.

### Check List (For Author)

- Test: Unit Test
    - ./run-fe-ut.sh --run org.apache.doris.tablefunction.TableBinlogFunctionAuthTest
- Behavior changed: No. This preserves the SELECT requirement while moving it to the standard authorization phase.
- Does this need documentation: No
@morrySnow

Copy link
Copy Markdown
Contributor Author

run buildall

@morrySnow

Copy link
Copy Markdown
Contributor Author

/review

morningman
morningman previously approved these changes Sep 17, 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.

Automated static review completed. Requesting changes for two authorization gaps.

  • The table-level SELECT hook does not apply row filters or data masks to raw binlog rows.
  • The hook runs only during rewrite, after target metadata binding, and is skipped by DESCRIBE FUNCTION, analyzed-plan EXPLAIN, and binary prepare.

Checkpoint conclusions:

  • Goal/scope: normal-query denial is wired and the diff is focused, but authorization is incomplete for the two paths above.
  • Concurrency/lifecycle/configuration/persistence/transactions/protocol/rolling upgrade/observability: no new shared state, lock-order, lifecycle, configuration, persistence, transaction, FE-BE contract, compatibility, or observability issue was found. The name/object race was investigated and dismissed because it requires an independent privilege or policy mutation.
  • Parallel/error paths: normal execution, normal EXPLAIN, CTEs, and prepared execution reach the hook; metadata-only paths do not, and target-specific errors precede denial.
  • Tests: the direct unit test and normal deny/allow regression are structurally appropriate, but they do not cover policies or metadata-only paths. Per the review contract, I did not build or run tests; this conclusion is static-only.
  • Performance: one privilege lookup is not material.
  • Security: row/mask policy preservation remains the blocking issue described inline.

No additional user focus was supplied. Two fresh normal review passes and an adversarial pass converged with no further valuable findings.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17651	4160	3877	3877
q2	2291	347	310	310
q3	10011	1444	798	798
q4	4680	478	345	345
q5	7500	827	553	553
q6	178	169	140	140
q7	733	762	587	587
q8	9335	1506	1561	1506
q9	5400	4210	4175	4175
q10	6715	1599	1352	1352
q11	436	273	241	241
q12	633	414	292	292
q13	18036	2615	2015	2015
q14	264	250	239	239
q15	q16	733	718	662	662
q17	1826	1150	997	997
q18	6559	5592	5548	5548
q19	1345	1283	1012	1012
q20	481	395	258	258
q21	5803	3006	2663	2663
q22	469	371	308	308
Total cold run time: 101079 ms
Total hot run time: 27878 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4548	4696	4483	4483
q2	769	603	567	567
q3	4819	5189	4639	4639
q4	2245	2343	1671	1671
q5	4542	4395	4654	4395
q6	231	176	130	130
q7	1817	1688	1489	1489
q8	2339	2049	1990	1990
q9	7310	7220	7195	7195
q10	4350	4186	3788	3788
q11	516	367	343	343
q12	709	718	499	499
q13	2304	2609	2008	2008
q14	265	276	243	243
q15	q16	661	692	677	677
q17	7268	6712	6607	6607
q18	11895	11095	11845	11095
q19	1098	997	1010	997
q20	2189	2204	1906	1906
q21	5343	4425	4577	4425
q22	525	445	393	393
Total cold run time: 65743 ms
Total hot run time: 59540 ms

@hello-stephen

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

query5	4340	610	460	460
query6	429	197	167	167
query7	4800	555	275	275
query8	314	178	165	165
query9	8795	3918	3916	3916
query10	462	306	250	250
query11	5822	2177	2036	2036
query12	150	101	95	95
query13	1244	563	408	408
query14	6566	4520	4179	4179
query14_1	3987	3962	3975	3962
query15	198	201	183	183
query16	973	444	464	444
query17	906	672	526	526
query18	2412	475	337	337
query19	196	179	142	142
query20	109	104	115	104
query21	222	140	124	124
query22	13078	12903	12838	12838
query23	15504	14375	14127	14127
query23_1	14049	13962	14030	13962
query24	7614	1684	1260	1260
query24_1	1226	1226	1217	1217
query25	558	440	365	365
query26	1257	308	173	173
query27	2688	573	323	323
query28	4593	1974	1942	1942
query29	1044	610	471	471
query30	320	242	205	205
query31	903	781	656	656
query32	153	106	97	97
query33	529	321	245	245
query34	1236	1115	639	639
query35	735	783	676	676
query36	808	794	712	712
query37	145	99	84	84
query38	1817	1760	1697	1697
query39	686	681	660	660
query39_1	626	641	652	641
query40	226	116	98	98
query41	69	63	65	63
query42	91	89	84	84
query43	331	343	298	298
query44	1343	683	708	683
query45	182	179	171	171
query46	1048	1151	692	692
query47	1474	1497	1400	1400
query48	407	403	270	270
query49	587	401	286	286
query50	964	328	250	250
query51	10265	10489	10121	10121
query52	92	87	75	75
query53	237	252	176	176
query54	245	197	185	185
query55	76	73	65	65
query56	220	229	222	222
query57	1479	1341	1360	1341
query58	242	209	218	209
query59	1961	2051	1797	1797
query60	272	248	229	229
query61	149	150	141	141
query62	393	323	266	266
query63	214	178	175	175
query64	2889	986	809	809
query65	4005	3932	3938	3932
query66	1830	440	308	308
query67	20052	19972	19625	19625
query68	3222	1480	915	915
query69	408	285	258	258
query70	944	894	863	863
query71	281	234	208	208
query72	2936	2493	2201	2201
query73	836	740	449	449
query74	4647	4467	4312	4312
query75	2320	2264	1931	1931
query76	2383	1065	708	708
query77	365	398	297	297
query78	9180	9040	8365	8365
query79	1267	1256	758	758
query80	616	450	352	352
query81	457	273	242	242
query82	507	167	132	132
query83	357	271	245	245
query84	304	143	113	113
query85	867	489	440	440
query86	329	243	224	224
query87	1996	1970	1836	1836
query88	3617	2738	2706	2706
query89	367	289	246	246
query90	1877	184	181	181
query91	182	163	182	163
query92	98	87	90	87
query93	1464	1408	969	969
query94	523	344	310	310
query95	667	461	335	335
query96	1038	833	345	345
query97	2430	2456	2330	2330
query98	198	188	185	185
query99	748	728	605	605
Total cold run time: 240519 ms
Total hot run time: 153034 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.09	0.05	0.04
query3	0.25	0.15	0.14
query4	1.60	0.14	0.15
query5	0.24	0.22	0.22
query6	1.16	0.95	0.93
query7	0.04	0.01	0.00
query8	0.06	0.04	0.04
query9	0.38	0.33	0.34
query10	0.55	0.56	0.58
query11	0.20	0.15	0.15
query12	0.19	0.15	0.14
query13	0.46	0.47	0.46
query14	0.96	0.96	0.94
query15	0.60	0.58	0.58
query16	0.31	0.33	0.33
query17	1.05	1.09	1.10
query18	0.23	0.20	0.21
query19	2.01	1.98	1.92
query20	0.02	0.02	0.01
query21	15.43	0.22	0.15
query22	4.83	0.06	0.05
query23	16.14	0.30	0.12
query24	2.97	0.43	0.32
query25	0.11	0.06	0.04
query26	0.74	0.21	0.14
query27	0.04	0.04	0.03
query28	3.52	0.82	0.34
query29	12.50	4.06	3.19
query30	0.27	0.16	0.15
query31	2.77	0.55	0.32
query32	3.22	0.58	0.49
query33	3.14	3.17	3.31
query34	15.52	3.93	3.30
query35	3.24	3.24	3.22
query36	0.54	0.42	0.42
query37	0.08	0.06	0.06
query38	0.05	0.04	0.04
query39	0.03	0.03	0.03
query40	0.18	0.15	0.14
query41	0.08	0.04	0.03
query42	0.03	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 95.87 s
Total hot run time: 24.03 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (5/5) 🎉
Increment coverage report
Complete coverage report

@morrySnow

Copy link
Copy Markdown
Contributor Author

run buildall

@morrySnow

Copy link
Copy Markdown
Contributor Author

/review

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

Static exact-head review of 5afc8150539ddaaf210a5f7a479775ddbfd2bfa4. Requesting changes for one distinct authorization-compatibility issue: the new table-only decision rejects supported column-scoped SELECT and plugin COLUMNS decisions. I did not repeat the live row-filter/data-mask or pre-rewrite metadata threads.

Checkpoint conclusions:

  • Goal and correctness: the standard TVF hook closes the ordinary no-grant query path, but MAIN-001 shows that it does not preserve Doris's column authorization model.
  • Scope and control flow: all three changed files and the construction, analysis, rewrite, physical-TVF, authorization-source, and row-binlog schema paths were reviewed. Executable query, CTE/subquery, insert/CTAS, view/MV, and prepared-execution paths reach rewrite authorization; SQL result caching is disabled for TVFs.
  • Concurrency, lifecycle, and identity: no new shared state or lock-order change exists. Rename/drop/recreate, case normalization, and temporary-table resolution did not yield a distinct authorization mismatch.
  • Configuration, compatibility, and parallel paths: no configuration, FE-BE field, serialization, or rolling-upgrade surface changes. Cloud uses the same authorization route; the distinct compatibility defect is the TABLE versus COLUMNS resource decision described inline.
  • Persistence, transactions, and data writes: no new persistence, transaction, or write behavior.
  • Tests and results: the unit test proves the local hook branches and constructor behavior; the regression proves the normal no-grant and whole-table-grant paths, but neither defines or covers column/plugin decisions. This review was static-only and ran no build or test. At submission time, GitHub reports compile/checkstyle passing while FE UT and regression jobs are pending; the PR body separately reports an author-run FE unit test and Groovy syntax validation.
  • Observability and performance: denial uses the established table-access error and adds one planning-time authorization lookup, with no material performance or observability concern found.

No additional user focus was supplied. After one discovery round, a fresh full review and a separate risk-focused Round 2 both returned NO_NEW_VALUABLE_FINDINGS; the review is complete with the single distinct inline issue below.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17670	3868	3851	3851
q2	2312	355	296	296
q3	10005	1409	776	776
q4	4680	480	355	355
q5	7556	814	550	550
q6	181	176	141	141
q7	731	780	613	613
q8	9316	1721	1590	1590
q9	5429	4195	4216	4195
q10	6728	1631	1342	1342
q11	430	281	244	244
q12	640	415	309	309
q13	18093	2646	2004	2004
q14	272	256	238	238
q15	q16	728	730	658	658
q17	1638	1138	962	962
q18	6459	5564	5556	5556
q19	1339	1301	1077	1077
q20	529	387	262	262
q21	5860	2605	2240	2240
q22	405	358	295	295
Total cold run time: 101001 ms
Total hot run time: 27554 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4225	4079	4055	4055
q2	741	606	571	571
q3	4609	4948	4362	4362
q4	2208	2283	1429	1429
q5	4180	4085	4057	4057
q6	219	169	129	129
q7	1646	1580	1387	1387
q8	2257	1861	1840	1840
q9	6875	6835	6847	6835
q10	4223	4208	3808	3808
q11	523	372	350	350
q12	709	735	585	585
q13	2325	2647	2012	2012
q14	276	286	250	250
q15	q16	670	688	600	600
q17	7250	6682	6664	6664
q18	11818	11111	11665	11111
q19	1114	999	1051	999
q20	2198	2193	1912	1912
q21	5282	4564	4528	4528
q22	509	446	422	422
Total cold run time: 63857 ms
Total hot run time: 57906 ms

@hello-stephen

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

query5	4321	587	441	441
query6	425	187	162	162
query7	4827	546	298	298
query8	328	170	183	170
query9	8789	3999	4008	3999
query10	440	310	262	262
query11	5809	2202	1976	1976
query12	150	99	96	96
query13	1229	567	407	407
query14	6470	4572	4257	4257
query14_1	3997	3981	3981	3981
query15	210	200	178	178
query16	999	476	451	451
query17	1078	683	549	549
query18	2439	451	330	330
query19	222	175	149	149
query20	111	103	104	103
query21	225	137	114	114
query22	12985	12948	12835	12835
query23	15509	14630	13989	13989
query23_1	14084	14091	14161	14091
query24	7459	1723	1226	1226
query24_1	1268	1241	1228	1228
query25	538	427	364	364
query26	1246	312	175	175
query27	2691	522	323	323
query28	4557	1971	1955	1955
query29	1071	582	469	469
query30	325	231	196	196
query31	878	763	623	623
query32	137	92	95	92
query33	537	322	247	247
query34	1224	1141	638	638
query35	724	749	657	657
query36	805	810	732	732
query37	148	102	92	92
query38	1831	1760	1700	1700
query39	682	684	650	650
query39_1	653	680	648	648
query40	226	120	118	118
query41	72	69	69	69
query42	95	93	92	92
query43	347	340	291	291
query44	1370	699	696	696
query45	188	183	175	175
query46	1054	1153	734	734
query47	1490	1522	1400	1400
query48	419	420	290	290
query49	603	402	341	341
query50	960	330	241	241
query51	10553	10365	10295	10295
query52	83	92	73	73
query53	231	242	176	176
query54	253	202	210	202
query55	77	75	68	68
query56	238	207	214	207
query57	1439	1445	1381	1381
query58	237	208	211	208
query59	2004	2058	1804	1804
query60	271	233	218	218
query61	139	139	147	139
query62	402	320	264	264
query63	215	172	170	170
query64	2790	1038	824	824
query65	4018	3960	3929	3929
query66	1828	433	297	297
query67	20072	19912	19738	19738
query68	3328	1555	910	910
query69	396	297	245	245
query70	952	878	858	858
query71	304	236	210	210
query72	2929	2503	2214	2214
query73	802	761	437	437
query74	4646	4501	4297	4297
query75	2290	2266	1930	1930
query76	2307	1119	685	685
query77	360	396	285	285
query78	9109	9128	8522	8522
query79	1374	1131	733	733
query80	789	463	359	359
query81	498	281	241	241
query82	628	157	125	125
query83	337	267	236	236
query84	267	139	114	114
query85	950	472	373	373
query86	382	240	227	227
query87	2007	1983	1835	1835
query88	3634	2747	2699	2699
query89	356	283	240	240
query90	1751	178	174	174
query91	172	152	128	128
query92	96	89	84	84
query93	1551	1411	887	887
query94	604	345	289	289
query95	669	445	332	332
query96	995	802	349	349
query97	2436	2446	2273	2273
query98	195	187	191	187
query99	743	719	602	602
Total cold run time: 241237 ms
Total hot run time: 153505 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.09	0.04	0.04
query3	0.26	0.14	0.14
query4	1.61	0.14	0.14
query5	0.25	0.23	0.22
query6	1.16	0.92	0.93
query7	0.04	0.01	0.00
query8	0.05	0.04	0.04
query9	0.39	0.34	0.34
query10	0.55	0.54	0.56
query11	0.20	0.14	0.15
query12	0.18	0.14	0.15
query13	0.46	0.46	0.47
query14	0.94	0.94	0.95
query15	0.60	0.58	0.60
query16	0.33	0.33	0.34
query17	1.08	1.12	1.12
query18	0.22	0.20	0.20
query19	1.99	1.95	1.97
query20	0.02	0.02	0.01
query21	15.46	0.17	0.13
query22	5.03	0.06	0.05
query23	16.11	0.30	0.12
query24	3.03	0.41	0.31
query25	0.11	0.05	0.04
query26	0.75	0.20	0.14
query27	0.03	0.03	0.04
query28	3.54	0.75	0.36
query29	12.52	4.05	3.18
query30	0.29	0.15	0.15
query31	2.77	0.55	0.31
query32	3.22	0.59	0.49
query33	3.15	3.18	3.15
query34	15.59	3.94	3.27
query35	3.28	3.24	3.25
query36	0.56	0.42	0.42
query37	0.10	0.06	0.06
query38	0.05	0.03	0.03
query39	0.04	0.03	0.03
query40	0.17	0.15	0.14
query41	0.08	0.03	0.02
query42	0.04	0.03	0.04
query43	0.04	0.03	0.04
Total cold run time: 96.38 s
Total hot run time: 23.98 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (5/5) 🎉
Increment coverage report
Complete coverage report

@morningman
morningman merged commit 3de3a75 into apache:master Sep 20, 2026
37 of 38 checks passed
@morrySnow
morrySnow deleted the codex/fix-binlog-tvf-privilege branch September 20, 2026 03:14
morningman added a commit that referenced this pull request Sep 20, 2026
…on PRs from master in merge order (#67820 #68088) (#68236)

Cherry-picked from #67820, #68088

Batch pick of every merged PR carrying the `incremental-computation`
label that `branch-incremental-computation` does not have yet (no
`incremental-computation-picked` label), in the order they landed on
master (`git log --first-parent`). One commit per PR, each ending with
`(cherry picked from commit <master sha>)`. Follows the same convention
as #67830, #68017, #68073 and #68151.

| # | Master commit | PR | Title |
|---|---|---|---|
| 1 | 44e3ae2 | #67820 | [fix](binlog) Track committed TSO and fence
uncertain commits for bounded incremental reads |
| 2 | 3de3a75 | #68088 | [fix](binlog) Require SELECT privilege for
binlog TVF |

Not included on purpose:
- The 25 labelled PRs that already carry
`incremental-computation-picked`.
- #68012 carries the label but is a PR against this branch itself
(merged as `6f7c87fa892`); nothing to pick.

### How #67820 was picked

This branch already carried #67820 through #67861, which backported the
PR's first seven commits (up to `17272039558`) before the PR was merged.
Between that cut and the merge the PR gained six more commits and five
master merges, and the final design differs from what #67861 brought:
the Meta Service recovery RPC (`get_tso_recovery_transactions`) and the
FE startup/periodic recovery scan are gone, replaced by a durable
per-instance commit-TSO fence (`txn_tso_fence_key`, `advance_tso_fence`,
commit-time `TXN_COMMIT_TSO_EXPIRED` check,
`enable_check_commit_tso_fence`), plus the review-feedback and "release
maybe-committed TSO" fixes.

A plain `cherry-pick -x 44e3ae2` conflicts in 23 files because the
branch holds the intermediate design, so commit 1 was built by
replaying, on top of the branch, exactly what the PR gained after the
cut:
- the PR's later commits `d16e67197b2`, `e53291d196b`, `864546d5531`,
`8c55eb086e9`, `8d264ce294a`, `fc4f9969202`;
- the content that landed inside its master merges, identified by
diffing each merge against its `git merge-tree` automerge result:
`c491a293426` (`setEnvTSOService` replaced by
`Mockito.doReturn(tsoService).when(masterEnv).getTSOService()` —
`masterEnv` is the same Mockito delegating mock here since #67813) and
`29f133584b5` (the extra `TSOTransactionTrackerTest` coverage and two
comment removals in `DorisFlightSqlProducer`). The other three merges
only resolved import blocks against master-only code.

The replay then got squashed into one commit with the master PR's
message, the original author, and the `(cherry picked from commit
44e3ae2)` trailer. Adaptations, all
recorded in the commit message:
- `DorisFlightSqlProducer` / `DorisFlightSqlProducerTest` stay under
`service/arrowflight` (the branch lacks the package move of #67866).
- `8d264ce294a` is a no-op here: it removes a `catch
(FlightRuntimeException)` block that #67883 added on master and this
branch never had.
- The branch-only `get_tso_recovery_transactions` RPC, its recovery
scan, the five `TsoRecovery*` Meta Service tests and the NOLINT
suppressions #67861 had added for them are removed, as on master.
- The round-3 `mockVersionHelper()` adaptation in
`CloudGlobalTransactionMgrTest` (no
`VersionHelper.getVersionFromMeta(req, maxAttempts)` overload here,
#66296) is kept.

### Prerequisite check

- **#67820** declares #67181 and #67594 as related; #67181
(`e5a4e725fac`) is before the fork point and #67594 came with #67830.
The rest of what the commit touches on master is import-block and
neighbouring-code drift from unlabelled commits (#67866 / #67883 /
#67966 Arrow Flight and session refactors, #67761
`get_prepare_txn_by_coordinator`, #66598 pre-rowset delete bitmaps,
repair-tablet-index changes); none of it is used by the
fence/committed-TSO logic.
- **#68088** declares no related PR. The hook it implements
(`TableValuedFunctionIf.checkAuth`) and the caller chain
(`CheckPrivileges.visitLogicalTVFRelation` →
`TableValuedFunction.checkAuth` → catalog function) are byte-identical
between this branch and master, and the five-argument
`AccessControllerManager.checkTblPriv` overload exists. Applied cleanly.

### Drift check against master

- **#67820**: every one of the 54 files the master commit touches now
contains the pick's content — the master commit reverse-applies cleanly
per file onto this branch (50 files), and the four files where only the
surrounding context differs (`config.h`, `meta_service_txn.cpp`,
`StmtExecutor.java`, `StmtExecutorTest.java`) contain every added line
and none of the removed ones. 33 of the 54 files are byte-identical to
master at `44e3ae2b951`, including all of `fe/.../tso/`,
`CloudGlobalTransactionMgr.java`, `MetaServiceProxy.java`,
`keys.{h,cpp}`, `meta_service.h` and the regression suite/output. The
remaining differences are unrelated master-only or branch-only code from
unlabelled commits (#67761, #66598, #67866/#67883/#67966,
repair-tablet-index, meta-cache columns, recycler configs) plus the
documented `mockVersionHelper()` adaptation; no line in the
committed-TSO/fence domain is left over from #67861.
- **#68088**: all three files are byte-identical to master at
`3de3a756f74`.

### Verification

- FE: `run-fe-ut.sh --run` on this branch (regenerates thrift/protobuf,
compiles fe-core main + test) with every test class the picks touch: 12
classes, 175 tests, 0 failures, 0 errors, BUILD SUCCESS —
`TSOServiceTest` 38, `CloudGlobalTransactionMgrTest` 37,
`StmtExecutorTest` 27, `MetaServiceProxyTest` 22, `OlapScanNodeTest` 12,
`TimeBasedChangeVisibleWaiterTest` 12, `TSOTransactionTrackerTest` 9
(the four tests added inside the PR's last master merge included),
`DorisFlightSqlProducerTest` 7, `TsoStatusMetadataGeneratorTest` 5,
`CloudCommittedTsoTest` 3, `SchemaTableTest` 2,
`TableBinlogFunctionAuthTest` 1 (#68088). The `@Test` counts of the
touched classes equal master's.
- FE checkstyle on fe-core: 0 violations.
- Meta Service: `-fsyntax-only` with the flags of `cloud/CMakeLists.txt`
(`-Wall -Werror`, regenerated `gen_cpp/cloud.pb.h` with
`AdvanceTsoFence*` / `TxnTsoFencePB` and without
`GetTsoRecoveryTransactions*`) on `meta_service_txn.cpp`, `keys.cpp`,
`http_encode_key.cpp`, `bvars.cpp` and, with `-DUNIT_TEST -DBE_TEST
-fno-access-control`, on `meta_service_test.cpp`, `keys_test.cpp`,
`http_encode_key_test.cpp`, `meta_service_helper_test.cpp`,
`txn_lazy_commit_test.cpp`: no diagnostic in any line the pick touches
(the only errors are the pre-existing macOS-only `pthread_setname_np` /
`int64_t`-vs-`long` ones in untouched 2024/2025 code). clang-format 16
is clean on all 14 touched cloud files.
- No BE file changes in this round (the BE side of #67820 was already
byte-identical to master via #67861).
- The new `auth_p0/test_binlog_tvf_auth.groovy` and the two #67820
suites parse cleanly (groovy parser check).

---------

Co-authored-by: Luwei <814383175@qq.com>
Co-authored-by: morrySnow <zhangwenxin@selectdb.com>
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.

3 participants