diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-06-11 15:50:51 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-06-11 15:50:51 -0400 |
commit | ba3acdf41b6bd2949a6280c39771c407d117cf44 (patch) | |
tree | cb55584ebb13e5c0e898440cefb2ee986506299f /cpp/src/Freeze/MapI.cpp | |
parent | More .gitignore fixes and fixed a bunch of clean rules in Makefile and Makefi... (diff) | |
download | ice-ba3acdf41b6bd2949a6280c39771c407d117cf44.tar.bz2 ice-ba3acdf41b6bd2949a6280c39771c407d117cf44.tar.xz ice-ba3acdf41b6bd2949a6280c39771c407d117cf44.zip |
Merge Freeze fixes from 3.2 branch
Diffstat (limited to 'cpp/src/Freeze/MapI.cpp')
-rw-r--r-- | cpp/src/Freeze/MapI.cpp | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp index 37c894dad0c..1011606f336 100644 --- a/cpp/src/Freeze/MapI.cpp +++ b/cpp/src/Freeze/MapI.cpp @@ -1491,18 +1491,20 @@ Freeze::MapIndexI::untypedCount(const Key& k, const ConnectionIPtr& connection) int result = 0; + DbTxn * txn = connection->dbTxn(); + try { for(;;) { Dbc* dbc = 0; - + try { // // Move to the first record // - _db->cursor(0, &dbc, 0); + _db->cursor(txn, &dbc, 0); bool found = (dbc->get(&dbKey, &dbValue, DB_SET) == 0); if(found) @@ -1527,9 +1529,16 @@ Freeze::MapIndexI::untypedCount(const Key& k, const ConnectionIPtr& connection) } catch(const DbDeadlockException&) { - // - // Ignored - // + if(txn != 0) + { + throw; + } + else + { + // + // Ignored + // + } } } @@ -1537,11 +1546,15 @@ Freeze::MapIndexI::untypedCount(const Key& k, const ConnectionIPtr& connection) { Warning out(connection->communicator()->getLogger()); out << "Deadlock in Freeze::MapIndexI::untypedCount while searching \"" - << _dbName << "\"; retrying ..."; + << _dbName << "\""; } + if(txn != 0) + { + throw; + } // - // Retry + // Otherwise retry // } catch(...) @@ -1554,20 +1567,29 @@ Freeze::MapIndexI::untypedCount(const Key& k, const ConnectionIPtr& connection) } catch(const DbDeadlockException&) { - // - // Ignored - // + if(txn != 0) + { + throw; + } + else + { + // + // Ignored + // + } } } throw; } } } + catch(const DbDeadlockException& dx) + { + throw DeadlockException(__FILE__, __LINE__, dx.what()); + } catch(const DbException& dx) { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; + throw DatabaseException(__FILE__, __LINE__, dx.what()); } return result; |