FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
doris/post-build.sh at master · apache/doris · GitHub
apache
/
doris
Public
Notifications
You must be signed in to change notification settings
Fork
4k
Star
16k
Code
Issues
349
Pull requests
999
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
doris
/
post-build.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
250 lines (216 loc) · 7.77 KB
Breadcrumbs
doris
/
post-build.sh
Copy path
File metadata and controls
executable file
·
250 lines (216 loc) · 7.77 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#!
/usr/bin/env bash
#
Licensed to the Apache Software Foundation (ASF) under one
#
or more contributor license agreements. See the NOTICE file
#
distributed with this work for additional information
#
regarding copyright ownership. The ASF licenses this file
#
to you under the Apache License, Version 2.0 (the
#
"License"); you may not use this file except in compliance
#
with the License. You may obtain a copy of the License at
#
#
http://www.apache.org/licenses/LICENSE-2.0
#
#
Unless required by applicable law or agreed to in writing,
#
software distributed under the License is distributed on an
#
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#
KIND, either express or implied. See the License for the
#
specific language governing permissions and limitations
#
under the License.
#
#############################################################
#
Post-build script for packaging third-party filesystem JARs
#
(JuiceFS, JindoFS) into Doris FE/BE output directories.
#
#
This script is independent of the main build and can be
#
executed standalone or called from build.sh.
#
#
Usage:
#
post-build.sh [--fe] [--be] [--output <dir>]
#
[--juicefs] [--jindofs]
#
#
Environment variables:
#
DISABLE_BUILD_JUICEFS=OFF Enable JuiceFS packaging (default: ON, i.e. skip)
#
DISABLE_BUILD_JINDOFS=OFF Enable JindoFS packaging (default: ON, i.e. skip)
#
#############################################################
set
-eo pipefail
ROOT=
"
$(
cd
"
$(
dirname
"
${BASH_SOURCE[0]}
"
)
"
&
>
/dev/null
&&
pwd
)
"
DORIS_HOME=
"
${DORIS_HOME
:-
${ROOT}
}
"
if
[[
-z
"
${DORIS_THIRDPARTY}
"
]]
;
then
DORIS_THIRDPARTY=
"
${DORIS_HOME}
/thirdparty
"
fi
TARGET_SYSTEM=
"
${TARGET_SYSTEM
:-
$(uname -s)}
"
TARGET_ARCH=
"
${TARGET_ARCH
:-
$(uname -m)}
"
#
--- Source helper scripts ---
.
"
${DORIS_HOME}
/docker/thirdparties/juicefs-helpers.sh
"
.
"
${DORIS_HOME}
/docker/thirdparties/jindofs-helpers.sh
"
#
--- JuiceFS wrapper functions (migrated from build.sh) ---
find_juicefs_hadoop_jar
() {
juicefs_find_hadoop_jar_by_globs \
"
${DORIS_THIRDPARTY}
/installed/juicefs_libs/juicefs-hadoop-[0-9]*.jar
"
\
"
${DORIS_THIRDPARTY}
/src/juicefs-hadoop-[0-9]*.jar
"
\
"
${DORIS_HOME}
/thirdparty/installed/juicefs_libs/juicefs-hadoop-[0-9]*.jar
"
\
"
${DORIS_HOME}
/thirdparty/src/juicefs-hadoop-[0-9]*.jar
"
}
detect_juicefs_version
() {
local
juicefs_jar
juicefs_jar=
$(
find_juicefs_hadoop_jar
||
true
)
juicefs_detect_hadoop_version
"
${juicefs_jar}
"
"
${JUICEFS_DEFAULT_VERSION}
"
}
download_juicefs_hadoop_jar
() {
local
juicefs_version=
"
$1
"
local
cache_dir=
"
${DORIS_HOME}
/thirdparty/installed/juicefs_libs
"
juicefs_download_hadoop_jar_to_cache
"
${juicefs_version}
"
"
${cache_dir}
"
}
copy_juicefs_hadoop_jar
() {
local
target_dir=
"
$1
"
local
source_jar=
"
"
source_jar=
$(
find_juicefs_hadoop_jar
||
true
)
if
[[
-z
"
${source_jar}
"
]]
;
then
local
juicefs_version
juicefs_version=
$(
detect_juicefs_version
)
source_jar=
$(
download_juicefs_hadoop_jar
"
${juicefs_version}
"
||
true
)
fi
if
[[
-z
"
${source_jar}
"
]]
;
then
echo
"
WARN: skip copying juicefs-hadoop jar, not found in thirdparty and download failed
"
return
0
fi
cp -r -p
"
${source_jar}
"
"
${target_dir}
/
"
echo
"
Copy JuiceFS Hadoop jar to
${target_dir}
:
$(
basename
"
${source_jar}
"
)
"
}
#
--- Install functions ---
#
Where a third-party filesystem's jars are deployed, per target.
#
#
FE keeps lib/<name>: it has exactly one consumer, the FE's own classpath.
#
#
BE uses plugins/jni_fs/<name>, because it has TWO consumers and they need the same files. The
#
native libhdfs reader wants them on the system class path (bin/start_be.sh puts them there), and
#
every Java plugin wants them on its own classpath (PluginRegistry appends them, BE config
#
jni_plugin_fs_dir) - a plugin classloader cannot reach the system class path by design, which is
#
what took oss:// and jfs:// away from the Java scanners when the plugins were isolated. One
#
directory read by both is one copy on disk; the JuiceFS Hadoop SDK alone is a 180 MB fat jar.
#
It sits under plugins/ rather than lib/ for the same reason plugins/jni does: lib/ is the engine
#
tree a package upgrade replaces wholesale.
fs_libs_dir
() {
local
target_type=
"
$1
"
local
output_dir=
"
$2
"
local
name=
"
$3
"
if
[[
"
${target_type}
"
==
"
fe
"
]]
;
then
echo
"
${output_dir}
/fe/lib/
${name}
"
elif
[[
"
${target_type}
"
==
"
be
"
]]
;
then
echo
"
${output_dir}
/be/plugins/jni_fs/
${name}
"
else
return
1
fi
}
install_juicefs
() {
local
target_type=
"
$1
"
local
output_dir=
"
$2
"
local
target_dir
if
!
target_dir=
"
$(
fs_libs_dir
"
${target_type}
"
"
${output_dir}
"
juicefs
)
"
;
then
echo
"
ERROR: unknown target type '
${target_type}
' for install_juicefs
"
return
1
fi
install -d
"
${target_dir}
"
copy_juicefs_hadoop_jar
"
${target_dir}
"
}
install_jindofs
() {
local
target_type=
"
$1
"
local
output_dir=
"
$2
"
local
target_dir
if
!
target_dir=
"
$(
fs_libs_dir
"
${target_type}
"
"
${output_dir}
"
jindofs
)
"
;
then
echo
"
ERROR: unknown target type '
${target_type}
' for install_jindofs
"
return
1
fi
install -d
"
${target_dir}
"
jindofs_copy_jars
"
${DORIS_THIRDPARTY}
/installed/jindofs_libs
"
"
${target_dir}
"
\
"
${TARGET_SYSTEM}
"
"
${TARGET_ARCH}
"
}
#
--- CLI ---
usage
() {
echo
"
Usage:
$0
[--fe] [--be] [--output <dir>] [--juicefs] [--jindofs]
Package third-party filesystem JARs (JuiceFS, JindoFS) into Doris output directories.
By default, no third-party JARs are packaged. Use --juicefs/--jindofs or environment variables to opt in.
Options:
--fe Process FE output directory
--be Process BE output directory
--output <dir> Output directory (default:
\$
{DORIS_HOME}/output)
--juicefs Enable JuiceFS packaging
--jindofs Enable JindoFS packaging
Environment variables:
DISABLE_BUILD_JUICEFS=OFF Enable JuiceFS packaging (--juicefs takes precedence)
DISABLE_BUILD_JINDOFS=OFF Enable JindoFS packaging (--jindofs takes precedence)
"
}
#
Defaults: not installed
PROCESS_FE=0
PROCESS_BE=0
OUTPUT_DIR=
"
"
BUILD_JUICEFS=
"
"
BUILD_JINDOFS=
"
"
while
[[
$#
-gt
0 ]]
;
do
case
"
$1
"
in
--fe)
PROCESS_FE=1
shift
;;
--be)
PROCESS_BE=1
shift
;;
--output)
OUTPUT_DIR=
"
$2
"
shift
2
;;
--juicefs)
BUILD_JUICEFS=
"
ON
"
shift
;;
--jindofs)
BUILD_JINDOFS=
"
ON
"
shift
;;
--help | -h)
usage
exit
0
;;
*
)
echo
"
Unknown option:
$1
"
usage
exit
1
;;
esac
done
OUTPUT_DIR=
"
${OUTPUT_DIR
:-
${DORIS_HOME}
/
output}
"
#
Resolve build flags: CLI > env DISABLE_BUILD_XXX > default (OFF)
if
[[
-z
"
${BUILD_JUICEFS}
"
]]
;
then
if
[[
"
$(
echo
"
${DISABLE_BUILD_JUICEFS}
"
|
tr
'
[:lower:]
'
'
[:upper:]
'
)
"
==
"
OFF
"
]]
;
then
BUILD_JUICEFS=
"
ON
"
else
BUILD_JUICEFS=
"
OFF
"
fi
fi
if
[[
-z
"
${BUILD_JINDOFS}
"
]]
;
then
if
[[
"
$(
echo
"
${DISABLE_BUILD_JINDOFS}
"
|
tr
'
[:lower:]
'
'
[:upper:]
'
)
"
==
"
OFF
"
]]
;
then
BUILD_JINDOFS=
"
ON
"
else
BUILD_JINDOFS=
"
OFF
"
fi
fi
if
[[
"
${PROCESS_FE}
"
-eq
0
&&
"
${PROCESS_BE}
"
-eq
0 ]]
;
then
echo
"
Nothing to do. Specify --fe and/or --be.
"
exit
0
fi
#
--- Main ---
for
target_type
in
fe be
;
do
if
[[
"
${target_type}
"
==
"
fe
"
&&
"
${PROCESS_FE}
"
-eq
0 ]]
;
then
continue
fi
if
[[
"
${target_type}
"
==
"
be
"
&&
"
${PROCESS_BE}
"
-eq
0 ]]
;
then
continue
fi
if
[[
"
${BUILD_JINDOFS}
"
==
"
ON
"
]]
;
then
install_jindofs
"
${target_type}
"
"
${OUTPUT_DIR}
"
fi
if
[[
"
${BUILD_JUICEFS}
"
==
"
ON
"
]]
;
then
install_juicefs
"
${target_type}
"
"
${OUTPUT_DIR}
"
fi
done
Back
|
FazBrowse Home
|
New Git URL