Skip to content

Commit

Permalink
fix bkenv has no effect bug when start bookie using bin/pulsar-daemon (
Browse files Browse the repository at this point in the history
…apache#5675)

when i start bookie using `bin/pulsar-daemon start bookie` command, i found the bookie environment variable defined in conf/bkenv.sh has no effect, but using $PULSAR_MEM and $PULSAR_GC instead.

Then i check the bin/pulsar shell script, i found as follow:
```
elif [ $COMMAND == "bookie" ]; then
    PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"bookkeeper.log"}
    # Pass BOOKIE_EXTRA_OPTS option defined in pulsar_env.sh
    OPTS="$OPTS $BOOKIE_EXTRA_OPTS"
    exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.bookkeeper.proto.BookieServer --conf $PULSAR_BOOKKEEPER_CONF $@
```
but in pulsar_env.sh, the `$BOOKIE_EXTRA_OPTS` defined as follow:
```
# Set BOOKIE_EXTRA_OPTS option here to ensure that all pulsar scripts can work seamless with bookkeeper

# Extra options to be passed to the jvm
BOOKIE_EXTRA_OPTS="${BOOKIE_EXTRA_OPTS} -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.maxCapacity.default=1000 -Dio.netty.recycler.linkCapacity=1024"
```
`$BOOKIE_EXTRA_OPTS` do not define `$BOOKIE_MEM` and `$BOOKIE_GC`, then the pulsar script will using `$PULSAR_MEM` and `$PULSAR_GC` instead to start bookkeeper.

So, i suggest to load conf/bkenv.sh in bin/pulsar script and using `$BOOKIE_EXTRA_OPTS` in conf/bkenv.sh instread of `$BOOKIE_EXTRA_OPTS` in bin/pulsar_env.sh
  • Loading branch information
hangc0276 authored and sijie committed Nov 19, 2019
1 parent d16e79a commit 16affa0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
6 changes: 6 additions & 0 deletions bin/pulsar
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ FUNCTIONS_EXTRA_DEPS_DIR=${PULSAR_FUNCTIONS_EXTRA_DEPS_DIR:-"${DEFAULT_FUNCTIONS
SQL_HOME=$PULSAR_HOME/pulsar-sql
PRESTO_HOME=${PULSAR_HOME}/lib/presto

# Check bookkeeper env and load bkenv.sh
if [ -f "$PULSAR_HOME/conf/bkenv.sh" ]
then
. "$PULSAR_HOME/conf/bkenv.sh"
fi

# Check pulsar env and load pulser_env.sh
if [ -f "$PULSAR_HOME/conf/pulsar_env.sh" ]
then
. "$PULSAR_HOME/conf/pulsar_env.sh"
Expand Down
6 changes: 6 additions & 0 deletions bin/pulsar-daemon
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ EOF
BINDIR=$(dirname "$0")
PULSAR_HOME=$(cd $BINDIR/..;pwd)

# Check bookkeeper env and load bkenv.sh
if [ -f "$PULSAR_HOME/conf/bkenv.sh" ]
then
. "$PULSAR_HOME/conf/bkenv.sh"
fi

if [ -f "$PULSAR_HOME/conf/pulsar_env.sh" ]
then
. "$PULSAR_HOME/conf/pulsar_env.sh"
Expand Down
6 changes: 6 additions & 0 deletions bin/pulsar-perf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ PULSAR_HOME=`cd $BINDIR/..;pwd`
DEFAULT_CLIENT_CONF=${PULSAR_CLIENT_CONF:-"$PULSAR_HOME/conf/client.conf"}
DEFAULT_LOG_CONF=$PULSAR_HOME/conf/log4j2.yaml

# Check bookkeeper env and load bkenv.sh
if [ -f "$PULSAR_HOME/conf/bkenv.sh" ]
then
. "$PULSAR_HOME/conf/bkenv.sh"
fi

if [ -f "$PULSAR_HOME/conf/pulsar_env.sh" ]
then
. "$PULSAR_HOME/conf/pulsar_env.sh"
Expand Down
4 changes: 0 additions & 4 deletions conf/pulsar_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,3 @@ PULSAR_EXTRA_OPTS=${PULSAR_EXTRA_OPTS:-" -Dpulsar.allocator.exit_on_oom=true -Di
#Wait time before forcefully kill the pulser server instance, if the stop is not successful
#PULSAR_STOP_TIMEOUT=

# Set BOOKIE_EXTRA_OPTS option here to ensure that all pulsar scripts can work seamless with bookkeeper

# Extra options to be passed to the jvm
BOOKIE_EXTRA_OPTS="${BOOKIE_EXTRA_OPTS} -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.maxCapacity.default=1000 -Dio.netty.recycler.linkCapacity=1024"
6 changes: 6 additions & 0 deletions src/pulsar-io-gen
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ PULSAR_HOME=`cd $BINDIR/..;pwd`

DEFAULT_LOG_CONF=$PULSAR_HOME/conf/log4j2.yaml

# Check bookkeeper env and load bkenv.sh
if [ -f "$PULSAR_HOME/conf/bkenv.sh" ]
then
. "$PULSAR_HOME/conf/bkenv.sh"
fi

if [ -f "$PULSAR_HOME/conf/pulsar_env.sh" ]
then
. "$PULSAR_HOME/conf/pulsar_env.sh"
Expand Down

0 comments on commit 16affa0

Please sign in to comment.