|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 27/33] tcl daemons: transaction: Properly match db-open and db-close
* Do the db-open inside the catch, so that if it fails we do the
rest of the error handling.
* Do the db-close before deconstructing the error, so that we
necessarily get the db-open reference count right.
Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
tcl/JobDB-Executive.tcl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tcl/JobDB-Executive.tcl b/tcl/JobDB-Executive.tcl
index 3c2b4db..fe1c946 100644
--- a/tcl/JobDB-Executive.tcl
+++ b/tcl/JobDB-Executive.tcl
@@ -306,10 +306,10 @@ proc step-set-status {flight job stepno st} {
proc transaction {tables script} {
global errorInfo errorCode
set retries 100
- db-open
while 1 {
set ol {}
set rc [catch {
+ db-open
db-execute BEGIN
db-execute "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE"
lock-tables $tables
@@ -318,6 +318,7 @@ proc transaction {tables script} {
} result]
set ei $errorInfo
set ec $errorCode
+ db-close
if {$rc} {
db-execute ROLLBACK
switch -glob $errorCode {
@@ -333,7 +334,6 @@ proc transaction {tables script} {
}
}
}
- db-close
return -code $rc -errorinfo $ei -errorcode $ec $result
}
}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |