I have a script that worked quite well to date. This makes several simple queries to mysql and then acts on a table of several million records by deleting matches with another table.
The issue is that the last job was much heavier than the previous ones (I calculated about 18 hours) and the script left without any more at the end / during the mysql deletion query although apparently the removal went through all the records since it did not I have found duplicates.
It is also possible that all duplicates had already been deleted when the script cracked, although there are still records to be reviewed.
Here is the code where the anomaly happened:
/bin/echo "Eliminando registros que ya tengo en DB generica....."
/usr/bin/mysql $SQL_ARGS_LOCAL "delete FROM tabla1 where bbdd_fid=$BBDD_FID_ADD and dato1 in (select dato1 from tabla2)"
if [[ $? -ne 0 ]]; then # Si me da error
/bin/echo "Ha ocurrido un error o no se ha completado la eliminacion de registros en la DB de tabla1 bbdd_fid $BBDD_FID_ADD ($NOMBRE_DB_ADD)"
fi
# De nuevo cuento los registros despues de la eliminacion
/bin/echo
/bin/echo -n "Registros en $NOMBRE_DB_ADD bbdd_fid $BBDD_FID_ADD despues de la eliminacion: "
The last line of the log shows:
Deleting records that I already have in generic DB ...
Then it was running /usr/bin/mysql $SQL_ARGS_LOCAL "delete FROM tabla1 where .......
and then the script came out.
Is it possible that at the end of the deletion query the code could not be retrieved and it would go out abnormally?
I have not been able to see the end time either, or it has released some errors in the logs of the system.