[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 4/4] Database locking: Tcl: Limit number of retries



If there is something fundamentally wrong, don't just sit looping
around every 500ms.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 tcl/JobDB-Executive.tcl |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tcl/JobDB-Executive.tcl b/tcl/JobDB-Executive.tcl
index 8e45ea7..7dba497 100644
--- a/tcl/JobDB-Executive.tcl
+++ b/tcl/JobDB-Executive.tcl
@@ -224,6 +224,8 @@ proc step-set-status {flight job stepno st} {
 }
 
 proc transaction {tables script} {
+    global errorInfo errorCode
+    set retries 100
     db-open
     while 1 {
         set ol {}
@@ -239,6 +241,10 @@ proc transaction {tables script} {
            } emsg]} {
                puts "commit failed: $emsg; retrying ..."
                db-execute ROLLBACK
+               if {[incr retries -1] <= 0} {
+                   error \
+ "commit failed, too many retries: $emsg\n$errorInfo\n$errorCode\n"
+               }
                after 500
                continue
            }
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.