From 554ca98c1b4ee6504b572b052ad285143f9e9076 Mon Sep 17 00:00:00 2001 From: deajan Date: Wed, 27 Jul 2016 17:55:31 +0200 Subject: [PATCH] Removed parallelism from unlock function for now --- dev/debug_osync.sh | 25 ++++++++++--------------- dev/n_osync.sh | 25 ++++++++++--------------- osync.sh | 25 ++++++++++--------------- 3 files changed, 30 insertions(+), 45 deletions(-) diff --git a/dev/debug_osync.sh b/dev/debug_osync.sh index 3ae1df7..a468917 100755 --- a/dev/debug_osync.sh +++ b/dev/debug_osync.sh @@ -4,7 +4,7 @@ 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-unstable -PROGRAM_BUILD=2016072704 +PROGRAM_BUILD=2016072705 IS_STABLE=no ## FUNC_BUILD=2016072702 @@ -1450,7 +1450,7 @@ function WaitForPids { fi fi done - sleep .1 + sleep .01 done if [ $errors -gt 0 ]; then exit 1 @@ -1780,20 +1780,18 @@ function UnlockReplicas { return 0 fi + #TODO: Cannot parallelize unlockreplicasremote until waitfortaskcompletion is removed if [ $LOCK_LOCAL -eq 1 ]; then - _UnlockReplicasLocal "${INITIATOR[2]}" & - pids="$!" + _UnlockReplicasLocal "${INITIATOR[2]}" fi if [ "$REMOTE_OPERATION" != "yes" ]; then if [ $LOCK_LOCAL -eq 1 ]; then - _UnlockReplicasLocal "${TARGET[2]}" & - pids="$pids $!" + _UnlockReplicasLocal "${TARGET[2]}" fi else if [ $LOCK_REMOTE -eq 1 ]; then - _UnlockReplicasRemote "${TARGET[2]}" & - pids="$pids $!" + _UnlockReplicasRemote "${TARGET[2]}" fi fi } @@ -1952,19 +1950,16 @@ function sync_attrs { fi fi + #TODO _get_file_ctime_mtime_remote can be sent into background only if waitfortaskcompletion is removed from sub function 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" & - pids="$!" + _get_file_ctime_mtime_local "${INITIATOR[1]}" "${INITIATOR[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" 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" & - pids="$pids $!" + _get_file_ctime_mtime_local "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" else - _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & - pids="$pids $!" + _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" 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 ae8c898..3f9c3fb 100755 --- a/dev/n_osync.sh +++ b/dev/n_osync.sh @@ -4,7 +4,7 @@ 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-unstable -PROGRAM_BUILD=2016072704 +PROGRAM_BUILD=2016072705 IS_STABLE=no source "./ofunctions.sh" @@ -202,7 +202,7 @@ function WaitForPids { fi fi done - sleep .1 + sleep .01 done if [ $errors -gt 0 ]; then exit 1 @@ -532,20 +532,18 @@ function UnlockReplicas { return 0 fi + #TODO: Cannot parallelize unlockreplicasremote until waitfortaskcompletion is removed if [ $LOCK_LOCAL -eq 1 ]; then - _UnlockReplicasLocal "${INITIATOR[2]}" & - pids="$!" + _UnlockReplicasLocal "${INITIATOR[2]}" fi if [ "$REMOTE_OPERATION" != "yes" ]; then if [ $LOCK_LOCAL -eq 1 ]; then - _UnlockReplicasLocal "${TARGET[2]}" & - pids="$pids $!" + _UnlockReplicasLocal "${TARGET[2]}" fi else if [ $LOCK_REMOTE -eq 1 ]; then - _UnlockReplicasRemote "${TARGET[2]}" & - pids="$pids $!" + _UnlockReplicasRemote "${TARGET[2]}" fi fi } @@ -704,19 +702,16 @@ function sync_attrs { fi fi + #TODO _get_file_ctime_mtime_remote can be sent into background only if waitfortaskcompletion is removed from sub function 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" & - pids="$!" + _get_file_ctime_mtime_local "${INITIATOR[1]}" "${INITIATOR[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" 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" & - pids="$pids $!" + _get_file_ctime_mtime_local "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" else - _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & - pids="$pids $!" + _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" 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 ab474c9..a7db1f4 100755 --- a/osync.sh +++ b/osync.sh @@ -4,7 +4,7 @@ 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-unstable -PROGRAM_BUILD=2016072704 +PROGRAM_BUILD=2016072705 IS_STABLE=no ## FUNC_BUILD=2016072702 @@ -1372,7 +1372,7 @@ function WaitForPids { fi fi done - sleep .1 + sleep .01 done if [ $errors -gt 0 ]; then exit 1 @@ -1686,20 +1686,18 @@ function UnlockReplicas { return 0 fi + #TODO: Cannot parallelize unlockreplicasremote until waitfortaskcompletion is removed if [ $LOCK_LOCAL -eq 1 ]; then - _UnlockReplicasLocal "${INITIATOR[2]}" & - pids="$!" + _UnlockReplicasLocal "${INITIATOR[2]}" fi if [ "$REMOTE_OPERATION" != "yes" ]; then if [ $LOCK_LOCAL -eq 1 ]; then - _UnlockReplicasLocal "${TARGET[2]}" & - pids="$pids $!" + _UnlockReplicasLocal "${TARGET[2]}" fi else if [ $LOCK_REMOTE -eq 1 ]; then - _UnlockReplicasRemote "${TARGET[2]}" & - pids="$pids $!" + _UnlockReplicasRemote "${TARGET[2]}" fi fi } @@ -1853,19 +1851,16 @@ function sync_attrs { fi fi + #TODO _get_file_ctime_mtime_remote can be sent into background only if waitfortaskcompletion is removed from sub function 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" & - pids="$!" + _get_file_ctime_mtime_local "${INITIATOR[1]}" "${INITIATOR[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" 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" & - pids="$pids $!" + _get_file_ctime_mtime_local "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" else - _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" & - pids="$pids $!" + _get_file_ctime_mtime_remote "${TARGET[1]}" "${TARGET[0]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID" fi - WaitForPids $pids # If target gets updated first, then sync_attr must update initiator's attrs first # For join, remove leading replica paths