Skip to content

Commit

Permalink
Merge 3d53f7c into 732141c
Browse files Browse the repository at this point in the history
  • Loading branch information
xieliang committed Jan 11, 2017
2 parents 732141c + 3d53f7c commit 8c53133
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
4 changes: 2 additions & 2 deletions distributedlog-benchmark/bin/common.sh
Expand Up @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties"
[ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh"

# exclude tests jar
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)
if [ $? == 0 ]; then
DLOG_JAR="${RELEASE_JAR}"
fi

# exclude tests jar
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)

if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then
echo "\nCouldn't find dlog jar.";
Expand Down
4 changes: 2 additions & 2 deletions distributedlog-core/bin/common.sh
Expand Up @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties"
[ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh"

# exclude tests jar
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)
if [ $? == 0 ]; then
DLOG_JAR="${RELEASE_JAR}"
fi

# exclude tests jar
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)

if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then
echo "\nCouldn't find dlog jar.";
Expand Down
4 changes: 2 additions & 2 deletions distributedlog-service/bin/common.sh
Expand Up @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties"
[ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh"

# exclude tests jar
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)
if [ $? == 0 ]; then
DLOG_JAR="${RELEASE_JAR}"
fi

# exclude tests jar
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)

if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then
echo "\nCouldn't find dlog jar.";
Expand Down
4 changes: 2 additions & 2 deletions distributedlog-tutorials/distributedlog-basic/bin/common.sh
Expand Up @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties"
[ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh"

# exclude tests jar
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)
if [ $? == 0 ]; then
DLOG_JAR="${RELEASE_JAR}"
fi

# exclude tests jar
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)

if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then
echo "\nCouldn't find dlog jar.";
Expand Down
Expand Up @@ -54,13 +54,13 @@ DEFAULT_LOG_CONF="${DLOG_HOME}/conf/log4j.properties"
[ -f "${DLOG_HOME}/conf/dlogenv.sh" ] && source "${DLOG_HOME}/conf/dlogenv.sh"

# exclude tests jar
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
RELEASE_JAR=$(ls ${DLOG_HOME}/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)
if [ $? == 0 ]; then
DLOG_JAR="${RELEASE_JAR}"
fi

# exclude tests jar
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests|javadoc|sources' | tail -1)
BUILT_JAR=$(ls ${DLOG_HOME}/target/distributedlog-*.jar 2> /dev/null | grep -v 'tests\|javadoc\|sources' | tail -1)

if [ -e "${BUILD_JAR}" ] && [ -e "${DLOG_JAR}" ]; then
echo "\nCouldn't find dlog jar.";
Expand Down
26 changes: 23 additions & 3 deletions scripts/integration/smoketest.sh
Expand Up @@ -42,10 +42,17 @@ export WP_NAMESPACE="distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE
SMOKESTREAM_PREFIX="smoketest-stream-"

# start the sandbox
echo "start sandbox"
nohup ${DLOG_ROOT}/distributedlog-service/bin/dlog local ${ZK_PORT} > ${LOG_DIR}/sandbox.out 2>&1&

if [ $? -ne 0 ]; then
echo "Failed to start sandbox"
exit 1
fi
echo $! > ${LOG_DIR}/sandbox.pid

# create namespace
echo "create namespace"
${DLOG_ROOT}/distributedlog-core/bin/dlog admin bind -l /ledgers -s 127.0.0.1:${ZK_PORT} -c distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE}

if [ $? -ne 0 ]; then
Expand All @@ -54,6 +61,7 @@ if [ $? -ne 0 ]; then
fi

# create streams
echo "create streams"
${DLOG_ROOT}/distributedlog-service/bin/dlog tool create -u distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE} -r ${SMOKESTREAM_PREFIX} -e 1-5 -f

if [ $? -ne 0 ]; then
Expand All @@ -62,6 +70,7 @@ if [ $? -ne 0 ]; then
fi

# list streams
echo "list streams"
STREAM_OUTPUT=$(${DLOG_ROOT}/distributedlog-service/bin/dlog tool list -u distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE} | grep "${SMOKESTREAM_PREFIX}")

echo "Create streams : ${STREAM_OUTPUT}."
Expand All @@ -74,34 +83,43 @@ for i in {1..5}; do
done

# start a write proxy
echo "start a write proxy"
${DLOG_ROOT}/distributedlog-service/bin/dlog-daemon.sh start writeproxy

# tail the the streams
# tail the streams
echo "tail the streams"
nohup ${DLOG_ROOT}/distributedlog-tutorials/distributedlog-basic/bin/runner run org.apache.distributedlog.basic.MultiReader distributedlog://127.0.0.1:${ZK_PORT}/messaging/${NAMESPACE} ${SMOKESTREAM_PREFIX}1,${SMOKESTREAM_PREFIX}2,${SMOKESTREAM_PREFIX}3,${SMOKESTREAM_PREFIX}4,${SMOKESTREAM_PREFIX}5 > ${LOG_DIR}/reader.out 2>&1&
echo $! > ${LOG_DIR}/reader.pid

# generate the records
echo "generate the records"
nohup ${DLOG_ROOT}/distributedlog-tutorials/distributedlog-basic/bin/runner run org.apache.distributedlog.basic.RecordGenerator "inet!127.0.0.1:${WP_SERVICE_PORT}" ${SMOKESTREAM_PREFIX}1 1 > ${LOG_DIR}/writer.out 2>&1&
echo $! > ${LOG_DIR}/writer.pid

# wait for 20 seconds
echo "sleep 20"
sleep 20

# kill the writer
echo "kill the writer"
if [ -f ${LOG_DIR}/writer.pid ]; then
writerpid=$(cat ${LOG_DIR}/writer.pid)
if kill -0 $writerpid > /dev/null 2>&1; then
echo "kill $writerpid"
kill $writerpid
fi
fi

# stop the reader
# kill the reader
echo "kill the reader"
if [ -f ${LOG_DIR}/reader.pid ]; then
readerpid=$(cat ${LOG_DIR}/reader.pid)
if kill -0 $readerpid > /dev/null 2>&1; then
echo "kill $readerpid"
kill $readerpid
fi
fi
ps ax | grep MultiReader | grep java | grep -v grep | awk '{print $1}' | xargs kill -9

# check the number of records received
NUM_RECORDS=`cat ${LOG_DIR}/reader.out | grep "record-" | wc -l`
Expand All @@ -114,10 +132,12 @@ if [ $NUM_RECORDS -lt 18 ]; then
exit 1
fi

# stop a write proxy
# stop the write proxy
echo "stop the write proxy"
${DLOG_ROOT}/distributedlog-service/bin/dlog-daemon.sh stop writeproxy

# stop the sandbox
echo "stop the sandbox"
kill `cat ${LOG_DIR}/sandbox.pid`

exit 0

0 comments on commit 8c53133

Please sign in to comment.