Slackbot
02/10/2023, 5:27 PMDavid K
02/10/2023, 5:30 PMZhenhao Li
02/10/2023, 5:33 PMZhenhao Li
02/10/2023, 7:09 PMInvalid -Xlog option '-Xlog:gc*,safepoint:/tmp/pulsar-logs/pulsar_gc_%p.log:time,uptime,tags:filecount=10,filesize=20M', see error log for details.Zhenhao Li
02/10/2023, 7:10 PM/nix/store/6zhdlqjlvlv7mgxs33xsfrxr4d25dyc0-openjdk-minimal-jre-17.0.5+8/bin/javaDavid K
02/10/2023, 7:11 PMZhenhao Li
02/10/2023, 7:14 PMZhenhao Li
02/10/2023, 7:17 PM-Xlog:gc* is fromDavid K
02/10/2023, 7:17 PMZhenhao Li
02/10/2023, 7:17 PMDavid K
02/10/2023, 7:18 PMZhenhao Li
02/10/2023, 7:20 PM_${cfg.package}_/bin/pulsar bookieZhenhao Li
02/10/2023, 7:22 PMsystemd.services.pulsar-bookie = mkIf cfg.bookie.enable {
description = "Pulsar's Bookkeeper Daemon";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "pulsar-zookeeper.target" ];
# FIXME: This causes the bookie to restart when the broker changes.
inherit environment;
serviceConfig.User = "pulsar-bookie";
serviceConfig.ExecStartPre =
let
journalPath = cfg.bookie.settings.journalDirectories;
ledgerPath = cfg.bookie.settings.ledgerDirectories;
rangePath = cfg.bookie.settings."storage.range.store.dirs";
in
"+" + pkgs.writeScript "pulsar-bookie-prep"
''
#!${pkgs.runtimeShell}
set -euo pipefail
mkdir -p ${journalPath}
install -d -o pulsar-bookie ${journalPath}
mkdir -p ${ledgerPath}
install -d -o pulsar-bookie ${ledgerPath}
mkdir -p ${rangePath}
install -d -o pulsar-bookie ${rangePath}
'';
script = ''
# It is non-destructive to re-run the cluster initialization
${cfg.package}/bin/pulsar initialize-cluster-metadata \
--cluster ${cfg.clusterName} \
--zookeeper ${zkConnectionString} \
--configuration-store ${zkConnectionString} \
--web-service-url ${cfg.webServiceUrl} \
--broker-service-url ${cfg.brokerServiceUrl}
# However we should only format the bookie data once
if [ ! -f ${cfg.bookie.dataDir}/has-done-init ]; then
${cfg.package}/bin/bookkeeper shell bookieformat -nonInteractive
touch ${cfg.bookie.dataDir}/has-done-init
fi
${cfg.package}/bin/pulsar bookie
'';
};Zhenhao Li
02/10/2023, 7:22 PMZhenhao Li
02/10/2023, 7:26 PMDavid K
02/10/2023, 7:27 PMZhenhao Li
02/10/2023, 7:29 PM-Xlog:gc* for?Zhenhao Li
02/10/2023, 7:29 PMDavid K
02/10/2023, 7:30 PM./bin/pulsar standaloneDavid K
02/10/2023, 7:30 PMZhenhao Li
02/10/2023, 7:31 PMZhenhao Li
02/10/2023, 7:41 PM/nix/store/jv4l318w51m21hs2jsz4hf3bh6dhq95r-openjdk-17.0.5+8/lib/openjdk/bin/javaZhenhao Li
02/10/2023, 7:45 PMInitialization of output 'file=/tmp/pulsar-logs/pulsar_gc_%p.log' using options 'filecount=10,filesize=20M' failed
which indicates that it could be a file permission issueZhenhao Li
02/10/2023, 7:46 PMZhenhao Li
02/10/2023, 7:59 PMDavid K
02/10/2023, 8:00 PMDavid K
02/10/2023, 8:00 PMZhenhao Li
02/10/2023, 8:01 PM--set PULSAR_LOG_DIR "/tmp/pulsar-logs"Zhenhao Li
02/10/2023, 8:04 PM[root@pulsar3:~]# ls -lh /tmp/pulsar-logs
total 32K
-rw-r--r-- 1 pulsar-broker pulsar-broker 13K Feb 10 18:47 pulsar_gc_408154.log
-rw-r--r-- 1 pulsar-broker pulsar-broker 14K Feb 10 20:37 pulsar_gc_408872.logZhenhao Li
02/10/2023, 8:05 PMZhenhao Li
02/10/2023, 8:07 PMZhenhao Li
02/10/2023, 8:07 PMPULSAR_GC_LOG?Zhenhao Li
02/10/2023, 8:11 PMif [[ -z "$BOOKIE_GC_LOG" ]]; then
# fallback to PULSAR_GC_LOG if it is set
BOOKIE_GC_LOG="$PULSAR_GC_LOG"
fi
BOOKIE_GC_LOG_DIR=${BOOKIE_GC_LOG_DIR:-"${PULSAR_GC_LOG_DIR:-"${BOOKIE_LOG_DIR}"}"}
if [[ -z "$BOOKIE_GC_LOG" ]]; then
if [[ $JAVA_MAJOR_VERSION -gt 8 ]]; then
BOOKIE_GC_LOG="-Xlog:gc*,safepoint:${BOOKIE_GC_LOG_DIR}/pulsar_bookie_gc_%p.log:time,uptime,tags:filecount=10,filesize=20M"
if [[ $JAVA_MAJOR_VERSION -ge 17 ]]; then
# Use async logging on Java 17+ <https://bugs.openjdk.java.net/browse/JDK-8264323>
BOOKIE_GC_LOG="-Xlog:async ${BOOKIE_GC_LOG}"
fi
else
# Java 8 gc log options
BOOKIE_GC_LOG="-Xloggc:${BOOKIE_GC_LOG_DIR}/pulsar_bookie_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=20M"
fi
fiZhenhao Li
02/10/2023, 8:12 PMif [[ -z "$BOOKIE_GC_LOG" ]]; then block will never run if PULSAR_GC_LOG is set, will it?Zhenhao Li
02/10/2023, 8:15 PM