diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2005-09-26 12:39:07 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2005-09-26 12:39:07 +0000 |
commit | e2ef041325c41f50869d620ff1545e913c0be471 (patch) | |
tree | ef273442aef3772ecf0c757c2010d0f75058ea6d /cpp | |
parent | Bug 490 - Need to check for DB_BUFFER_SMALL to resize keys (diff) | |
download | ice-e2ef041325c41f50869d620ff1545e913c0be471.tar.bz2 ice-e2ef041325c41f50869d620ff1545e913c0be471.tar.xz ice-e2ef041325c41f50869d620ff1545e913c0be471.zip |
Backed out previous change, failing on Windows.
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Freeze/EvictorIteratorI.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Freeze/IndexI.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Freeze/MapI.cpp | 79 | ||||
-rw-r--r-- | cpp/src/Freeze/ObjectStore.cpp | 15 | ||||
-rw-r--r-- | cpp/src/Freeze/Util.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Freeze/Util.h | 4 |
6 files changed, 74 insertions, 50 deletions
diff --git a/cpp/src/Freeze/EvictorIteratorI.cpp b/cpp/src/Freeze/EvictorIteratorI.cpp index fdc1ad7ee23..efc3cb26d37 100644 --- a/cpp/src/Freeze/EvictorIteratorI.cpp +++ b/cpp/src/Freeze/EvictorIteratorI.cpp @@ -150,16 +150,9 @@ Freeze::EvictorIteratorI::nextBatch() } break; } - catch(const DbException& dx) + catch(const DbMemoryException& dx) { - if(dx.get_errno() == DB_BUFFER_SMALL) - { - handleMemoryException(dx, _key, dbKey); - } - else - { - throw dx; - } + handleMemoryException(dx, _key, dbKey); } } } diff --git a/cpp/src/Freeze/IndexI.cpp b/cpp/src/Freeze/IndexI.cpp index e8d0cbc86e8..1b6ee29b84e 100644 --- a/cpp/src/Freeze/IndexI.cpp +++ b/cpp/src/Freeze/IndexI.cpp @@ -100,16 +100,9 @@ Freeze::IndexI::untypedFindFirst(const Key& bytes, Int firstN) const } break; // for(;;) } - catch(const DbException& dx) + catch(const DbMemoryException& dx) { - if(dx.get_errno() == DB_BUFFER_SMALL) - { - handleMemoryException(dx, pkey, pdbKey); - } - else - { - throw dx; - } + handleMemoryException(dx, pkey, pdbKey); } } } diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp index 0bfbbd0b008..0766bc034d0 100644 --- a/cpp/src/Freeze/MapI.cpp +++ b/cpp/src/Freeze/MapI.cpp @@ -299,6 +299,39 @@ Freeze::IteratorHelperI::get(const Key*& key, const Value*& value) const throw DatabaseException(__FILE__, __LINE__); } } + catch(const ::DbMemoryException dx) + { + bool resizing = false; + if(dbKey.get_size() > dbKey.get_ulen()) + { + // + // Let's resize key + // + _key.resize(dbKey.get_size()); + initializeOutDbt(_key, dbKey); + resizing = true; + } + + if(dbValue.get_size() > dbValue.get_ulen()) + { + // + // Let's resize value + // + _value.resize(dbValue.get_size()); + initializeOutDbt(_value, dbValue); + resizing = true; + } + + if(!resizing) + { + // + // Real problem + // + DatabaseException ex(__FILE__, __LINE__); + ex.message = dx.what(); + throw ex; + } + } catch(const ::DbDeadlockException& dx) { if(_tx != 0) @@ -312,16 +345,9 @@ Freeze::IteratorHelperI::get(const Key*& key, const Value*& value) const } catch(const ::DbException& dx) { - if(dx.get_errno() == DB_BUFFER_SMALL) - { - handleMemoryException(dx, _key, dbKey, _value, dbValue); - } - else - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } + DatabaseException ex(__FILE__, __LINE__); + ex.message = dx.what(); + throw ex; } } } @@ -383,6 +409,26 @@ Freeze::IteratorHelperI::get() const throw DatabaseException(__FILE__, __LINE__); } } + catch(const ::DbMemoryException dx) + { + if(dbKey.get_size() > dbKey.get_ulen()) + { + // + // Let's resize key + // + _key.resize(dbKey.get_size()); + initializeOutDbt(_key, dbKey); + } + else + { + // + // Real problem + // + DatabaseException ex(__FILE__, __LINE__); + ex.message = dx.what(); + throw ex; + } + } catch(const ::DbDeadlockException& dx) { if(_tx != 0) @@ -396,16 +442,9 @@ Freeze::IteratorHelperI::get() const } catch(const ::DbException& dx) { - if(dx.get_errno() == DB_BUFFER_SMALL) - { - handleMemoryException(dx, _key, dbKey); - } - else - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = dx.what(); - throw ex; - } + DatabaseException ex(__FILE__, __LINE__); + ex.message = dx.what(); + throw ex; } } } diff --git a/cpp/src/Freeze/ObjectStore.cpp b/cpp/src/Freeze/ObjectStore.cpp index 00d244f0308..a8cc39c9079 100644 --- a/cpp/src/Freeze/ObjectStore.cpp +++ b/cpp/src/Freeze/ObjectStore.cpp @@ -336,6 +336,10 @@ Freeze::ObjectStore::load(const Identity& ident) } break; // for(;;) } + catch(const DbMemoryException& dx) + { + handleMemoryException(dx, value, dbValue); + } catch(const DbDeadlockException&) { if(_evictor->deadlockWarning()) @@ -350,14 +354,9 @@ Freeze::ObjectStore::load(const Identity& ident) } catch(const DbException& dx) { - if(dx.get_errno() == DB_BUFFER_SMALL) - { - handleMemoryException(dx, value, dbValue); - } - else - { - throw dx; - } + DatabaseException ex(__FILE__, __LINE__); + ex.message = dx.what(); + throw ex; } } diff --git a/cpp/src/Freeze/Util.cpp b/cpp/src/Freeze/Util.cpp index 6df4de7b5f0..e3d86328e58 100644 --- a/cpp/src/Freeze/Util.cpp +++ b/cpp/src/Freeze/Util.cpp @@ -15,7 +15,7 @@ using namespace Ice; using namespace std; void -Freeze::handleMemoryException(const DbException& dx, Key& key, Dbt& dbKey) +Freeze::handleMemoryException(const DbMemoryException& dx, Key& key, Dbt& dbKey) { if(dbKey.get_size() > dbKey.get_ulen()) { @@ -40,7 +40,7 @@ Freeze::handleMemoryException(const DbException& dx, Key& key, Dbt& dbKey) } void -Freeze::handleMemoryException(const DbException& dx, Key& key, Dbt& dbKey, +Freeze::handleMemoryException(const DbMemoryException& dx, Key& key, Dbt& dbKey, Value& value, Dbt& dbValue) { bool resized = false; diff --git a/cpp/src/Freeze/Util.h b/cpp/src/Freeze/Util.h index 3d972f5433e..caaf24bf229 100644 --- a/cpp/src/Freeze/Util.h +++ b/cpp/src/Freeze/Util.h @@ -49,10 +49,10 @@ initializeOutDbt(std::vector<Ice::Byte>& v, Dbt& dbt) } void -handleMemoryException(const DbException&, Key&, Dbt&); +handleMemoryException(const DbMemoryException&, Key&, Dbt&); void -handleMemoryException(const DbException&, Key&, Dbt&, Value&, Dbt&); +handleMemoryException(const DbMemoryException&, Key&, Dbt&, Value&, Dbt&); } |