From 489980f4e5129622e63247dccbb89a27d6726aac Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 24 Aug 2015 11:49:11 +0300 Subject: [PATCH 1/3] Moved unpack_rpm.sh from root to script directory. --- unpack_rpm.sh => develop | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename unpack_rpm.sh => develop (100%) diff --git a/unpack_rpm.sh b/develop similarity index 100% rename from unpack_rpm.sh rename to develop From 082c3b6f9c5035c9796589df4bb8bc8e148e4dfc Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 24 Aug 2015 13:05:07 +0300 Subject: [PATCH 2/3] Utility for mapping binary+address to source-file + line. --- script/stacktrace | 87 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 script/stacktrace diff --git a/script/stacktrace b/script/stacktrace new file mode 100755 index 000000000..328233017 --- /dev/null +++ b/script/stacktrace @@ -0,0 +1,87 @@ +#!/bin/bash + +# How we recognize whether a line in the file is from the stack-trace. +STACK_LINE=".*\(.*\) \[.*\]" +# How we match the date + time part of a line. +DATE_TIME="[0-9]\+-[0-9]\+-[0-9]\+ [0-9]\+:[0-9]\+:[0-9]\+" + +function print_usage { + echo "usage: stacktrace [-p prefix] [stacktrace.txt]" + echo + echo "-p frefix: The path prefix (e.g. /usr/local/mariadb-maxscale/) " + echo " to remove when searching for files." + echo + echo "stacktrace.txt: A file containing a stack-trace." + exit 1 +} + +function print_usage_and_exit { + print_usage + exit 1 +} + +function parse_stack_trace { + local prefix=$1 + local file=$2 + + cat $file | egrep "$STACK_LINE" | sed "s/$DATE_TIME//" | \ + while read line + do + local path=${line%%(*} + local entry="("${line##*(} + + path=${path#$prefix} + + if [ -e "${path}" ] + then + file ${path} | fgrep -q executable + let rc=$? + local address; + + if [ $rc -eq 0 ] + then + address=${entry#*\[} + address=${address%\]*} + else + address=${entry#*\+} + address=${address%\)*} + fi + + addr2line -e ${path} ${address} + else + echo ${line} + fi + done +} + +function main { + local prefix + local key + + while [[ $# > 1 ]] + do + key="$1" + + case $key in + -h) + print_usage + exit + ;; + -p|--prefix) + prefix="$2"; + shift + ;; + + *) + echo "error: Unknown parameter $key" + print_usage_and_exit + esac + shift + done + + local file=$1 + + parse_stack_trace "$prefix" "$file" +} + +main $* From 1731a90fad383c0ba50bc916e464e64908098e48 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Tue, 25 Aug 2015 11:37:17 +0200 Subject: [PATCH 3/3] Fix for lastEventTimestamp localtime Fix for lastEventTimestamp localtime computation --- server/modules/routing/binlog/blr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/binlog/blr.c b/server/modules/routing/binlog/blr.c index 630665628..ca853b1e6 100644 --- a/server/modules/routing/binlog/blr.c +++ b/server/modules/routing/binlog/blr.c @@ -854,7 +854,8 @@ struct tm tm; if (router_inst->lastEventTimestamp) { - localtime_r((const time_t*)&router_inst->lastEventTimestamp, &tm); + time_t last_event = (time_t)router_inst->lastEventTimestamp; + localtime_r(&last_event, &tm); asctime_r(&tm, buf); dcb_printf(dcb, "\tLast binlog event timestamp: %ld (%s)\n", router_inst->lastEventTimestamp, buf); @@ -982,7 +983,8 @@ struct tm tm; if (session->lastEventTimestamp && router_inst->lastEventTimestamp) { - localtime_r((const time_t*)&session->lastEventTimestamp, &tm); + time_t session_last_event = (time_t)session->lastEventTimestamp; + localtime_r(&session_last_event, &tm); asctime_r(&tm, buf); dcb_printf(dcb, "\t\tLast binlog event timestamp %u, %s", session->lastEventTimestamp, buf); dcb_printf(dcb, "\t\tSeconds behind master %u\n", router_inst->lastEventTimestamp - session->lastEventTimestamp);