Removed parallelism from unlock function for now

This commit is contained in:
deajan 2016-07-27 17:55:31 +02:00
parent 3e9bc05d67
commit 554ca98c1b
3 changed files with 30 additions and 45 deletions

View File

@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(C) 2013-2016 by Orsiris de Jong" AUTHOR="(C) 2013-2016 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.2-dev-parallel-unstable PROGRAM_VERSION=1.2-dev-parallel-unstable
PROGRAM_BUILD=2016072704 PROGRAM_BUILD=2016072705
IS_STABLE=no IS_STABLE=no
## FUNC_BUILD=2016072702 ## FUNC_BUILD=2016072702
@ -1450,7 +1450,7 @@ function WaitForPids {
fi fi
fi fi
done done
sleep .1 sleep .01
done done
if [ $errors -gt 0 ]; then if [ $errors -gt 0 ]; then
exit 1 exit 1
@ -1780,20 +1780,18 @@ function UnlockReplicas {
return 0 return 0
fi fi
#TODO: Cannot parallelize unlockreplicasremote until waitfortaskcompletion is removed
if [ $LOCK_LOCAL -eq 1 ]; then if [ $LOCK_LOCAL -eq 1 ]; then
_UnlockReplicasLocal "${INITIATOR[2]}" & _UnlockReplicasLocal "${INITIATOR[2]}"
pids="$!"
fi fi
if [ "$REMOTE_OPERATION" != "yes" ]; then if [ "$REMOTE_OPERATION" != "yes" ]; then
if [ $LOCK_LOCAL -eq 1 ]; then if [ $LOCK_LOCAL -eq 1 ]; then
_UnlockReplicasLocal "${TARGET[2]}" & _UnlockReplicasLocal "${TARGET[2]}"
pids="$pids $!"
fi fi
else else
if [ $LOCK_REMOTE -eq 1 ]; then if [ $LOCK_REMOTE -eq 1 ]; then
_UnlockReplicasRemote "${TARGET[2]}" & _UnlockReplicasRemote "${TARGET[2]}"
pids="$pids $!"
fi fi
fi fi
} }
@ -1952,19 +1950,16 @@ function sync_attrs {
fi fi
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" 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" Logger "Getting ctimes for pending files on target." "NOTICE"
if [ "$REMOTE_OPERATION" != "yes" ]; then 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 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 fi
WaitForPids $pids
# If target gets updated first, then sync_attr must update initiator's attrs first # If target gets updated first, then sync_attr must update initiator's attrs first
# For join, remove leading replica paths # For join, remove leading replica paths

View File

@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(C) 2013-2016 by Orsiris de Jong" AUTHOR="(C) 2013-2016 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.2-dev-parallel-unstable PROGRAM_VERSION=1.2-dev-parallel-unstable
PROGRAM_BUILD=2016072704 PROGRAM_BUILD=2016072705
IS_STABLE=no IS_STABLE=no
source "./ofunctions.sh" source "./ofunctions.sh"
@ -202,7 +202,7 @@ function WaitForPids {
fi fi
fi fi
done done
sleep .1 sleep .01
done done
if [ $errors -gt 0 ]; then if [ $errors -gt 0 ]; then
exit 1 exit 1
@ -532,20 +532,18 @@ function UnlockReplicas {
return 0 return 0
fi fi
#TODO: Cannot parallelize unlockreplicasremote until waitfortaskcompletion is removed
if [ $LOCK_LOCAL -eq 1 ]; then if [ $LOCK_LOCAL -eq 1 ]; then
_UnlockReplicasLocal "${INITIATOR[2]}" & _UnlockReplicasLocal "${INITIATOR[2]}"
pids="$!"
fi fi
if [ "$REMOTE_OPERATION" != "yes" ]; then if [ "$REMOTE_OPERATION" != "yes" ]; then
if [ $LOCK_LOCAL -eq 1 ]; then if [ $LOCK_LOCAL -eq 1 ]; then
_UnlockReplicasLocal "${TARGET[2]}" & _UnlockReplicasLocal "${TARGET[2]}"
pids="$pids $!"
fi fi
else else
if [ $LOCK_REMOTE -eq 1 ]; then if [ $LOCK_REMOTE -eq 1 ]; then
_UnlockReplicasRemote "${TARGET[2]}" & _UnlockReplicasRemote "${TARGET[2]}"
pids="$pids $!"
fi fi
fi fi
} }
@ -704,19 +702,16 @@ function sync_attrs {
fi fi
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" 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" Logger "Getting ctimes for pending files on target." "NOTICE"
if [ "$REMOTE_OPERATION" != "yes" ]; then 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 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 fi
WaitForPids $pids
# If target gets updated first, then sync_attr must update initiator's attrs first # If target gets updated first, then sync_attr must update initiator's attrs first
# For join, remove leading replica paths # For join, remove leading replica paths

View File

@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(C) 2013-2016 by Orsiris de Jong" AUTHOR="(C) 2013-2016 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.2-dev-parallel-unstable PROGRAM_VERSION=1.2-dev-parallel-unstable
PROGRAM_BUILD=2016072704 PROGRAM_BUILD=2016072705
IS_STABLE=no IS_STABLE=no
## FUNC_BUILD=2016072702 ## FUNC_BUILD=2016072702
@ -1372,7 +1372,7 @@ function WaitForPids {
fi fi
fi fi
done done
sleep .1 sleep .01
done done
if [ $errors -gt 0 ]; then if [ $errors -gt 0 ]; then
exit 1 exit 1
@ -1686,20 +1686,18 @@ function UnlockReplicas {
return 0 return 0
fi fi
#TODO: Cannot parallelize unlockreplicasremote until waitfortaskcompletion is removed
if [ $LOCK_LOCAL -eq 1 ]; then if [ $LOCK_LOCAL -eq 1 ]; then
_UnlockReplicasLocal "${INITIATOR[2]}" & _UnlockReplicasLocal "${INITIATOR[2]}"
pids="$!"
fi fi
if [ "$REMOTE_OPERATION" != "yes" ]; then if [ "$REMOTE_OPERATION" != "yes" ]; then
if [ $LOCK_LOCAL -eq 1 ]; then if [ $LOCK_LOCAL -eq 1 ]; then
_UnlockReplicasLocal "${TARGET[2]}" & _UnlockReplicasLocal "${TARGET[2]}"
pids="$pids $!"
fi fi
else else
if [ $LOCK_REMOTE -eq 1 ]; then if [ $LOCK_REMOTE -eq 1 ]; then
_UnlockReplicasRemote "${TARGET[2]}" & _UnlockReplicasRemote "${TARGET[2]}"
pids="$pids $!"
fi fi
fi fi
} }
@ -1853,19 +1851,16 @@ function sync_attrs {
fi fi
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" 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" Logger "Getting ctimes for pending files on target." "NOTICE"
if [ "$REMOTE_OPERATION" != "yes" ]; then 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 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 fi
WaitForPids $pids
# If target gets updated first, then sync_attr must update initiator's attrs first # If target gets updated first, then sync_attr must update initiator's attrs first
# For join, remove leading replica paths # For join, remove leading replica paths