From 3e9bc05d67f54ecdb1a94352b7b7179a0443bd02 Mon Sep 17 00:00:00 2001 From: deajan Date: Wed, 27 Jul 2016 14:10:59 +0200 Subject: [PATCH] More parallism --- dev/debug_osync.sh | 19 +++++++++++-------- dev/n_osync.sh | 19 +++++++++++-------- osync.sh | 19 +++++++++++-------- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/dev/debug_osync.sh b/dev/debug_osync.sh index 086b69d..3ae1df7 100755 --- a/dev/debug_osync.sh +++ b/dev/debug_osync.sh @@ -3,9 +3,9 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(C) 2013-2016 by Orsiris de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" -PROGRAM_VERSION=1.2-dev-parallel -PROGRAM_BUILD=2016072703 -IS_STABLE=yes +PROGRAM_VERSION=1.2-dev-parallel-unstable +PROGRAM_BUILD=2016072704 +IS_STABLE=no ## FUNC_BUILD=2016072702 ## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr @@ -1620,7 +1620,7 @@ function _WriteLockFilesRemote { exit 1 else Logger "Locked remote target replica." "DEBUG" - LOCK_REMOTE_1 + LOCK_REMOTE=1 fi } @@ -1953,15 +1953,18 @@ function sync_attrs { fi Logger "Getting ctimes for pending files on initiator." "NOTICE" - _get_file_ctime_mtime_local "${INITIATOR[1]}" "${INITIATOR[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" + _get_file_ctime_mtime_local "${INITIATOR[1]}" "${INITIATOR[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & + pids="$!" Logger "Getting ctimes for pending files on target." "NOTICE" if [ "$REMOTE_OPERATION" != "yes" ]; then - _get_file_ctime_mtime_local "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" + _get_file_ctime_mtime_local "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & + pids="$pids $!" else - _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" + _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & + pids="$pids $!" fi - + WaitForPids $pids # If target gets updated first, then sync_attr must update initiator's attrs first # For join, remove leading replica paths diff --git a/dev/n_osync.sh b/dev/n_osync.sh index cd17a16..ae8c898 100755 --- a/dev/n_osync.sh +++ b/dev/n_osync.sh @@ -3,9 +3,9 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(C) 2013-2016 by Orsiris de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" -PROGRAM_VERSION=1.2-dev-parallel -PROGRAM_BUILD=2016072703 -IS_STABLE=yes +PROGRAM_VERSION=1.2-dev-parallel-unstable +PROGRAM_BUILD=2016072704 +IS_STABLE=no source "./ofunctions.sh" @@ -372,7 +372,7 @@ function _WriteLockFilesRemote { exit 1 else Logger "Locked remote target replica." "DEBUG" - LOCK_REMOTE_1 + LOCK_REMOTE=1 fi } @@ -705,15 +705,18 @@ function sync_attrs { fi Logger "Getting ctimes for pending files on initiator." "NOTICE" - _get_file_ctime_mtime_local "${INITIATOR[1]}" "${INITIATOR[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" + _get_file_ctime_mtime_local "${INITIATOR[1]}" "${INITIATOR[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & + pids="$!" Logger "Getting ctimes for pending files on target." "NOTICE" if [ "$REMOTE_OPERATION" != "yes" ]; then - _get_file_ctime_mtime_local "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" + _get_file_ctime_mtime_local "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & + pids="$pids $!" else - _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" + _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & + pids="$pids $!" fi - + WaitForPids $pids # If target gets updated first, then sync_attr must update initiator's attrs first # For join, remove leading replica paths diff --git a/osync.sh b/osync.sh index aa5c98c..ab474c9 100755 --- a/osync.sh +++ b/osync.sh @@ -3,9 +3,9 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(C) 2013-2016 by Orsiris de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" -PROGRAM_VERSION=1.2-dev-parallel -PROGRAM_BUILD=2016072703 -IS_STABLE=yes +PROGRAM_VERSION=1.2-dev-parallel-unstable +PROGRAM_BUILD=2016072704 +IS_STABLE=no ## FUNC_BUILD=2016072702 ## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr @@ -1533,7 +1533,7 @@ function _WriteLockFilesRemote { exit 1 else Logger "Locked remote target replica." "DEBUG" - LOCK_REMOTE_1 + LOCK_REMOTE=1 fi } @@ -1854,15 +1854,18 @@ function sync_attrs { fi Logger "Getting ctimes for pending files on initiator." "NOTICE" - _get_file_ctime_mtime_local "${INITIATOR[1]}" "${INITIATOR[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" + _get_file_ctime_mtime_local "${INITIATOR[1]}" "${INITIATOR[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & + pids="$!" Logger "Getting ctimes for pending files on target." "NOTICE" if [ "$REMOTE_OPERATION" != "yes" ]; then - _get_file_ctime_mtime_local "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" + _get_file_ctime_mtime_local "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & + pids="$pids $!" else - _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" + _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & + pids="$pids $!" fi - + WaitForPids $pids # If target gets updated first, then sync_attr must update initiator's attrs first # For join, remove leading replica paths