summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Freeze/EvictorIteratorI.cpp11
-rw-r--r--cpp/src/Freeze/IndexI.cpp11
-rw-r--r--cpp/src/Freeze/MapI.cpp79
-rw-r--r--cpp/src/Freeze/ObjectStore.cpp15
-rw-r--r--cpp/src/Freeze/Util.cpp4
-rw-r--r--cpp/src/Freeze/Util.h4
6 files changed, 50 insertions, 74 deletions
diff --git a/cpp/src/Freeze/EvictorIteratorI.cpp b/cpp/src/Freeze/EvictorIteratorI.cpp
index efc3cb26d37..fdc1ad7ee23 100644
--- a/cpp/src/Freeze/EvictorIteratorI.cpp
+++ b/cpp/src/Freeze/EvictorIteratorI.cpp
@@ -150,9 +150,16 @@ Freeze::EvictorIteratorI::nextBatch()
}
break;
}
- catch(const DbMemoryException& dx)
+ catch(const DbException& dx)
{
- handleMemoryException(dx, _key, dbKey);
+ if(dx.get_errno() == DB_BUFFER_SMALL)
+ {
+ handleMemoryException(dx, _key, dbKey);
+ }
+ else
+ {
+ throw dx;
+ }
}
}
}
diff --git a/cpp/src/Freeze/IndexI.cpp b/cpp/src/Freeze/IndexI.cpp
index 1b6ee29b84e..e8d0cbc86e8 100644
--- a/cpp/src/Freeze/IndexI.cpp
+++ b/cpp/src/Freeze/IndexI.cpp
@@ -100,9 +100,16 @@ Freeze::IndexI::untypedFindFirst(const Key& bytes, Int firstN) const
}
break; // for(;;)
}
- catch(const DbMemoryException& dx)
+ catch(const DbException& dx)
{
- handleMemoryException(dx, pkey, pdbKey);
+ if(dx.get_errno() == DB_BUFFER_SMALL)
+ {
+ handleMemoryException(dx, pkey, pdbKey);
+ }
+ else
+ {
+ throw dx;
+ }
}
}
}
diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp
index 0766bc034d0..0bfbbd0b008 100644
--- a/cpp/src/Freeze/MapI.cpp
+++ b/cpp/src/Freeze/MapI.cpp
@@ -299,39 +299,6 @@ 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)
@@ -345,9 +312,16 @@ Freeze::IteratorHelperI::get(const Key*& key, const Value*& value) const
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(dx.get_errno() == DB_BUFFER_SMALL)
+ {
+ handleMemoryException(dx, _key, dbKey, _value, dbValue);
+ }
+ else
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
}
@@ -409,26 +383,6 @@ 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)
@@ -442,9 +396,16 @@ Freeze::IteratorHelperI::get() const
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(dx.get_errno() == DB_BUFFER_SMALL)
+ {
+ handleMemoryException(dx, _key, dbKey);
+ }
+ else
+ {
+ 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 a8cc39c9079..00d244f0308 100644
--- a/cpp/src/Freeze/ObjectStore.cpp
+++ b/cpp/src/Freeze/ObjectStore.cpp
@@ -336,10 +336,6 @@ Freeze::ObjectStore::load(const Identity& ident)
}
break; // for(;;)
}
- catch(const DbMemoryException& dx)
- {
- handleMemoryException(dx, value, dbValue);
- }
catch(const DbDeadlockException&)
{
if(_evictor->deadlockWarning())
@@ -354,9 +350,14 @@ Freeze::ObjectStore::load(const Identity& ident)
}
catch(const DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(dx.get_errno() == DB_BUFFER_SMALL)
+ {
+ handleMemoryException(dx, value, dbValue);
+ }
+ else
+ {
+ throw dx;
+ }
}
}
diff --git a/cpp/src/Freeze/Util.cpp b/cpp/src/Freeze/Util.cpp
index e3d86328e58..6df4de7b5f0 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 DbMemoryException& dx, Key& key, Dbt& dbKey)
+Freeze::handleMemoryException(const DbException& dx, Key& key, Dbt& dbKey)
{
if(dbKey.get_size() > dbKey.get_ulen())
{
@@ -40,7 +40,7 @@ Freeze::handleMemoryException(const DbMemoryException& dx, Key& key, Dbt& dbKey)
}
void
-Freeze::handleMemoryException(const DbMemoryException& dx, Key& key, Dbt& dbKey,
+Freeze::handleMemoryException(const DbException& 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 caaf24bf229..3d972f5433e 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 DbMemoryException&, Key&, Dbt&);
+handleMemoryException(const DbException&, Key&, Dbt&);
void
-handleMemoryException(const DbMemoryException&, Key&, Dbt&, Value&, Dbt&);
+handleMemoryException(const DbException&, Key&, Dbt&, Value&, Dbt&);
}