Skip to content

Commit 05c5c37

Browse files
committed
Require Java 17 or Java 21 for building Bookkeeper
1 parent ab2b29d commit 05c5c37

13 files changed

Lines changed: 144 additions & 172 deletions

File tree

.github/workflows/bk-ci.yml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ jobs:
7474
!~/.m2/repository/org/apache/distributedlog
7575
key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }}
7676

77-
- name: Set up JDK 11
77+
- name: Set up JDK 17
7878
if: steps.check_changes.outputs.docs_only != 'true'
7979
uses: actions/setup-java@v4
8080
with:
8181
distribution: 'temurin'
82-
java-version: 11
82+
java-version: 17
8383

8484
- name: Validate pull request
8585
if: steps.check_changes.outputs.docs_only != 'true'
@@ -153,11 +153,11 @@ jobs:
153153
!~/.m2/repository/org/apache/distributedlog
154154
key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }}
155155

156-
- name: Set up JDK 11
156+
- name: Set up JDK 17
157157
uses: actions/setup-java@v4
158158
with:
159159
distribution: 'temurin'
160-
java-version: 11
160+
java-version: 17
161161

162162
- name: Tune Java DNS TTL settings
163163
run: |
@@ -234,11 +234,11 @@ jobs:
234234
!~/.m2/repository/org/apache/distributedlog
235235
key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }}
236236

237-
- name: Set up JDK 11
237+
- name: Set up JDK 17
238238
uses: actions/setup-java@v4
239239
with:
240240
distribution: 'temurin'
241-
java-version: 11
241+
java-version: 17
242242

243243
- name: Tune Java DNS TTL settings
244244
run: |
@@ -328,11 +328,11 @@ jobs:
328328
!~/.m2/repository/org/apache/distributedlog
329329
key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }}
330330

331-
- name: Set up JDK 8
331+
- name: Set up JDK 17
332332
uses: actions/setup-java@v4
333333
with:
334334
distribution: 'temurin'
335-
java-version: 8
335+
java-version: 17
336336

337337
- name: Pick ubuntu mirror for the docker image build
338338
run: |
@@ -385,7 +385,7 @@ jobs:
385385
retention-days: 7
386386

387387
windows-build:
388-
name: Build with windows on JDK 11
388+
name: Build with windows on JDK 17
389389
runs-on: windows-latest
390390
timeout-minutes: 30
391391
needs: [ 'build-and-license-check' ]
@@ -410,17 +410,17 @@ jobs:
410410
!~/.m2/repository/org/apache/distributedlog
411411
key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }}
412412

413-
- name: Set up JDK 11
413+
- name: Set up JDK 17
414414
uses: actions/setup-java@v4
415415
with:
416416
distribution: 'temurin'
417-
java-version: 11
417+
java-version: 17
418418

419419
- name: mvn package
420420
run: mvn -B -nsu clean package -DskipTests
421421

422422
macos-build:
423-
name: Build with macos on JDK 11
423+
name: Build with macos on JDK 17
424424
runs-on: macos-latest
425425
timeout-minutes: 30
426426
needs: [ 'build-and-license-check' ]
@@ -442,11 +442,11 @@ jobs:
442442
!~/.m2/repository/org/apache/distributedlog
443443
key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }}
444444

445-
- name: Set up JDK 11
445+
- name: Set up JDK 17
446446
uses: actions/setup-java@v4
447447
with:
448448
distribution: 'temurin'
449-
java-version: 11
449+
java-version: 17
450450

451451
- name: mvn package
452452
run: mvn -B -nsu clean package -DskipTests
@@ -461,10 +461,6 @@ jobs:
461461
fail-fast: false
462462
matrix:
463463
include:
464-
- step_name: Compatibility Check Java8
465-
jdk_version: 8
466-
- step_name: Compatibility Check Java11
467-
jdk_version: 11
468464
- step_name: Compatibility Check Java17
469465
jdk_version: 17
470466
- step_name: Compatibility Check Java21
@@ -534,7 +530,7 @@ jobs:
534530
!~/.m2/repository/org/apache/distributedlog
535531
key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }}
536532

537-
- name: Set up JDK 11
533+
- name: Set up JDK 21
538534
uses: actions/setup-java@v4
539535
with:
540536
distribution: 'temurin'

.github/workflows/bk-streamstorage-python.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ jobs:
6666
!~/.m2/repository/org/apache/bookkeeper
6767
!~/.m2/repository/org/apache/distributedlog
6868
key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }}
69-
- name: Set up JDK 11
69+
- name: Set up JDK 17
7070
uses: actions/setup-java@v4
7171
with:
7272
distribution: 'temurin'
73-
java-version: 11
73+
java-version: 17
7474
- name: Build
7575
run: mvn -q -T 1C -B -nsu clean install -DskipTests -Dcheckstyle.skip -Dspotbugs.skip -Drat.skip -Dmaven.javadoc.skip
7676
- name: Pick ubuntu mirror for the docker image build

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ jobs:
7878
with:
7979
languages: ${{ matrix.language }}
8080

81-
- name: Set up JDK 11
81+
- name: Set up JDK 17
8282
if: steps.check_changes.outputs.docs_only != 'true'
8383
uses: actions/setup-java@v4
8484
with:
8585
distribution: 'temurin'
86-
java-version: 11
86+
java-version: 17
8787

8888
- name: Validate pull request
8989
if: steps.check_changes.outputs.docs_only != 'true'

.github/workflows/website-deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ jobs:
4040
- name: Checkout
4141
uses: actions/checkout@v4
4242

43-
- name: Set up JDK 11
43+
- name: Set up JDK 17
4444
uses: actions/setup-java@v4
4545
with:
4646
distribution: 'temurin'
47-
java-version: 11
47+
java-version: 17
4848

4949

5050
- name: Setup NodeJS

.github/workflows/website-pr-validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ jobs:
3737
- name: Checkout
3838
uses: actions/checkout@v4
3939

40-
- name: Set up JDK 11
40+
- name: Set up JDK 17
4141
uses: actions/setup-java@v4
4242
with:
4343
distribution: 'temurin'
44-
java-version: 11
44+
java-version: 17
4545

4646

4747
- name: Setup NodeJS

.github/workflows/windows-daily-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: windows-latest
2828
steps:
2929
- uses: actions/checkout@v4
30-
- name: Set up JDK 17
30+
- name: Set up JDK 21
3131
uses: actions/setup-java@v4
3232
with:
3333
distribution: 'temurin'

bin/common.sh

Lines changed: 35 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -68,43 +68,34 @@ source ${BK_CONFDIR}/nettyenv.sh
6868
source ${BK_CONFDIR}/bkenv.sh
6969
source ${BK_CONFDIR}/bk_cli_env.sh
7070

71-
detect_jdk8() {
72-
local is_java_8=$($JAVA -version 2>&1 | grep version | grep '"1\.8')
73-
if [ -z "$is_java_8" ]; then
74-
echo "0"
75-
else
76-
echo "1"
77-
fi
78-
}
71+
for token in $("$JAVA" -version 2>&1 | grep 'version "'); do
72+
if [[ $token =~ \"([[:digit:]]+)\.([[:digit:]]+)(.*)\" ]]; then
73+
if [[ ${BASH_REMATCH[1]} == "1" ]]; then
74+
JAVA_MAJOR_VERSION=${BASH_REMATCH[2]}
75+
else
76+
JAVA_MAJOR_VERSION=${BASH_REMATCH[1]}
77+
fi
78+
break
79+
elif [[ $token =~ \"([[:digit:]]+)(.*)\" ]]; then
80+
# Process the java versions without dots, such as `17-internal`.
81+
JAVA_MAJOR_VERSION=${BASH_REMATCH[1]}
82+
break
83+
fi
84+
done
85+
86+
if [[ $JAVA_MAJOR_VERSION -lt 17 ]]; then
87+
echo "Error: BookKeeper requires Java 17 or later." 1>&2
88+
exit 1
89+
fi
7990

8091
# default netty settings
8192
NETTY_LEAK_DETECTION_LEVEL=${NETTY_LEAK_DETECTION_LEVEL:-"disabled"}
8293

83-
USING_JDK8=$(detect_jdk8)
84-
85-
if [ "$USING_JDK8" -ne "1" ]; then
86-
DEFAULT_BOOKIE_GC_OPTS="-XX:+UseG1GC \
87-
-XX:MaxGCPauseMillis=10 \
88-
-XX:+ParallelRefProcEnabled \
89-
-XX:+DisableExplicitGC"
90-
DEFAULT_BOOKIE_GC_LOGGING_OPTS=""
91-
else
92-
DEFAULT_BOOKIE_GC_OPTS="-XX:+UseG1GC \
93-
-XX:MaxGCPauseMillis=10 \
94-
-XX:+ParallelRefProcEnabled \
95-
-XX:+UnlockExperimentalVMOptions \
96-
-XX:+DoEscapeAnalysis \
97-
-XX:ParallelGCThreads=32 \
98-
-XX:ConcGCThreads=32 \
99-
-XX:G1NewSizePercent=50 \
100-
-XX:+DisableExplicitGC \
101-
-XX:-ResizePLAB"
102-
DEFAULT_BOOKIE_GC_LOGGING_OPTS="-XX:+PrintGCDetails \
103-
-XX:+PrintGCApplicationStoppedTime \
104-
-XX:+UseGCLogFileRotation \
105-
-XX:NumberOfGCLogFiles=5 \
106-
-XX:GCLogFileSize=64m"
107-
fi
94+
DEFAULT_BOOKIE_GC_OPTS="-XX:+UseG1GC \
95+
-XX:MaxGCPauseMillis=10 \
96+
-XX:+ParallelRefProcEnabled \
97+
-XX:+DisableExplicitGC"
98+
DEFAULT_BOOKIE_GC_LOGGING_OPTS=""
10899

109100
BOOKIE_MAX_HEAP_MEMORY=${BOOKIE_MAX_HEAP_MEMORY:-"1g"}
110101
BOOKIE_MIN_HEAP_MEMORY=${BOOKIE_MIN_HEAP_MEMORY:-"1g"}
@@ -116,15 +107,7 @@ BOOKIE_GC_LOGGING_OPTS=${BOOKIE_GC_LOGGING_OPTS:-"${DEFAULT_BOOKIE_GC_LOGGING_OP
116107
# default CLI JVM settings
117108
DEFAULT_CLI_GC_OPTS="-XX:+UseG1GC \
118109
-XX:MaxGCPauseMillis=10"
119-
if [ "$USING_JDK8" -ne "1" ]; then
120-
DEFAULT_CLI_GC_LOGGING_OPTS=""
121-
else
122-
DEFAULT_CLI_GC_LOGGING_OPTS="-XX:+PrintGCDetails \
123-
-XX:+PrintGCApplicationStoppedTime \
124-
-XX:+UseGCLogFileRotation \
125-
-XX:NumberOfGCLogFiles=5 \
126-
-XX:GCLogFileSize=64m"
127-
fi
110+
DEFAULT_CLI_GC_LOGGING_OPTS=""
128111

129112
CLI_MAX_HEAP_MEMORY=${CLI_MAX_HEAP_MEMORY:-"512M"}
130113
CLI_MIN_HEAP_MEMORY=${CLI_MIN_HEAP_MEMORY:-"256M"}
@@ -260,34 +243,24 @@ set_module_classpath() {
260243
build_bookie_jvm_opts() {
261244
LOG_DIR=$1
262245
GC_LOG_FILENAME=$2
263-
if [ "$USING_JDK8" -eq "1" ]; then
264-
echo "$BOOKIE_MEM_OPTS $BOOKIE_GC_OPTS $BOOKIE_GC_LOGGING_OPTS $BOOKIE_PERF_OPTS -Xloggc:${LOG_DIR}/${GC_LOG_FILENAME}"
265-
else
266-
echo "$BOOKIE_MEM_OPTS $BOOKIE_GC_OPTS $BOOKIE_GC_LOGGING_OPTS $BOOKIE_PERF_OPTS -Xlog:gc=info:file=${LOG_DIR}/${GC_LOG_FILENAME}::filecount=5,filesize=64m"
267-
fi
246+
echo "$BOOKIE_MEM_OPTS $BOOKIE_GC_OPTS $BOOKIE_GC_LOGGING_OPTS $BOOKIE_PERF_OPTS -Xlog:gc=info:file=${LOG_DIR}/${GC_LOG_FILENAME}::filecount=5,filesize=64m"
268247
return
269248
}
270249

271250
build_cli_jvm_opts() {
272251
LOG_DIR=$1
273252
GC_LOG_FILENAME=$2
274-
if [ "$USING_JDK8" -eq "1" ]; then
275-
echo "$CLI_MEM_OPTS $CLI_GC_OPTS $CLI_GC_LOGGING_OPTS -Xloggc:${LOG_DIR}/${GC_LOG_FILENAME}"
276-
else
277-
echo "$CLI_MEM_OPTS $CLI_GC_OPTS $CLI_GC_LOGGING_OPTS -Xlog:gc=info:file=${LOG_DIR}/${GC_LOG_FILENAME}::filecount=5,filesize=64m"
278-
fi
253+
echo "$CLI_MEM_OPTS $CLI_GC_OPTS $CLI_GC_LOGGING_OPTS -Xlog:gc=info:file=${LOG_DIR}/${GC_LOG_FILENAME}::filecount=5,filesize=64m"
279254
return
280255
}
281256

282257
build_netty_opts() {
283258
NETTY_OPTS="-Dio.netty.leakDetectionLevel=${NETTY_LEAK_DETECTION_LEVEL} -Dio.netty.tryReflectionSetAccessible=true"
284259
# --add-opens does not exist on jdk8
285-
if [ "$USING_JDK8" -eq "0" ]; then
286-
# Enable java.nio.DirectByteBuffer
287-
# https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/internal/PlatformDependent0.java
288-
# https://github.com/netty/netty/issues/12265
289-
NETTY_OPTS="$NETTY_OPTS --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED"
290-
fi
260+
# Enable java.nio.DirectByteBuffer
261+
# https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/internal/PlatformDependent0.java
262+
# https://github.com/netty/netty/issues/12265
263+
NETTY_OPTS="$NETTY_OPTS --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED"
291264
echo $NETTY_OPTS
292265
}
293266

@@ -322,12 +295,10 @@ build_cli_logging_opts() {
322295
build_bookie_opts() {
323296
BOOKIE_OPTS="-Djava.net.preferIPv4Stack=true"
324297
# --add-opens does not exist on jdk8
325-
if [ "$USING_JDK8" -eq "0" ]; then
326-
# enable posix_fadvise usage in the Journal
327-
BOOKIE_OPTS="$BOOKIE_OPTS --add-opens java.base/java.io=ALL-UNNAMED"
328-
# DirectMemoryCRC32Digest
329-
BOOKIE_OPTS="$BOOKIE_OPTS --add-opens java.base/java.util.zip=ALL-UNNAMED"
330-
fi
298+
# enable posix_fadvise usage in the Journal
299+
BOOKIE_OPTS="$BOOKIE_OPTS --add-opens java.base/java.io=ALL-UNNAMED"
300+
# DirectMemoryCRC32Digest
301+
BOOKIE_OPTS="$BOOKIE_OPTS --add-opens java.base/java.util.zip=ALL-UNNAMED"
331302
echo $BOOKIE_OPTS
332303
}
333304

dev/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# under the License.
1818
#
1919

20-
FROM maven:3.9.0-eclipse-temurin-11
20+
FROM maven:3.9.11-eclipse-temurin-17
2121

2222
RUN apt-get update
2323
RUN apt-get install -y g++ cmake

dev/release/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# under the License.
1818
#
1919

20-
FROM --platform=linux/amd64 maven:3.9.0-eclipse-temurin-8
20+
FROM --platform=linux/amd64 maven:3.9.11-eclipse-temurin-17
2121
ARG DEBIAN_FRONTEND=noninteractive
2222
RUN apt-get update && \
2323
apt-get dist-upgrade -y && \

0 commit comments

Comments
 (0)