diff --git a/.github/workflows/pulsar-ci.yaml b/.github/workflows/pulsar-ci.yaml
index dd93003eecce6..ad017674ac6ee 100644
--- a/.github/workflows/pulsar-ci.yaml
+++ b/.github/workflows/pulsar-ci.yaml
@@ -25,9 +25,9 @@ on:
- branch-*
- pulsar-*
schedule:
- # scheduled job with JDK 17
- - cron: '0 12 * * *'
# scheduled job with JDK 21
+ - cron: '0 12 * * *'
+ # scheduled job with JDK 17
# if cron expression is changed, make sure to update the expression in jdk_major_version step in preconditions job
- cron: '0 6 * * *'
workflow_dispatch:
@@ -44,7 +44,7 @@ on:
options:
- '17'
- '21'
- default: '17'
+ default: '21'
trace_test_resource_cleanup:
description: 'Collect thread & heap information before exiting a test JVM. When set to "on", thread dump and heap histogram will be collected. When set to "full", a heap dump will also be collected.'
required: true
@@ -95,13 +95,13 @@ jobs:
- name: Select JDK major version
id: jdk_major_version
run: |
- # use JDK 21 for the scheduled build with cron expression '0 6 * * *'
+ # use JDK 17 for the scheduled build with cron expression '0 6 * * *'
if [[ "${{ github.event_name == 'schedule' && github.event.schedule == '0 6 * * *' && 'true' || 'false' }}" == "true" ]]; then
- echo "jdk_major_version=21" >> $GITHUB_OUTPUT
+ echo "jdk_major_version=17" >> $GITHUB_OUTPUT
exit 0
fi
- # use JDK 17 for build unless overridden with workflow_dispatch input
- echo "jdk_major_version=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.jdk_major_version || '17'}}" >> $GITHUB_OUTPUT
+ # use JDK 21 for build unless overridden with workflow_dispatch input
+ echo "jdk_major_version=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.jdk_major_version || '21'}}" >> $GITHUB_OUTPUT
- name: checkout
if: ${{ github.event_name == 'pull_request' }}
diff --git a/bin/function-localrunner b/bin/function-localrunner
index b2405db724e72..a47f3efa48609 100755
--- a/bin/function-localrunner
+++ b/bin/function-localrunner
@@ -52,7 +52,14 @@ done
PULSAR_MEM=${PULSAR_MEM:-"-Xmx128m -XX:MaxDirectMemorySize=128m"}
# Garbage collection options
-PULSAR_GC=${PULSAR_GC:-"-XX:+UseZGC -XX:+PerfDisableSharedMem -XX:+AlwaysPreTouch"}
+if [ -z "$PULSAR_GC" ]; then
+ PULSAR_GC="-XX:+PerfDisableSharedMem -XX:+AlwaysPreTouch"
+ if [[ $JAVA_MAJOR_VERSION -ge 21 ]]; then
+ PULSAR_GC="-XX:+UseZGC -XX:+ZGenerational ${PULSAR_GC}"
+ else
+ PULSAR_GC="-XX:+UseZGC ${PULSAR_GC}"
+ fi
+fi
# Garbage collection log.
PULSAR_GC_LOG_DIR=${PULSAR_GC_LOG_DIR:-logs}
diff --git a/conf/bkenv.sh b/conf/bkenv.sh
index b41532d3a0c91..8beea47cee312 100644
--- a/conf/bkenv.sh
+++ b/conf/bkenv.sh
@@ -37,9 +37,6 @@ BOOKIE_LOG_DIR=${BOOKIE_LOG_DIR:-"${PULSAR_LOG_DIR}"}
# Memory size options
BOOKIE_MEM=${BOOKIE_MEM:-${PULSAR_MEM:-"-Xms2g -Xmx2g -XX:MaxDirectMemorySize=2g"}}
-# Garbage collection options
-BOOKIE_GC=${BOOKIE_GC:-${PULSAR_GC:-"-XX:+UseZGC -XX:+PerfDisableSharedMem -XX:+AlwaysPreTouch"}}
-
if [ -z "$JAVA_HOME" ]; then
JAVA_BIN=java
else
@@ -60,6 +57,17 @@ for token in $("$JAVA_BIN" -version 2>&1 | grep 'version "'); do
fi
done
+# Garbage collection options
+BOOKIE_GC="${BOOKIE_GC:-${PULSAR_GC}}"
+if [ -z "$BOOKIE_GC" ]; then
+ BOOKIE_GC="-XX:+PerfDisableSharedMem -XX:+AlwaysPreTouch"
+ if [[ $JAVA_MAJOR_VERSION -ge 21 ]]; then
+ BOOKIE_GC="-XX:+UseZGC -XX:+ZGenerational ${BOOKIE_GC}"
+ else
+ BOOKIE_GC="-XX:+UseZGC ${BOOKIE_GC}"
+ fi
+fi
+
if [[ -z "$BOOKIE_GC_LOG" ]]; then
# fallback to PULSAR_GC_LOG if it is set
BOOKIE_GC_LOG="$PULSAR_GC_LOG"
diff --git a/conf/pulsar_env.sh b/conf/pulsar_env.sh
index 3a069e31fdc90..f95d0ac83c13a 100755
--- a/conf/pulsar_env.sh
+++ b/conf/pulsar_env.sh
@@ -44,9 +44,6 @@
# Extra options to be passed to the jvm
PULSAR_MEM=${PULSAR_MEM:-"-Xms2g -Xmx2g -XX:MaxDirectMemorySize=4g"}
-# Garbage collection options
-PULSAR_GC=${PULSAR_GC:-"-XX:+UseZGC -XX:+PerfDisableSharedMem -XX:+AlwaysPreTouch"}
-
if [ -z "$JAVA_HOME" ]; then
JAVA_BIN=java
else
@@ -67,6 +64,16 @@ for token in $("$JAVA_BIN" -version 2>&1 | grep 'version "'); do
fi
done
+# Garbage collection options
+if [ -z "$PULSAR_GC" ]; then
+ PULSAR_GC="-XX:+PerfDisableSharedMem -XX:+AlwaysPreTouch"
+ if [[ $JAVA_MAJOR_VERSION -ge 21 ]]; then
+ PULSAR_GC="-XX:+UseZGC -XX:+ZGenerational ${PULSAR_GC}"
+ else
+ PULSAR_GC="-XX:+UseZGC ${PULSAR_GC}"
+ fi
+fi
+
PULSAR_GC_LOG_DIR=${PULSAR_GC_LOG_DIR:-"${PULSAR_LOG_DIR}"}
if [[ -z "$PULSAR_GC_LOG" ]]; then
diff --git a/docker/pulsar/Dockerfile b/docker/pulsar/Dockerfile
index 38b74e8503d51..f3b0f3d944bdc 100644
--- a/docker/pulsar/Dockerfile
+++ b/docker/pulsar/Dockerfile
@@ -18,6 +18,7 @@
#
ARG ALPINE_VERSION=3.20
+ARG IMAGE_JDK_MAJOR_VERSION=21
# First create a stage with just the Pulsar tarball and scripts
FROM alpine:$ALPINE_VERSION as pulsar
@@ -54,7 +55,7 @@ RUN chmod -R o+rx /pulsar
RUN echo 'OPTS="$OPTS -Dorg.xerial.snappy.use.systemlib=true"' >> /pulsar/conf/bkenv.sh
### Create one stage to include JVM distribution
-FROM amazoncorretto:21-alpine AS jvm
+FROM amazoncorretto:${IMAGE_JDK_MAJOR_VERSION}-alpine AS jvm
RUN apk add --no-cache binutils
diff --git a/docker/pulsar/pom.xml b/docker/pulsar/pom.xml
index 68d82ae552825..481fc319be732 100644
--- a/docker/pulsar/pom.xml
+++ b/docker/pulsar/pom.xml
@@ -83,6 +83,7 @@
target/pulsar-server-distribution-${project.version}-bin.tar.gz
${pulsar.client.python.version}
${snappy.version}
+ ${IMAGE_JDK_MAJOR_VERSION}
${project.basedir}
diff --git a/pom.xml b/pom.xml
index 1f7ecd3b90c1e..9f2330d7c75e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,9 +84,7 @@ flexible messaging model and an intuitive client API.
3.4.0
- http://archive.ubuntu.com/ubuntu/
- http://security.ubuntu.com/ubuntu/
- 17
+ 21
**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java
@@ -2748,30 +2746,6 @@ flexible messaging model and an intuitive client API.
-
- ubuntu-mirror-set
-
-
- env.UBUNTU_MIRROR
-
-
-
-
- ${env.UBUNTU_MIRROR}
-
-
-
- ubuntu-security-mirror-set
-
-
- env.UBUNTU_SECURITY_MIRROR
-
-
-
-
- ${env.UBUNTU_SECURITY_MIRROR}
-
-
jdk-major-version-set