diff options
author | Seppo Jaakola <seppo.jaakola@codership.com> | 2013-08-07 00:17:16 +0300 |
---|---|---|
committer | Seppo Jaakola <seppo.jaakola@codership.com> | 2013-08-07 00:17:16 +0300 |
commit | 551ad1cf6f80ad1fab35746eee304d733baa9adf (patch) | |
tree | 120046ba39eaa403a7b9c0d3de0a03b5de0c1bbb | |
parent | 7cf10ddf8ca7044278b4aa1cf5a5525675cd101d (diff) | |
download | mariadb-git-551ad1cf6f80ad1fab35746eee304d733baa9adf.tar.gz |
Merged FreeBSD compatibility changes (up to revision 3893 in lp:~codership/codership-mysql/5.5-23)
-rw-r--r-- | .bzrignore | 3 | ||||
-rw-r--r-- | cmake/install_macros.cmake | 24 | ||||
-rw-r--r-- | cmake/os/FreeBSD.cmake | 3 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/wsrep_sst_rsync.sh | 64 | ||||
-rw-r--r-- | scripts/wsrep_sst_xtrabackup.sh | 179 | ||||
-rw-r--r-- | sql/wsrep_utils.cc | 2 |
7 files changed, 222 insertions, 58 deletions
diff --git a/.bzrignore b/.bzrignore index 8f44e83369a..858b00cf5c5 100644 --- a/.bzrignore +++ b/.bzrignore @@ -72,6 +72,9 @@ RelWithDebInfo .vimrc ac_available_languages_fragment BitKeeper/ +build_debug +build_install +build_release client/*.ds? client/completion_hash.cpp client/decimal.c diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 14e43ee5e95..f9ff1f5cf31 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -13,8 +13,30 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +if(APPLE) + LIST(APPEND CMAKE_CXX_LINK_EXECUTABLE "dsymutil <TARGET>") + LIST(APPEND CMAKE_C_LINK_EXECUTABLE "dsymutil <TARGET>") + LIST(APPEND CMAKE_CXX_CREATE_SHARED_LIBRARY "dsymutil <TARGET>") + LIST(APPEND CMAKE_C_CREATE_SHARED_LIBRARY "dsymutil <TARGET>") + LIST(APPEND CMAKE_CXX_CREATE_SHARED_MODULE "dsymutil <TARGET>") + LIST(APPEND CMAKE_C_CREATE_SHARED_MODULE "dsymutil <TARGET>") +ENDIF() + GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) +MACRO (INSTALL_DSYM_DIRECTORIES targets) + IF(APPLE) + FOREACH(target ${targets}) + GET_TARGET_PROPERTY(location ${target} LOCATION) + GET_TARGET_PROPERTY(type ${target} TYPE) + # It's a dirty hack, but cmake too stupid and mysql cmake files too buggy */ + STRING(REPLACE "liblibmysql.dylib" "libmysqlclient.${SHARED_LIB_MAJOR_VERSION}.dylib" location ${location}) + IF(type MATCHES "EXECUTABLE" OR type MATCHES "MODULE" OR type MATCHES "SHARED_LIBRARY") + INSTALL(DIRECTORY "${location}.dSYM" DESTINATION ${INSTALL_LOCATION} COMPONENT Debuginfo) + ENDIF() + ENDFOREACH() + ENDIF() +ENDMACRO() FUNCTION (INSTALL_DEBUG_SYMBOLS) IF(MSVC) @@ -31,6 +53,7 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS) MESSAGE(FATAL_ERROR "No INSTALL_LOCATION passed to INSTALL_DEBUG_SYMBOLS") ENDIF() SET(targets ${ARG_DEFAULT_ARGS}) + FOREACH(target ${targets}) GET_TARGET_PROPERTY(type ${target} TYPE) GET_TARGET_PROPERTY(location ${target} LOCATION) @@ -252,6 +275,7 @@ FUNCTION(MYSQL_INSTALL_TARGETS) INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP}) INSTALL_DEBUG_SYMBOLS(${TARGETS} ${COMP} INSTALL_LOCATION ${ARG_DESTINATION}) + INSTALL_DSYM_DIRECTORIES("${TARGETS}") ENDFUNCTION() diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake index 27afe679f25..32c39c48531 100644 --- a/cmake/os/FreeBSD.cmake +++ b/cmake/os/FreeBSD.cmake @@ -38,3 +38,6 @@ IF(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -march=i686") ENDIF() + +SET(HAVE_SYS_TIMEB_H CACHE INTERNAL "") + diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index d9c8e192d89..43a8508c7c0 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -241,7 +241,8 @@ wsrep_recover_position() { if [ -z "$rp" ]; then local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')" if [ -z "$skipped" ]; then - log_error "WSREP: Failed to recover position: " `cat $wr_logfile`; + log_error "WSREP: Failed to recover position: +'`cat $wr_logfile`'" ret=1 else log_notice "WSREP: Position recovery skipped" @@ -253,7 +254,7 @@ wsrep_recover_position() { wsrep_start_position_opt="--wsrep_start_position=$start_pos" fi - rm $wr_logfile + [ $ret -eq 0 ] && rm $wr_logfile return $ret } diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index af2d41f2659..7cd232e0887 100644..100755 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -20,6 +20,8 @@ RSYNC_PID= RSYNC_CONF= +OS=$(uname) +[ "$OS" == "Darwin" ] && export -n LD_LIBRARY_PATH . $(dirname $0)/wsrep_sst_common @@ -50,14 +52,32 @@ check_pid_and_port() local rsync_pid=$(cat $pid_file) local rsync_port=$2 - check_pid $pid_file && \ - netstat -anpt 2>/dev/null | \ - grep LISTEN | grep \:$rsync_port | grep $rsync_pid/rsync >/dev/null + if [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ]; then + # no netstat --program(-p) option in Darwin and FreeBSD + check_pid $pid_file && \ + lsof -i -Pn 2>/dev/null | \ + grep "(LISTEN)" | grep ":$rsync_port" | grep -w '^rsync[[:space:]]\+'"$rsync_pid" >/dev/null + else + check_pid $pid_file && \ + netstat -lnpt 2>/dev/null | \ + grep LISTEN | grep \:$rsync_port | grep $rsync_pid/rsync >/dev/null + fi } MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete" rm -rf "$MAGIC_FILE" +# Old filter - include everything except selected +# FILTER=(--exclude '*.err' --exclude '*.pid' --exclude '*.sock' \ +# --exclude '*.conf' --exclude core --exclude 'galera.*' \ +# --exclude grastate.txt --exclude '*.pem' \ +# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') + +# New filter - exclude everything except dirs (schemas) and innodb files +FILTER=(-f '- lost+found' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /ib_logfile*' -f '+ */' -f '-! */*') +# Old versions of rsync have a bug transferring filter rules to daemon, so specify filter rules directly to daemon +FILTER_DAEMON="- lost+found + /ib_lru_dump + /ibdata* + ib_logfile* + */ -! */*" + if [ "$WSREP_SST_OPT_ROLE" = "donor" ] then @@ -85,21 +105,12 @@ then sync - # Old filter - include everything except selected - # FILTER=(--exclude '*.err' --exclude '*.pid' --exclude '*.sock' \ - # --exclude '*.conf' --exclude core --exclude 'galera.*' \ - # --exclude grastate.txt --exclude '*.pem' \ - # --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') - - # New filter - exclude everything except dirs (schemas) and innodb files - FILTER=(-f '- lost+found' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /ib_logfile*' -f '+ */' -f '-! */*') - # first, the normal directories, so that we can detect incompatible protocol RC=0 rsync --archive --no-times --ignore-times --inplace --delete --quiet \ --no-recursive --dirs \ $WHOLE_FILE_OPT "${FILTER[@]}" "$WSREP_SST_OPT_DATA/" \ - rsync://$WSREP_SST_OPT_ADDR || RC=$? + rsync://$WSREP_SST_OPT_ADDR-with_filter || RC=$? [ $RC -ne 0 ] && wsrep_log_error "rsync returned code $RC:" @@ -122,9 +133,11 @@ then # then, we parallelize the transfer of database directories, use . so that pathconcatenation works pushd "$WSREP_SST_OPT_DATA" 1>/dev/null - count=$(grep -c processor /proc/cpuinfo) + count=1 + [ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo) + [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu) - find . -maxdepth 1 -mindepth 1 -type d -print0 | xargs -i -0 -P $count \ + find . -maxdepth 1 -mindepth 1 -type d -print0 | xargs -I{} -0 -P $count \ rsync --archive --no-times --ignore-times --inplace --delete --quiet \ $WHOLE_FILE_OPT "$WSREP_SST_OPT_DATA"/{}/ \ rsync://$WSREP_SST_OPT_ADDR/{} || RC=$? @@ -151,7 +164,7 @@ then echo "continue" # now server can resume updating data echo "$STATE" > "$MAGIC_FILE" - rsync -aqc "$MAGIC_FILE" rsync://$WSREP_SST_OPT_ADDR + rsync --archive --quiet --checksum "$MAGIC_FILE" rsync://$WSREP_SST_OPT_ADDR echo "done $STATE" @@ -180,7 +193,7 @@ then fi trap "exit 32" HUP PIPE - trap "exit 3" INT TERM + trap "exit 3" INT TERM ABRT trap cleanup_joiner EXIT MYUID=$(id -u) @@ -190,12 +203,19 @@ then cat << EOF > "$RSYNC_CONF" pid file = $RSYNC_PID use chroot = no +[$MODULE-with_filter] + path = $WSREP_SST_OPT_DATA + read only = no + timeout = 300 + uid = $MYUID + gid = $MYGID + filter = $FILTER_DAEMON [$MODULE] - path = $WSREP_SST_OPT_DATA - read only = no - timeout = 300 - uid = $MYUID - gid = $MYGID + path = $WSREP_SST_OPT_DATA + read only = no + timeout = 300 + uid = $MYUID + gid = $MYGID EOF # rm -rf "$DATA"/ib_logfile* # we don't want old logs around diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh index 16f29e6e358..3eb747f50c3 100644 --- a/scripts/wsrep_sst_xtrabackup.sh +++ b/scripts/wsrep_sst_xtrabackup.sh @@ -15,14 +15,25 @@ # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1301 USA. -# This is a reference script for Percona XtraBackup-based state snapshot tansfer -# Dependencies: (depending on configuration) -# xbcrypt for encryption/decryption. -# qpress for decompression. Download from http://www.quicklz.com/qpress-11-linux-x64.tar till -# https://blueprints.launchpad.net/percona-xtrabackup/+spec/package-qpress is fixed. -# my_print_defaults to extract values from my.cnf. -# netcat for transfer. -# xbstream for streaming. +############################################################################################################# +# This is a reference script for Percona XtraBackup-based state snapshot transfer # +# Dependencies: (depending on configuration) # +# xbcrypt for encryption/decryption. # +# qpress for decompression. Download from http://www.quicklz.com/qpress-11-linux-x64.tar till # +# https://blueprints.launchpad.net/percona-xtrabackup/+spec/package-qpress is fixed. # +# my_print_defaults to extract values from my.cnf. # +# netcat for transfer. # +# xbstream/tar for streaming. (and xtrabackup ofc) # +# # +# Currently only option in cnf is read specifically for SST # +# [sst] # +# streamfmt=tar|xbstream # +# # +# Default is tar till lp:1193240 is fixed # +# You need to use xbstream for encryption, compression etc., however, # +# lp:1193240 requires you to manually cleanup the directory prior to SST # +# # +############################################################################################################# . $(dirname $0)/wsrep_sst_common @@ -30,6 +41,13 @@ ealgo="" ekey="" ekeyfile="" encrypt=0 +nproc=1 +ecode=0 +XTRABACKUP_PID="" + +sfmt="tar" +strmcmd="" +declare -a RC get_keys() { @@ -39,6 +57,11 @@ get_keys() if ! my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q encrypt; then return fi + if [[ $sfmt == 'tar' ]];then + wsrep_log_info "NOTE: Encryption cannot be enabled with tar format" + return + fi + wsrep_log_info "Encryption enabled in my.cnf - not supported at the moment - Bug in Xtrabackup - lp:1190343" ealgo=$(my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -- '--encrypt=' | cut -d= -f2) ekey=$(my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -- '--encrypt-key=' | cut -d= -f2) @@ -56,10 +79,58 @@ get_keys() encrypt=1 } +read_cnf() +{ + sfmt=$(my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -- '--streamfmt' | cut -d= -f2) + if [[ $sfmt == 'xbstream' ]];then + wsrep_log_info "Streaming with xbstream" + if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then + wsrep_log_info "xbstream requires manual cleanup of data directory before SST - lp:1193240" + strmcmd="xbstream -x -C ${DATA}" + elif [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then + strmcmd="xbstream -c ${INFO_FILE} ${IST_FILE}" + else + wsrep_log_error "Invalid role: $WSREP_SST_OPT_ROLE" + exit 22 + fi + else + sfmt="tar" + wsrep_log_info "Streaming with tar" + wsrep_log_info "Note: Advanced xtrabackup features - encryption,compression etc. not available with tar." + if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then + wsrep_log_info "However, xbstream requires manual cleanup of data directory before SST - lp:1193240." + strmcmd="tar xfi - -C ${DATA}" + elif [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then + strmcmd="tar cf - ${INFO_FILE} ${IST_FILE}" + else + wsrep_log_error "Invalid role: $WSREP_SST_OPT_ROLE" + exit 22 + fi + + fi +} + +get_proc() +{ + set +e + nproc=$(grep -c processor /proc/cpuinfo) + [[ -z $nproc || $nproc -eq 0 ]] && nproc=1 + set -e +} + cleanup_joiner() { + # Since this is invoked just after exit NNN + local estatus=$? + if [[ $estatus -ne 0 ]];then + wsrep_log_error "Cleanup after exit with status:$estatus" + fi local PID=$(ps -aef |grep nc| grep $NC_PORT | awk '{ print $2 }') - wsrep_log_info "Killing nc pid $PID" + if [[ $estatus -ne 0 ]];then + wsrep_log_error "Killing nc pid $PID" + else + wsrep_log_info "Killing nc pid $PID" + fi [ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || : rm -f "$MAGIC_FILE" if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then @@ -74,6 +145,24 @@ check_pid() [ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1 } +cleanup_donor() +{ + # Since this is invoked just after exit NNN + local estatus=$? + if [[ $estatus -ne 0 ]];then + wsrep_log_error "Cleanup after exit with status:$estatus" + fi + local pid=$XTRABACKUP_PID + if check_pid "$pid" + then + wsrep_log_error "xtrabackup process is still running. Killing... " + kill_xtrabackup + fi + + rm -f "$pid" + rm -f ${DATA}/${IST_FILE} +} + kill_xtrabackup() { #set -x @@ -123,12 +212,11 @@ IST_FILE="xtrabackup_ist" MAGIC_FILE="${DATA}/${INFO_FILE}" rm -f "${MAGIC_FILE}" +read_cnf + if [ "$WSREP_SST_OPT_ROLE" = "donor" ] then - -# UUID=$6 -# SEQNO=$7 -# BYPASS=$8 + trap cleanup_donor EXIT NC_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') @@ -137,7 +225,7 @@ then then TMPDIR="/tmp" - INNOBACKUPEX_ARGS="--galera-info --stream=xbstream + INNOBACKUPEX_ARGS="--galera-info --stream=$sfmt --defaults-file=${WSREP_SST_OPT_CONF} --socket=${WSREP_SST_OPT_SOCKET}" @@ -152,7 +240,6 @@ then INNOBACKUPEX_ARGS="${INNOBACKUPEX_ARGS} --password=" fi - get_keys if [[ $encrypt -eq 1 ]];then if [[ -n $ekey ]];then @@ -162,6 +249,8 @@ then fi fi + wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${NC_PORT}" + set +e ${INNOBACKUPEX_BIN} ${INNOBACKUPEX_ARGS} ${TMPDIR} \ 2> ${DATA}/innobackup.backup.log | \ @@ -182,31 +271,37 @@ then # innobackupex implicitly writes PID to fixed location in ${TMPDIR} XTRABACKUP_PID="${TMPDIR}/xtrabackup_pid" - if check_pid "${XTRABACKUP_PID}" - then - wsrep_log_error "xtrabackup process is still running. Killing... " - kill_xtrabackup - exit 22 - fi - - rm -f "${XTRABACKUP_PID}" else # BYPASS + wsrep_log_info "Bypassing the SST for IST" STATE="${WSREP_SST_OPT_GTID}" echo "continue" # now server can resume updating data echo "${STATE}" > "${MAGIC_FILE}" echo "1" > "${DATA}/${IST_FILE}" get_keys + pushd ${DATA} 1>/dev/null + set +e if [[ $encrypt -eq 1 ]];then if [[ -n $ekey ]];then - (cd ${DATA}; xbstream -c ${INFO_FILE} ${IST_FILE} | xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey) | ${NC_BIN} ${REMOTEIP} ${NC_PORT} + xbstream -c ${INFO_FILE} ${IST_FILE} | xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey | ${NC_BIN} ${REMOTEIP} ${NC_PORT} else - (cd ${DATA}; xbstream -c ${INFO_FILE} ${IST_FILE} | xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile) | ${NC_BIN} ${REMOTEIP} ${NC_PORT} + xbstream -c ${INFO_FILE} ${IST_FILE} | xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile | ${NC_BIN} ${REMOTEIP} ${NC_PORT} fi - else - (cd ${DATA}; xbstream -c ${INFO_FILE} ${IST_FILE}) | ${NC_BIN} ${REMOTEIP} ${NC_PORT} + else + $strmcmd | ${NC_BIN} ${REMOTEIP} ${NC_PORT} fi - rm -f ${DATA}/${IST_FILE} + RC=( "${PIPESTATUS[@]}" ) + set -e + popd 1>/dev/null + + for ecode in "${RC[@]}";do + if [[ $ecode -ne 0 ]];then + wsrep_log_error "Error while streaming data to joiner node: " \ + "exit codes: ${RC[@]}" + exit 1 + fi + done + #rm -f ${DATA}/${IST_FILE} fi echo "done ${WSREP_SST_OPT_GTID}" @@ -217,8 +312,7 @@ then touch $SST_PROGRESS_FILE sencrypted=1 - ecode=0 - declare -a RC + nthreads=1 MODULE="xtrabackup_sst" @@ -247,11 +341,21 @@ then ${NC_BIN} -dl ${NC_PORT} | xbcrypt -d --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile | xbstream -x -C ${DATA} fi else - ${NC_BIN} -dl ${NC_PORT} | xbstream -x -C ${DATA} + ${NC_BIN} -dl ${NC_PORT} | $strmcmd fi RC=( "${PIPESTATUS[@]}" ) set -e + if [[ $sfmt == 'xbstream' ]];then + # Special handling till lp:1193240 is fixed" + if [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then + wsrep_log_error "Xbstream failed" + wsrep_log_error "Data directory ${DATA} needs to be empty for SST: lp:1193240" \ + "Manual intervention required in that case" + exit 32 + fi + fi + wait %% # join wait_for_nc thread for ecode in "${RC[@]}";do @@ -279,6 +383,7 @@ then if [ ! -r "${IST_FILE}" ] then + wsrep_log_info "Proceeding with SST" rebuild="" wsrep_log_info "Removing existing ib_logfile files" rm -f ${DATA}/ib_logfile* @@ -306,10 +411,15 @@ then fi fi + get_proc + # Rebuild indexes for compact backups if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then wsrep_log_info "Index compaction detected" - rebuild="--rebuild-indexes" + nthreads=$(my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -- '--rebuild-threads' | cut -d= -f2) + [[ -z $nthreads ]] && nthreads=$nproc + wsrep_log_info "Rebuilding with $nthreads threads" + rebuild="--rebuild-indexes --rebuild-threads=$nthreads" fi if test -n "$(find ${DATA} -maxdepth 1 -name '*.qp' -print -quit)";then @@ -327,7 +437,8 @@ then rm -f ${DATA}/ibdata1 # Decompress the qpress files - find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | xargs -P $(grep -c processor /proc/cpuinfo) -n 2 qpress -d + wsrep_log_info "Decompression with $nproc threads" + find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | xargs -P $nproc -n 2 qpress -d extcode=$? set -e @@ -354,7 +465,7 @@ then exit 22 fi else - wsrep_log_info "Running IST" + wsrep_log_info "${IST_FILE} received from donor: Running IST" fi cat "${MAGIC_FILE}" # output UUID:seqno diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc index 392fb65d82c..19ffb101841 100644 --- a/sql/wsrep_utils.cc +++ b/sql/wsrep_utils.cc @@ -358,6 +358,8 @@ size_t guess_ip (char* buf, size_t buf_len) #elif defined(__sun__) const char cmd[] = "/sbin/ifconfig -a | " "/usr/gnu/bin/grep -m1 -1 -E 'net[0-9]:' | tail -n 1 | awk '{ print $2 }'"; +#elif defined(__APPLE__) || defined(__FreeBSD__) + const char cmd[] = "route -nv get 8.8.8.8 | tail -n1 | awk '{print $5}'"; #else char *cmd; #error "OS not supported" |