summaryrefslogtreecommitdiff
path: root/FS/bin
diff options
context:
space:
mode:
authorivan <ivan>2011-03-16 01:26:31 +0000
committerivan <ivan>2011-03-16 01:26:31 +0000
commitd117f36952b5829085958d647f29bd3deac6acf5 (patch)
tree02d7053b0119cd0ce6112df5d3b2d23297e6003e /FS/bin
parentca3c2d180e6005dc10c1492b60e847ad32c99c57 (diff)
fix mysql deadlock handling
Diffstat (limited to 'FS/bin')
-rw-r--r--FS/bin/freeside-torrus-srvderive11
1 files changed, 7 insertions, 4 deletions
diff --git a/FS/bin/freeside-torrus-srvderive b/FS/bin/freeside-torrus-srvderive
index 0441c4704..38dfdbbe8 100644
--- a/FS/bin/freeside-torrus-srvderive
+++ b/FS/bin/freeside-torrus-srvderive
@@ -59,7 +59,7 @@ my $orderlimit = "
";
-while (1) {
+MAIN: while (1) {
my $found = 0;
@@ -131,10 +131,13 @@ while (1) {
my $isth = dbh->prepare($isql) or die $DBI::errstr; #better recovery?
- #stupid mysql deadlocks all the time here, so we need to recover
- $isth->execute( @param ) or do {
+ #stupid mysql deadlocks all the time on insert, so we need to recover
+ unless ( $isth->execute(@param) ) {
warn "Error inserting data for $serviceid$dir (restarting): ".
$isth->errstr;
+ dbh->rollback; #or die dbh->errstr;
+ sleep 5;
+ next MAIN;
}
}
@@ -151,7 +154,7 @@ while (1) {
}
warn "done with $serviceid\n" if $DEBUG;
- }
+ } #foreach my $torrus_srvderive
dbh->commit or die dbh->errstr;
myexit() if sigterm() || sigint();