Title: [opsview] [12199] Wrap cache updates in a single transaction
Revision
12199
Author
tvoon
Date
2013-04-29 14:09:08 +0100 (Mon, 29 Apr 2013)

Log Message

Wrap cache updates in a single transaction

Modified Paths


Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2013-04-29 10:33:40 UTC (rev 12198)
+++ trunk/CHANGES	2013-04-29 13:09:08 UTC (rev 12199)
@@ -13,7 +13,7 @@
     New Opspack: MySQL Server, replacing existing MySQL
     New Opspack: Apache HTTP Server, replacing existing Apache HTTP
     Management URLs open in a new window for http and https methods
-    check_snmp_interfaces_cascade now reports timings on main execution parts
+    check_snmp_interfaces_cascade now reports timings on main execution parts and wraps cache updates in a single transaction
     Downgrade check_snmp_interfaces_cascade errors with invalid percentage utilisation (critical) and long plugin execution time (warning) to be unknowns instead
     Notification profiles and shared notification profiles now have a field to prevent the sending of alerts after a defined number
     NOTICES:

Modified: trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade
===================================================================
--- trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade	2013-04-29 10:33:40 UTC (rev 12198)
+++ trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade	2013-04-29 13:09:08 UTC (rev 12199)
@@ -1161,10 +1161,12 @@
 
 ###################################
 # Update database with latest
-# values
+# values. We wrap them in BEGIN/END
+# so sqlite treats it as one transaction
 ###################################
 
 my $sql_write_start = gettimeofday();
+$dbh->do( "BEGIN" );
 $dbh->do( "DELETE FROM interfaces" );
 my $sth_saved_data = $dbh->prepare( "
 INSERT INTO interfaces
@@ -1195,6 +1197,7 @@
         $sth_saved_data->execute(@data);
     }
 }
+$dbh->do( "END" );
 $sth->finish;
 $dbh->disconnect;
 my $sql_write_time = sprintf( "%.2f", gettimeofday() - $sql_write_start );

_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to