From 02db7c6dbf359fef701e700971505195494979ae Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Fri, 22 Apr 2016 15:28:32 +0200 Subject: [PATCH] MT#17657 txns not rolled back when retrying due to non-dbh errors txn were not rolled back for application errors (i.e. contract id not found), so the uncommitted txn was picked up for the next iteration and then ratomat dies with an error like this: Change-Id: I73382aa9be0b12c4b5e168894b288c6d3e4a3444 rate-o-mat: DBD::mysql::db do failed: Transaction isolation level can't be changed while a transaction is in progress at /usr/sbin/rate-o-mat line 287. --- rate-o-mat.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rate-o-mat.pl b/rate-o-mat.pl index 013acb5..a526958 100755 --- a/rate-o-mat.pl +++ b/rate-o-mat.pl @@ -572,7 +572,7 @@ EOS join(',', @fragment_fields).", start_time + ?,duration - ?,1 FROM accounting.cdr - WHERE id = ? + WHERE id = ? AND rating_status = 'unrated' ") or FATAL "Error preparing create cdr fragment statement: ".$acctdbh->errstr; } @@ -2752,6 +2752,7 @@ sub main { ": " . $error; $failed_counter_map{$cdr_id} = $failed_counter_map{$cdr_id} + 1; $failed += 1; + rollback_all(); next; #move on to the next cdr of the batch } else { die($error); #rethrow