From 12c7c20c23800e580f8a26deda9701a85f130c97 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 8 Oct 2021 10:30:25 +0200 Subject: [PATCH] IDEMPIERE-4989 RUN_SyncDB ordered by timestamp can have issues (#911) Change SyncDB to apply ordered by folder+timestamp (before was just timestamp) --- .../utils.unix/oracle/SyncDB.sh | 11 ++++++++--- .../utils.unix/postgresql/SyncDB.sh | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/org.adempiere.server-feature/utils.unix/oracle/SyncDB.sh b/org.adempiere.server-feature/utils.unix/oracle/SyncDB.sh index 60b76f7d3d..cb36310494 100644 --- a/org.adempiere.server-feature/utils.unix/oracle/SyncDB.sh +++ b/org.adempiere.server-feature/utils.unix/oracle/SyncDB.sh @@ -62,11 +62,16 @@ APPLIED=N comm -13 $TMPFOLDER/lisDB_$$.txt $TMPFOLDER/lisFS_$$.txt > $TMPFOLDER/lisPENDING_$$.txt if [ -s $TMPFOLDER/lisPENDING_$$.txt ] then - mkdir $TMPFOLDER/SyncDB_out_$$ while read -r FILE do SCRIPT=$(find . -name "$FILE" | grep "/$ADEMPIERE_DB_PATH/") - OUTFILE=$TMPFOLDER/SyncDB_out_$$/$(basename "$FILE" .sql).out + echo "$SCRIPT" >> $TMPFOLDER/lisPENDINGFOL_$$.txt + done < $TMPFOLDER/lisPENDING_$$.txt + sort -o $TMPFOLDER/lisPENDINGFOL_$$.txt $TMPFOLDER/lisPENDINGFOL_$$.txt + mkdir $TMPFOLDER/SyncDB_out_$$ + while read -r SCRIPT + do + OUTFILE=$TMPFOLDER/SyncDB_out_$$/$(basename "$SCRIPT" .sql).out echo "Applying $SCRIPT" $CMD < "$SCRIPT" 2>&1 | tee "$OUTFILE" APPLIED=Y @@ -76,7 +81,7 @@ then # Stop processing to allow user to fix the problem before processing additional files break fi - done < $TMPFOLDER/lisPENDING_$$.txt + done < $TMPFOLDER/lisPENDINGFOL_$$.txt else if [ -s $TMPFOLDER/lisFS_$$.txt ] then diff --git a/org.adempiere.server-feature/utils.unix/postgresql/SyncDB.sh b/org.adempiere.server-feature/utils.unix/postgresql/SyncDB.sh index f0e91e21e4..d44bb27108 100644 --- a/org.adempiere.server-feature/utils.unix/postgresql/SyncDB.sh +++ b/org.adempiere.server-feature/utils.unix/postgresql/SyncDB.sh @@ -59,11 +59,16 @@ APPLIED=N comm -13 $TMPFOLDER/lisDB_$$.txt $TMPFOLDER/lisFS_$$.txt > $TMPFOLDER/lisPENDING_$$.txt if [ -s $TMPFOLDER/lisPENDING_$$.txt ] then - mkdir $TMPFOLDER/SyncDB_out_$$ while read -r FILE do SCRIPT=$(find . -name "$FILE" | grep "/$ADEMPIERE_DB_PATH/") - OUTFILE=$TMPFOLDER/SyncDB_out_$$/$(basename "$FILE" .sql).out + echo "$SCRIPT" >> $TMPFOLDER/lisPENDINGFOL_$$.txt + done < $TMPFOLDER/lisPENDING_$$.txt + sort -o $TMPFOLDER/lisPENDINGFOL_$$.txt $TMPFOLDER/lisPENDINGFOL_$$.txt + mkdir $TMPFOLDER/SyncDB_out_$$ + while read -r SCRIPT + do + OUTFILE=$TMPFOLDER/SyncDB_out_$$/$(basename "$SCRIPT" .sql).out echo "Applying $SCRIPT" $CMD < "$SCRIPT" 2>&1 | tee "$OUTFILE" APPLIED=Y @@ -73,7 +78,7 @@ then # Stop processing to allow user to fix the problem before processing additional files break fi - done < $TMPFOLDER/lisPENDING_$$.txt + done < $TMPFOLDER/lisPENDINGFOL_$$.txt else if [ -s $TMPFOLDER/lisFS_$$.txt ] then