Commit 699bd25b authored by Leigh Stoller's avatar Leigh Stoller

Add timestamps to image_notifications and image_updates (image server

support tables) so that we can do a better job of sending email on
errors.
parent 5fb4a6f0
......@@ -3687,7 +3687,7 @@ sub TriggerImageUpdate($)
}
emdb::DBQueryWarn("insert into image_updates set ".
" imageid='$imageid',url=$safe_url, ".
" updater_urn=$safe_urn $update_fields");
" updater_urn=$safe_urn,updated=now() $update_fields");
$localimage->Unlock();
#
......
......@@ -157,7 +157,7 @@ if ($force) {
emdb::DBQueryWarn("replace into image_notifications set ".
" imageid='$imageid',version='$version', ".
" origin_uuid='$origin_uuid'");
" origin_uuid='$origin_uuid',notified=now()");
}
}
if (GeniImage::TriggerUpdate($image, \$errormsg)) {
......
......@@ -2264,6 +2264,7 @@ CREATE TABLE `image_notifications` (
`imageid` int(8) unsigned NOT NULL default '0',
`version` int(8) unsigned NOT NULL default '0',
`origin_uuid` varchar(64) default NULL,
`notified` datetime default NULL,
PRIMARY KEY (`imageid`,`version`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......@@ -2380,6 +2381,7 @@ CREATE TABLE `image_updates` (
`updater` varchar(8) default NULL,
`updater_idx` mediumint(8) unsigned NOT NULL default '0',
`updater_urn` varchar(128) default NULL,
`updated` datetime default NULL,
`url` varchar(255) NOT NULL default '',
`credential_string` text,
PRIMARY KEY (`imageid`)
......
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("image_notifications", "notified")) {
DBQueryFatal("alter table image_notifications add ".
" `notified` datetime default NULL");
}
if (!DBSlotExists("image_updates", "updated")) {
DBQueryFatal("alter table image_updates add ".
" `updated` datetime default NULL after updater_urn");
}
return 0;
}
# Local Variables:
# mode:perl
# End:
......@@ -1498,7 +1498,7 @@ if (! ($isglobal && $pid eq TBOPSPID()) || !$doprovenance) {
if (defined($origin_uuid)) {
DBQueryWarn("replace into image_notifications set ".
" imageid='$imageid',version='$version', ".
" origin_uuid='$origin_uuid'");
" origin_uuid='$origin_uuid',notified=now()");
# This can fail, we will catch it later from the CM daemon when
# we try again. Use the nolock option since we have it.
system("$TRIGGERUPDATE -l $imageid");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment