IDEMPIERE-4989 RUN_SyncDB ordered by timestamp can have issues (#911)

Change SyncDB to apply ordered by folder+timestamp (before was just timestamp)
This commit is contained in:
Carlos Ruiz 2021-10-08 10:30:25 +02:00 committed by GitHub
parent ca9aa33afb
commit 12c7c20c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -62,11 +62,16 @@ APPLIED=N
comm -13 $TMPFOLDER/lisDB_$$.txt $TMPFOLDER/lisFS_$$.txt > $TMPFOLDER/lisPENDING_$$.txt comm -13 $TMPFOLDER/lisDB_$$.txt $TMPFOLDER/lisFS_$$.txt > $TMPFOLDER/lisPENDING_$$.txt
if [ -s $TMPFOLDER/lisPENDING_$$.txt ] if [ -s $TMPFOLDER/lisPENDING_$$.txt ]
then then
mkdir $TMPFOLDER/SyncDB_out_$$
while read -r FILE while read -r FILE
do do
SCRIPT=$(find . -name "$FILE" | grep "/$ADEMPIERE_DB_PATH/") 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" echo "Applying $SCRIPT"
$CMD < "$SCRIPT" 2>&1 | tee "$OUTFILE" $CMD < "$SCRIPT" 2>&1 | tee "$OUTFILE"
APPLIED=Y APPLIED=Y
@ -76,7 +81,7 @@ then
# Stop processing to allow user to fix the problem before processing additional files # Stop processing to allow user to fix the problem before processing additional files
break break
fi fi
done < $TMPFOLDER/lisPENDING_$$.txt done < $TMPFOLDER/lisPENDINGFOL_$$.txt
else else
if [ -s $TMPFOLDER/lisFS_$$.txt ] if [ -s $TMPFOLDER/lisFS_$$.txt ]
then then

View File

@ -59,11 +59,16 @@ APPLIED=N
comm -13 $TMPFOLDER/lisDB_$$.txt $TMPFOLDER/lisFS_$$.txt > $TMPFOLDER/lisPENDING_$$.txt comm -13 $TMPFOLDER/lisDB_$$.txt $TMPFOLDER/lisFS_$$.txt > $TMPFOLDER/lisPENDING_$$.txt
if [ -s $TMPFOLDER/lisPENDING_$$.txt ] if [ -s $TMPFOLDER/lisPENDING_$$.txt ]
then then
mkdir $TMPFOLDER/SyncDB_out_$$
while read -r FILE while read -r FILE
do do
SCRIPT=$(find . -name "$FILE" | grep "/$ADEMPIERE_DB_PATH/") 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" echo "Applying $SCRIPT"
$CMD < "$SCRIPT" 2>&1 | tee "$OUTFILE" $CMD < "$SCRIPT" 2>&1 | tee "$OUTFILE"
APPLIED=Y APPLIED=Y
@ -73,7 +78,7 @@ then
# Stop processing to allow user to fix the problem before processing additional files # Stop processing to allow user to fix the problem before processing additional files
break break
fi fi
done < $TMPFOLDER/lisPENDING_$$.txt done < $TMPFOLDER/lisPENDINGFOL_$$.txt
else else
if [ -s $TMPFOLDER/lisFS_$$.txt ] if [ -s $TMPFOLDER/lisFS_$$.txt ]
then then