Skip to content

[fix](build) Run copy-dependencies on a build-cache hit so a cache-restored BE plugin still deploys its dependencies - #68000

Merged
CalvinKirs merged 1 commit into
apache:masterfrom
morningman:fix-plugin-lib-under-build-cache
Sep 15, 2026
Merged

CalvinKirs merged 1 commit into
apache:masterfrom
morningman:fix-plugin-lib-under-build-cache

Conversation

@morningman

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #66729 (the plugin layout this breaks under the build cache), #60964 (the hadoop-deps-only fallback this removes)

Problem Summary:

Since #66729 merged (2026-09-15 10:52 CST), the TeamCity Compile step fails for one PR after another with a few hundred closure-self-contained problems from check_plugin_layout.py, e.g. build 121702 (pull/67966), 121701 / 121695 (pull/67551), 121700 / 121689 (pull/67675):

checking hudi                 1 jars
checking iceberg              1 jars
checking java-udf            28 jars
checking java-writer          1 jars
checking jdbc                 1 jars
checking max-compute          1 jars
checking paimon               1 jars
checking trino-connector      1 jars
322 problem(s):
[closure-self-contained] plugin 'trino-connector': io.trino.SystemSessionProperties is referenced by org.apache.doris.trinoconnector.TrinoConnectorJniScanner but is in no jar of this plugin directory. ...
Error: the plugin tree just deployed breaks the isolation rules; see above.

(The output/ms missing error the CI wrapper prints afterwards is a symptom: build.sh exits at the plugin check, before it copies cloud/output to output/ms.)

Root cause. Every BE Java extension now deploys as a thin module jar plus the runtime closure that maven-dependency-plugin:copy-dependencies writes to target/lib at the package phase, and build.sh copies that directory verbatim into plugins/jni/<name>. The Maven build cache restores a module's jar on a hit and nothing else — the log says so outright:

Found cached build, restoring org.apache.doris:hadoop-hudi-scanner from cache by checksum c6118376d1a7c373
Skipping plugin execution (cached): clean:clean
Skipping plugin execution (cached): jar:jar
Skipping plugin execution (cached): dependency:copy-dependencies

On a working copy that is harmless, because target/lib is still there from the module's last real build — which is what the comment in be-java-extensions/pom.xml relied on. CI is the opposite case: TeamCity runs git clean -f -d -x before every build, so target/ is always fresh, while /home/work/.m2 (build cache included) is mounted from the host and survives. So the first build on each agent after #66729 built the plugins for real and seeded the cache (e.g. 121674 on agent 172.16.0.115: hudi 238 / iceberg 148 / jdbc 13 / paimon 155 / trino 99 jars, green), and the very next build on the same agent (121702, same checksums, Found cached build, restoring ...) deployed each plugin as a single jar and failed. Only a module whose inputs the PR happened to touch — java-udf behind a Config.java change, since it depends on fe-common — was rebuilt and came out whole, which is why the count is 322 problems for some PRs and 352 for others.

Fix. Force the goal under runAlways in fe/.mvn/maven-build-cache-config.xml, the same mechanism that already keeps checkstyle running on a cache hit. It is matched by goal rather than execution id so the plugins' copy-plugin-dependencies and hadoop-deps' copy-dependencies are covered alike, and so is any module that adds the goal later. The wipe-plugin-lib clean execution that precedes it is forced too: the two exist as a pair, and a copy without the wipe would deploy the union of every dependency set the directory has ever held. Forcing the goal costs a copy out of the local repository; the alternative — keeping the closure in the cache as attached outputs — would store hundreds of jars per plugin per checksum.

build.sh had a fallback for exactly this, for hadoop-deps only (#60964): re-run the goal from the command line when target/lib was missing. It goes, for two reasons. The forced execution covers hadoop-deps as well; and the fallback ran the goal without the pom's runtime-scope filter, so the be/lib/hadoop_hdfs/lib it produced carried the test-scope closure — the JUnit 5 stack, hamcrest, awaitility, opentest4j, plus provided-scope zookeeper and the netty QUIC natives — in every CI build where hadoop-deps hit the cache (167 jars, where the pom's execution yields 149; build 121702 shows the junit jars being copied into output/be/lib/hadoop_hdfs/lib/).

The comment in be-java-extensions/pom.xml that described the old (wrong) assumption is corrected to point at the forced executions.

Release note

None

Check List (For Author)

  • Test

    • Manual test (add detailed scripts or steps below)

      On master@846d9b2ebfc, cd fe && mvn -pl be-java-extensions/jdbc-scanner,be-java-extensions/hadoop-deps -am package -DskipTests -Dcheckstyle.skip=true, simulating CI's git clean -fdx with rm -rf of the modules' target/ between runs:

      run config jdbc-scanner hadoop-deps
      1 – real build (seeds cache) old Local build was not found by checksum 2c03b13c59c59c7btarget/lib 12 jars
      2 – rm target, rebuild old Found cached build, restoring ... 2c03b13c59c59c7b, Skipping plugin execution (cached): dependency:copy-dependenciestarget/ holds only jdbc-scanner.jar, no lib (the CI failure)
      3 – rm target, rebuild new same cache hit, Mojo execution is forced by project property: clean:clean / dependency:copy-dependenciestarget/lib 12 jars, byte-for-byte the same list as run 1 real build, 149 jars
      4 – rm target, rebuild new cache hit, 12 jars, same list Found cached build, restoring ... 7df78f352270b07a, forced copy → 149 jars, same list as run 3

      The config change does not alter module checksums (run 3 hits the entry run 1 wrote), so existing cache entries on the CI agents keep being used and simply regain their target/lib.

  • Behavior changed:

    • No.
  • Does this need documentation?

    • No.

Check List (For Reviewer who merge this PR)

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ja986K4PEm2LD8u44L9jd2

…stored BE plugin still deploys its dependencies

Since apache#66729 every BE Java extension deploys as a thin module jar plus the
runtime closure that maven-dependency-plugin:copy-dependencies writes to
target/lib at the package phase; build.sh copies that directory verbatim
into plugins/jni/<name>. The Maven build cache restores a module's jar on
a hit and nothing else - the log says so outright,
"Skipping plugin execution (cached): dependency:copy-dependencies" - so a
cache-restored plugin has no target/lib at all.

On a working copy that is harmless: target/lib is still there from the
module's last real build, which is what the comment in
be-java-extensions/pom.xml relied on. CI is the opposite case. TeamCity
runs `git clean -f -d -x` before every build, so target/ is always fresh,
while /home/work/.m2 - build-cache included - is mounted from the host
and survives. The first build on an agent after apache#66729 built the plugins
for real and seeded the cache; every later build on that agent restored
the thin jars, deployed each plugin as a single jar, and failed
check_plugin_layout.py's closure-self-contained rule with a few hundred
"is in no jar of this plugin directory" problems (Compile builds 121702,
121701, 121700, 121695, 121689 on 2026-09-15, one PR after another).
Only a module whose inputs the PR happened to touch, such as java-udf
behind a Config.java change, was rebuilt and came out whole.

Force the goal under runAlways in fe/.mvn/maven-build-cache-config.xml,
the same mechanism that already keeps checkstyle running on a cache hit.
It is matched by goal rather than execution id so the plugins'
copy-plugin-dependencies and hadoop-deps' copy-dependencies are covered
alike, and so is any module that adds the goal later. The wipe-plugin-lib
clean execution that precedes it is forced too: the two exist as a pair,
and a copy without the wipe would deploy the union of every dependency
set the directory has ever held. Forcing the goal costs a copy out of the
local repository; the alternative, keeping the closure in the cache as
attached outputs, would store hundreds of jars per plugin per checksum.

build.sh had a fallback for exactly this for hadoop-deps only (apache#60964),
re-running the goal from the command line when target/lib was missing.
It goes: the forced execution covers hadoop-deps as well, and the
fallback ran the goal without the pom's runtime-scope filter, so the
be/lib/hadoop_hdfs/lib it produced carried the test-scope closure - the
JUnit 5 stack, hamcrest, awaitility, opentest4j - in every CI build where
hadoop-deps hit the cache (167 jars where the pom's execution yields 149).

Verified locally on master@846d9b2ebfc with jdbc-scanner and hadoop-deps:
a real build (12 and 149 jars in target/lib), then rm -rf target and a
rebuild with the old config restores the module from the cache and leaves
target/ holding only the jar; the same rebuild with this config logs
"Mojo execution is forced by project property: dependency:copy-dependencies"
and refills target/lib with the identical 12 and 149 jars.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ja986K4PEm2LD8u44L9jd2
@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?

@morningman

Copy link
Copy Markdown
Contributor Author

run buildall

@airborne12 airborne12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17583	3036	3035	3035
q2	2105	264	221	221
q3	10227	862	534	534
q4	4672	245	208	208
q5	7682	564	381	381
q6	135	115	94	94
q7	526	505	380	380
q8	9238	892	886	886
q9	3529	2399	2402	2399
q10	6526	854	750	750
q11	416	199	181	181
q12	616	260	196	196
q13	18133	1544	1164	1164
q14	163	157	140	140
q15	q16	460	401	371	371
q17	1414	897	798	798
q18	3042	2242	2216	2216
q19	1141	838	723	723
q20	378	286	205	205
q21	5343	1848	1907	1848
q22	319	268	231	231
Total cold run time: 93648 ms
Total hot run time: 16961 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3394	3352	3311	3311
q2	498	399	377	377
q3	2220	2285	2151	2151
q4	1190	1163	886	886
q5	2201	2118	2115	2115
q6	174	123	88	88
q7	1023	938	842	842
q8	1615	1417	1419	1417
q9	3142	3114	3104	3104
q10	1842	1789	1627	1627
q11	357	269	248	248
q12	450	426	335	335
q13	1492	1526	1148	1148
q14	175	178	163	163
q15	q16	397	396	359	359
q17	3683	3411	3321	3321
q18	4823	4431	4776	4431
q19	868	897	882	882
q20	1013	963	850	850
q21	3844	3184	3186	3184
q22	411	345	323	323
Total cold run time: 34812 ms
Total hot run time: 31162 ms

@hello-stephen

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

query5	4268	430	333	333
query6	400	141	128	128
query7	4915	416	229	229
query8	300	133	125	125
query9	8693	2909	2905	2905
query10	391	221	184	184
query11	5404	1028	907	907
query12	120	74	70	70
query13	1193	456	323	323
query14	6077	2200	2079	2079
query14_1	1977	1977	1970	1970
query15	191	121	108	108
query16	928	380	333	333
query17	796	449	339	339
query18	2329	325	224	224
query19	158	136	103	103
query20	74	68	71	68
query21	197	98	88	88
query22	5309	5385	5260	5260
query23	6707	6228	6073	6073
query23_1	6018	6099	6082	6082
query24	7265	1081	766	766
query24_1	759	775	771	771
query25	417	280	242	242
query26	1217	232	131	131
query27	2782	418	255	255
query28	4698	1479	1493	1479
query29	920	419	329	329
query30	259	154	126	126
query31	822	414	336	336
query32	133	69	80	69
query33	466	220	184	184
query34	1009	831	485	485
query35	399	389	332	332
query36	578	562	540	540
query37	117	80	73	73
query38	1010	850	844	844
query39	508	479	489	479
query39_1	466	455	486	455
query40	207	93	82	82
query41	58	57	57	57
query42	75	73	77	73
query43	248	239	216	216
query44	1011	548	548	548
query45	114	106	103	103
query46	810	830	532	532
query47	745	773	714	714
query48	311	325	237	237
query49	552	240	190	190
query50	741	268	199	199
query51	8195	8084	8092	8084
query52	73	70	62	62
query53	193	199	155	155
query54	213	182	168	168
query55	108	56	54	54
query56	206	178	151	151
query57	667	669	646	646
query58	220	187	208	187
query59	1207	1226	1091	1091
query60	240	190	191	190
query61	109	104	115	104
query62	364	206	177	177
query63	177	140	143	140
query64	2765	734	608	608
query65	1607	1595	1581	1581
query66	1904	309	224	224
query67	9822	9635	10171	9635
query68	2750	1176	745	745
query69	347	222	192	192
query70	681	608	601	601
query71	252	178	166	166
query72	2270	1637	1516	1516
query73	660	583	359	359
query74	1584	1223	1148	1148
query75	1178	1113	972	972
query76	2298	708	545	545
query77	257	249	215	215
query78	4000	3723	3247	3247
query79	1591	829	552	552
query80	1156	317	290	290
query81	488	157	136	136
query82	991	127	96	96
query83	277	213	196	196
query84	294	110	88	88
query85	784	342	279	279
query86	410	184	164	164
query87	1026	972	895	895
query88	2765	2117	2125	2117
query89	284	198	177	177
query90	1987	133	130	130
query91	135	124	96	96
query92	79	72	70	70
query93	1421	1064	756	756
query94	669	264	229	229
query95	527	253	230	230
query96	849	559	275	275
query97	1049	1042	1008	1008
query98	150	134	141	134
query99	423	343	306	306
Total cold run time: 176248 ms
Total hot run time: 82165 ms

@hello-stephen

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

query1	0.00	0.01	0.00
query2	0.08	0.04	0.04
query3	0.25	0.11	0.11
query4	1.62	0.10	0.11
query5	0.17	0.16	0.16
query6	1.24	0.68	0.69
query7	0.03	0.01	0.01
query8	0.05	0.03	0.03
query9	0.29	0.21	0.21
query10	0.38	0.35	0.35
query11	0.17	0.11	0.11
query12	0.15	0.12	0.13
query13	0.30	0.30	0.31
query14	0.46	0.46	0.44
query15	0.36	0.36	0.35
query16	0.25	0.23	0.21
query17	0.65	0.69	0.69
query18	0.18	0.17	0.17
query19	1.21	1.11	1.20
query20	0.01	0.01	0.01
query21	15.44	0.16	0.12
query22	5.07	0.05	0.04
query23	16.17	0.25	0.09
query24	2.90	0.33	0.24
query25	0.12	0.04	0.04
query26	0.76	0.17	0.11
query27	0.04	0.03	0.03
query28	3.67	0.58	0.28
query29	12.43	3.17	2.59
query30	0.25	0.11	0.13
query31	2.76	0.36	0.16
query32	3.53	0.34	0.23
query33	1.39	1.57	1.43
query34	15.38	2.19	1.75
query35	1.76	1.72	1.72
query36	0.47	0.29	0.28
query37	0.07	0.04	0.04
query38	0.05	0.03	0.03
query39	0.03	0.03	0.02
query40	0.12	0.08	0.07
query41	0.08	0.03	0.02
query42	0.03	0.03	0.02
query43	0.04	0.03	0.03
Total cold run time: 90.41 s
Total hot run time: 14.65 s

@morningman

Copy link
Copy Markdown
Contributor Author

skip buildall

@CalvinKirs
CalvinKirs merged commit 1a3b141 into apache:master Sep 15, 2026
39 checks passed
luwei16 added a commit to luwei16/Doris that referenced this pull request Sep 15, 2026
### What problem does this PR solve?

Issue Number: close apache#67099

Related PR: apache#67813, apache#68000

Problem Summary: The performance pipeline fails before benchmarks because
Maven cache hits restore Java plugin jars without their runtime dependencies.
Merge upstream master and adopt its equivalent cache cleanup/copy fix,
resolving conflicts with the local repair and removing duplicate changes
from this PR. Preserve the cloud version-cache invalidation changes.

### Release note

None

### Check List (For Author)

- Test: Manual test
    - build.sh --be-java-extensions passed after the merge.
    - All eight plugins and hadoop-deps hit the cache, regenerated the same
      runtime dependency manifests as an uncached build, and removed stale jars.
    - All eight plugins passed the existing layout checker; Checkstyle for
      the nine modules and PR diff whitespace checks passed.
- Behavior changed: No (adopt the equivalent upstream build repair)
- Does this need documentation: No
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Sep 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

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

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants