How to hook on tODE backup verification?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to hook on tODE backup verification?

GLASS mailing list
Hi Dale,

I have a bash script that takes care of my stone backups. In a part of such a script I do:


echo "`date` ------------------------ Starting backup of ${GEMSTONE_NAME} ------------------------" >> $GEMSTONE_LOGDIR/${GEMSTONE_NAME}_backup.log
$GS_HOME/bin/todeIt $stoneName bu backup --wait --commit $backupfile  >> $GEMSTONE_LOGDIR/${GEMSTONE_NAME}_backup.log 2>&1

The thing is that just after this, I proceed to delete unneeded tranlogs for the new created backup. So I would delete all extents not needed by $backupfile. The problem is that this is too risky (delete the tranlogs) if the backup didn't finish correctly. I know you do validate the backup in tODE, but I wonder how can I hook on that answer?  Do you do some kind of `exit`? 

I was planning to do something like this:

$GS_HOME/bin/todeIt $stoneName bu backup --wait --commit $backupfile  >> $GEMSTONE_LOGDIR/${GEMSTONE_NAME}_backup.log 2>&1
if [ $? -eq 0 ]
then
  echo "Cool, let's remove tranlogs"
else
  echo "Ups...something was wring with backups...let's skip deleting tranlogs
fi


Sorry to ask but it's not that easy to reproduce a backup failure hahah.

Thanks in advance, 



--

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: How to hook on tODE backup verification?

GLASS mailing list



On 02/15/2017 05:14 AM, Mariano Martinez Peck via Glass wrote:
Hi Dale,

I have a bash script that takes care of my stone backups. In a part of such a script I do:


echo "`date` ------------------------ Starting backup of ${GEMSTONE_NAME} ------------------------" >> $GEMSTONE_LOGDIR/${GEMSTONE_NAME}_backup.log
$GS_HOME/bin/todeIt $stoneName bu backup --wait --commit $backupfile  >> $GEMSTONE_LOGDIR/${GEMSTONE_NAME}_backup.log 2>&1

The thing is that just after this, I proceed to delete unneeded tranlogs for the new created backup. So I would delete all extents not needed by $backupfile. The problem is that this is too risky (delete the tranlogs) if the backup didn't finish correctly. I know you do validate the backup in tODE, but I wonder how can I hook on that answer?  Do you do some kind of `exit`? 

I was planning to do something like this:

$GS_HOME/bin/todeIt $stoneName bu backup --wait --commit $backupfile  >> $GEMSTONE_LOGDIR/${GEMSTONE_NAME}_backup.log 2>&1
if [ $? -eq 0 ]
then
  echo "Cool, let's remove tranlogs"
else
  echo "Ups...something was wring with backups...let's skip deleting tranlogs
fi


Sorry to ask but it's not that easy to reproduce a backup failure hahah.

Thanks in advance, 

copydbf is used to validate the backup ... technically, this is only  a partial validation, since it does not actually perform the backup itself, but it does ensure that the file is not corrupt ... if copydbf hits an error reading the file, it exits with a non-zero status code:

foos:allen_340_e>copydbf info.ston /dev/null
GemStone is unable to read the file info.ston

foos:allen_340_e>echo $?
3

For the backup, copydbf is invoked with TDGemStoneTool>>copydbf:forFilePath: and the perform on server call used will check the exit status and signal an error and todeIt will exit with a non-zero status if the Smalltalk code throws an error, so your suggested technique will do the trick ...

Dale



_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass