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:
parent
ca9aa33afb
commit
12c7c20c23
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue