summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2002-11-23 14:37:46 +0000
committerBenoit Foucher <benoit@zeroc.com>2002-11-23 14:37:46 +0000
commit470a28fce573ec04aed074f9114295662114c870 (patch)
tree84ea896c61cd7305401890c727e00061c5c624ad /cpp
parent- Added DBEnvironment::openDBWithTxn (required by BerkeleyDB 4.1.2) (diff)
downloadice-470a28fce573ec04aed074f9114295662114c870.tar.bz2
ice-470a28fce573ec04aed074f9114295662114c870.tar.xz
ice-470a28fce573ec04aed074f9114295662114c870.zip
- Added DBEnvironment::openDBWithTxn (required by BerkeleyDB 4.1.2)
- Improved dispatch exception warnings. - Fix the exception test to disable dispatch warnings. - Fixed a bug in IcePack where a server adapter would wait for the server activation even though the node was being shutdown. - Fixed XML transform tests to use openDBWithTxn.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Ice/Incoming.h2
-rw-r--r--cpp/slice/Freeze/DB.ice36
-rw-r--r--cpp/src/Freeze/DBI.cpp73
-rw-r--r--cpp/src/Freeze/DBI.h6
-rw-r--r--cpp/src/Ice/Incoming.cpp49
-rw-r--r--cpp/src/IcePack/ActivatorI.cpp4
-rw-r--r--cpp/src/IcePack/ServerI.cpp2
-rw-r--r--cpp/test/Ice/exceptions/Server.cpp2
-rw-r--r--cpp/test/XMLTransform/transform/Populate.cpp93
9 files changed, 213 insertions, 54 deletions
diff --git a/cpp/include/Ice/Incoming.h b/cpp/include/Ice/Incoming.h
index 0ef2849ff94..c3ec7be540c 100644
--- a/cpp/include/Ice/Incoming.h
+++ b/cpp/include/Ice/Incoming.h
@@ -36,6 +36,8 @@ public:
private:
+ void warning(const std::string&, const std::string&);
+
Ice::Current _current;
BasicStream _is;
diff --git a/cpp/slice/Freeze/DB.ice b/cpp/slice/Freeze/DB.ice
index 5e46d473a8d..755e8a654c3 100644
--- a/cpp/slice/Freeze/DB.ice
+++ b/cpp/slice/Freeze/DB.ice
@@ -85,6 +85,34 @@ local interface DBEnvironment
/**
*
+ * Open and return a database object within the context of a
+ * transaction. If the database does not exist and the [create]
+ * flag is false a DBNotFoundException is raised. If the database
+ * has been opened before, the previously returned database object
+ * is returned again.
+ *
+ * @param txn The transaction context.
+ *
+ * @param name The database name.
+ *
+ * @param create Flag that determines whether the database is
+ * created, if necessary.
+ *
+ * @return The database object.
+ *
+ * @throws DBException Raised if a database failure occurred.
+ *
+ * @throws DBNotFoundException Raised if a database does not exist
+ * and the [create] flag is false.
+ *
+ * @see DB
+ * @see DB::close
+ *
+ **/
+ DB openDBWithTxn(DBTransaction txn, string name, bool create) throws DBException;
+
+ /**
+ *
* Start a new transaction in this database environment, and
* return the transaction object for such new transaction.
*
@@ -563,7 +591,7 @@ local interface DB
* Save a value in the database under a given key within the
* context of a transaction.
*
- * @param txn The transaction context
+ * @param txn The transaction context.
*
* @param k The key under which the value will be stored in
* the database.
@@ -586,7 +614,7 @@ local interface DB
* Determine if a key is contained in the database within the
* context of a transaction.
*
- * @param txn The transaction context
+ * @param txn The transaction context.
*
* @param k The key to check.
*
@@ -611,7 +639,7 @@ local interface DB
* Get a value from a database by it's key within the context of a
* transaction.
*
- * @param txn The transaction context
+ * @param txn The transaction context.
*
* @param k The key under which the value is stored in the database
*
@@ -637,7 +665,7 @@ local interface DB
* within the context of a transaction. If the key does not exist,
* this operation will do nothing.
*
- * @param txn The transaction context
+ * @param txn The transaction context.
*
* @param k The key to remove together with the corresponding
* value.
diff --git a/cpp/src/Freeze/DBI.cpp b/cpp/src/Freeze/DBI.cpp
index 8930df70f73..a78700a8cd1 100644
--- a/cpp/src/Freeze/DBI.cpp
+++ b/cpp/src/Freeze/DBI.cpp
@@ -201,35 +201,26 @@ Freeze::DBEnvironmentI::getCommunicator()
DBPtr
Freeze::DBEnvironmentI::openDB(const string& name, bool create)
{
- IceUtil::RecMutex::Lock sync(*this);
+ return openDBImpl(0, name, create);
+}
- if(!_dbEnv)
+DBPtr
+Freeze::DBEnvironmentI::openDBWithTxn(const DBTransactionPtr& t, const string& name, bool create)
+{
+ DBTransactionPtr txn = t;
+ if(!t)
{
- ostringstream s;
- s << _errorPrefix << "\"" << _name << "\" has been closed";
- DBException ex(__FILE__, __LINE__);
- ex.message = s.str();
- throw ex;
+ txn = startTransaction();
}
- map<string, DBPtr>::iterator p = _dbMap.find(name);
- if(p != _dbMap.end())
- {
- return p->second;
- }
+ DBPtr db = openDBImpl(static_cast<const DBTransactionI*>(txn.get())->_tid, name, create);
- ::DB* db;
- checkBerkeleyDBReturn(db_create(&db, _dbEnv, 0), _errorPrefix, "db_create");
-
- try
- {
- return new DBI(_communicator, this, db, name, create);
- }
- catch(...)
+ if(!t)
{
- db->close(db, 0);
- throw;
+ txn->commit();
}
+
+ return db;
}
DBTransactionPtr
@@ -286,6 +277,40 @@ Freeze::DBEnvironmentI::sync()
}
}
+DBPtr
+Freeze::DBEnvironmentI::openDBImpl(::DB_TXN* txn, const string& name, bool create)
+{
+ IceUtil::RecMutex::Lock sync(*this);
+
+ if(!_dbEnv)
+ {
+ ostringstream s;
+ s << _errorPrefix << "\"" << _name << "\" has been closed";
+ DBException ex(__FILE__, __LINE__);
+ ex.message = s.str();
+ throw ex;
+ }
+
+ map<string, DBPtr>::iterator p = _dbMap.find(name);
+ if(p != _dbMap.end())
+ {
+ return p->second;
+ }
+
+ ::DB* db;
+ checkBerkeleyDBReturn(db_create(&db, _dbEnv, 0), _errorPrefix, "db_create");
+
+ try
+ {
+ return new DBI(_communicator, this, db, txn, name, create);
+ }
+ catch(...)
+ {
+ db->close(db, 0);
+ throw;
+ }
+}
+
void
Freeze::DBEnvironmentI::add(const string& name, const DBPtr& db)
{
@@ -656,7 +681,7 @@ DBCursorI::close()
_cursor = 0;
}
-Freeze::DBI::DBI(const CommunicatorPtr& communicator, const DBEnvironmentIPtr& dbEnvObj, ::DB* db,
+Freeze::DBI::DBI(const CommunicatorPtr& communicator, const DBEnvironmentIPtr& dbEnvObj, ::DB* db, ::DB_TXN* txn,
const string& name, bool create) :
_communicator(communicator),
_trace(0),
@@ -675,7 +700,7 @@ Freeze::DBI::DBI(const CommunicatorPtr& communicator, const DBEnvironmentIPtr& d
u_int32_t flags = (create) ? DB_CREATE : 0;
#if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
- checkBerkeleyDBReturn(_db->open(_db, 0, _name.c_str(), 0, DB_BTREE, flags, FREEZE_DB_MODE),
+ checkBerkeleyDBReturn(_db->open(_db, txn, _name.c_str(), 0, DB_BTREE, flags, FREEZE_DB_MODE),
_errorPrefix, "DB->open");
#else
checkBerkeleyDBReturn(_db->open(_db, _name.c_str(), 0, DB_BTREE, flags, FREEZE_DB_MODE),
diff --git a/cpp/src/Freeze/DBI.h b/cpp/src/Freeze/DBI.h
index b59d89eb46b..780a6d5a4bf 100644
--- a/cpp/src/Freeze/DBI.h
+++ b/cpp/src/Freeze/DBI.h
@@ -68,6 +68,8 @@ public:
virtual DBPtr openDB(const std::string&, bool);
+ virtual DBPtr openDBWithTxn(const DBTransactionPtr&, const std::string&, bool);
+
virtual DBTransactionPtr startTransaction();
virtual void close();
@@ -78,6 +80,7 @@ private:
// DBI needs access to add, remove & eraseDB
friend class DBI;
+ DBPtr openDBImpl(::DB_TXN*, const std::string&, bool);
void add(const std::string&, const DBPtr&);
void remove(const std::string&);
void eraseDB(const std::string&);
@@ -106,6 +109,7 @@ public:
private:
+ friend class DBEnvironmentI;
friend class DBI;
::Ice::CommunicatorPtr _communicator;
@@ -122,7 +126,7 @@ class DBI : public DB, public IceUtil::Mutex
{
public:
- DBI(const ::Ice::CommunicatorPtr&, const DBEnvironmentIPtr&, ::DB*, const std::string&, bool);
+ DBI(const ::Ice::CommunicatorPtr&, const DBEnvironmentIPtr&, ::DB*, ::DB_TXN*, const std::string&, bool);
virtual ~DBI();
virtual std::string getName();
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 622878289f9..15ac2a405f8 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -19,7 +19,9 @@
#include <Ice/LocalException.h>
#include <Ice/Instance.h>
#include <Ice/Properties.h>
+#include <Ice/IdentityUtil.h>
#include <Ice/LoggerUtil.h>
+#include <Ice/StringUtil.h>
using namespace std;
using namespace Ice;
@@ -266,8 +268,9 @@ IceInternal::Incoming::invoke(bool response)
if(_os.instance()->properties()->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
{
- Warning out(_os.instance()->logger());
- out << "dispatch exception: unknown local exception:\n" << ex;
+ ostringstream str;
+ str << ex;
+ warning("dispatch exception: unknown local exception:", str.str());
}
return;
@@ -293,8 +296,9 @@ IceInternal::Incoming::invoke(bool response)
if(_os.instance()->properties()->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
{
- Warning out(_os.instance()->logger());
- out << "dispatch exception: unknown user exception:\n" << ex;
+ ostringstream str;
+ str << ex;
+ warning("dispatch exception: unknown user exception:", str.str());
}
return;
@@ -320,8 +324,9 @@ IceInternal::Incoming::invoke(bool response)
if(_os.instance()->properties()->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
{
- Warning out(_os.instance()->logger());
- out << "dispatch exception: unknown exception:\n" << ex;
+ ostringstream str;
+ str << ex;
+ warning("dispatch exception: unknown exception:", str.str());
}
return;
@@ -347,8 +352,7 @@ IceInternal::Incoming::invoke(bool response)
if(_os.instance()->properties()->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
{
- Warning out(_os.instance()->logger());
- out << "dispatch exception: unknown std::exception: " << ex.what();
+ warning("dispatch exception: unknown std::exception:", ex.what());
}
return;
@@ -373,8 +377,7 @@ IceInternal::Incoming::invoke(bool response)
if(_os.instance()->properties()->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
{
- Warning out(_os.instance()->logger());
- out << "dispatch exception: unknown c++ exception";
+ warning("dispatch exception: unknown c++ exception:", "");
}
return;
@@ -429,3 +432,29 @@ IceInternal::Incoming::os()
{
return &_os;
}
+
+void
+IceInternal::Incoming::warning(const string& msg, const string& ex)
+{
+ ostringstream str;
+ str << msg;
+ if(!ex.empty())
+ {
+ str << "\n" << ex;
+ }
+ str << "\nidentity: " << _current.id;
+ str << "\nfacet: ";
+ vector<string>::const_iterator p = _current.facet.begin();
+ while(p != _current.facet.end())
+ {
+ str << encodeString(*p++, "/");
+ if(p != _current.facet.end())
+ {
+ str << '/';
+ }
+ }
+ str << "\noperation: " << _current.operation;
+
+ Warning out(_os.instance()->logger());
+ out << str.str();
+}
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp
index b2f85b2e66b..27a2e971436 100644
--- a/cpp/src/IcePack/ActivatorI.cpp
+++ b/cpp/src/IcePack/ActivatorI.cpp
@@ -350,7 +350,7 @@ IcePack::ActivatorI::deactivate(const ServerPtr& server)
// Send a SIGTERM to the process.
//
int ret = ::kill(static_cast<pid_t>(pid), SIGTERM);
- if(ret != 0 && ret != ESRCH)
+ if(ret != 0 && getSystemErrno() != ESRCH)
{
SyscallException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -381,7 +381,7 @@ IcePack::ActivatorI::kill(const ServerPtr& server)
// Send a SIGKILL to the process.
//
int ret = ::kill(static_cast<pid_t>(pid), SIGKILL);
- if(ret != 0 && ret != ESRCH)
+ if(ret != 0 && getSystemErrno() != ESRCH)
{
SyscallException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
diff --git a/cpp/src/IcePack/ServerI.cpp b/cpp/src/IcePack/ServerI.cpp
index 16414c4c727..a7bb93fa7c4 100644
--- a/cpp/src/IcePack/ServerI.cpp
+++ b/cpp/src/IcePack/ServerI.cpp
@@ -65,12 +65,12 @@ IcePack::ServerI::start(ServerActivation act, const Ice::Current& current)
break;
}
case Activating:
+ case Deactivating:
{
wait(); // TODO: Timeout?
continue;
}
case Active:
- case Deactivating:
{
return true; // Raise an exception instead?
}
diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp
index 49a7d74eacd..808f744be08 100644
--- a/cpp/test/Ice/exceptions/Server.cpp
+++ b/cpp/test/Ice/exceptions/Server.cpp
@@ -21,7 +21,7 @@ int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
Ice::PropertiesPtr properties = communicator->getProperties();
- properties->setProperty("Ice.Warn.Connections", "0");
+ properties->setProperty("Ice.Warn.Dispatch", "0");
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::ObjectPtr object = new ThrowerI(adapter);
diff --git a/cpp/test/XMLTransform/transform/Populate.cpp b/cpp/test/XMLTransform/transform/Populate.cpp
index fb6d9aa5819..c9027568b73 100644
--- a/cpp/test/XMLTransform/transform/Populate.cpp
+++ b/cpp/test/XMLTransform/transform/Populate.cpp
@@ -103,7 +103,10 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(i, i));
}
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "byteToShort", false);
emitSchemas("xs:byte", "xs:short");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -122,7 +125,10 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(i, i));
}
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "shortToInt", false);
emitSchemas("xs:short", "xs:int");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -141,7 +147,10 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(i, i));
}
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "intToLong", false);
emitSchemas("xs:int", "xs:long");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -160,7 +169,10 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(i, i));
}
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "longToByte", false);
emitSchemas("xs:long", "xs:byte");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -179,7 +191,10 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(i, static_cast<float>(i)));
}
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "floatToDouble", false);
emitSchemas("xs:float", "xs:double");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -201,9 +216,11 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(2, l));
map.insert(make_pair(3, l + 1)); // Out of range for byte.
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "failure", false);
emitSchemas("xs:long", "xs:byte");
-
try
{
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
@@ -232,9 +249,11 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(2, l));
map.insert(make_pair(3, l + 1)); // Out of range for short.
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "failure", false);
emitSchemas("xs:long", "xs:short");
-
try
{
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
@@ -263,9 +282,11 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(2, l));
map.insert(make_pair(3, l + 1)); // Out of range for int.
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "failure", false);
emitSchemas("xs:long", "xs:int");
-
try
{
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
@@ -324,7 +345,10 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv)
}
map.insert(make_pair(0, seq));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "byteToShortSeq", false);
emitSchemas("tns:_internal.Test.Seq1Type", "tns:_internal.Test.Seq1Type");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -345,7 +369,10 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv)
}
map.insert(make_pair(0, seq));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "shortToIntSeq", false);
emitSchemas("tns:_internal.Test.Seq2Type", "tns:_internal.Test.Seq2Type");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -366,7 +393,10 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv)
}
map.insert(make_pair(0, seq));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "intToLongSeq", false);
emitSchemas("tns:_internal.Test.Seq3Type", "tns:_internal.Test.Seq3Type");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -387,7 +417,10 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv)
}
map.insert(make_pair(0, seq));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "longToByteSeq", false);
emitSchemas("tns:_internal.Test.Seq4Type", "tns:_internal.Test.Seq4Type");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -411,9 +444,11 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv)
seq.push_back(l + 1); // Out of range for byte.
map.insert(make_pair(0, seq));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "failure", false);
emitSchemas("tns:_internal.Test.Seq4Type", "tns:_internal.Test.Seq4Type");
-
try
{
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
@@ -466,7 +501,10 @@ transformEnum(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(0, Test::one));
map.insert(make_pair(1, Test::two));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "enum", false);
emitSchemas("tns:_internal.Test.E1Type", "tns:_internal.Test.E1Type");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -484,9 +522,11 @@ transformEnum(const DBEnvironmentPtr& dbEnv)
map.insert(make_pair(1, Test::two));
map.insert(make_pair(2, Test::three));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "failure", false);
emitSchemas("tns:_internal.Test.E1Type", "tns:_internal.Test.E1Type");
-
try
{
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
@@ -541,7 +581,10 @@ transformDictionary(const DBEnvironmentPtr& dbEnv)
dict.insert(make_pair(string("two"), Test::two));
map.insert(make_pair(0, dict));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "dict", false);
emitSchemas("tns:_internal.Test.D1Type", "tns:_internal.Test.D1Type");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -561,9 +604,11 @@ transformDictionary(const DBEnvironmentPtr& dbEnv)
dict.insert(make_pair(string("three"), Test::three));
map.insert(make_pair(0, dict));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "failure", false);
emitSchemas("tns:_internal.Test.D1Type", "tns:_internal.Test.D1Type");
-
try
{
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
@@ -624,7 +669,10 @@ transformStruct(const DBEnvironmentPtr& dbEnv)
s1.i = 2;
map.insert(make_pair(2, s1));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "struct", false);
emitSchemas("tns:_internal.Test.S1Type", "tns:_internal.Test.S1Type");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -649,9 +697,11 @@ transformStruct(const DBEnvironmentPtr& dbEnv)
s1.i = ((Int)SCHAR_MAX) + 1; // Out of range for byte
map.insert(make_pair(2, s1));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "failure", false);
emitSchemas("tns:_internal.Test.S1Type", "tns:_internal.Test.S1Type");
-
try
{
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
@@ -661,7 +711,13 @@ transformStruct(const DBEnvironmentPtr& dbEnv)
{
// Expected.
}
+ db->close();
+ db = 0;
+ //
+ // Make sure nothing changed.
+ //
+ db = dbEnv->openDB("failure", false);
{
IntS1Map map(db);
for(IntS1Map::iterator p = map.begin(); p != map.end(); ++p)
@@ -670,7 +726,6 @@ transformStruct(const DBEnvironmentPtr& dbEnv)
s1.b = false;
}
}
-
db->close();
db = 0;
@@ -774,7 +829,10 @@ transformClass(const DBEnvironmentPtr& dbEnv)
c2->ice_addFacet(c2Facet, "c1-2");
map.insert(make_pair(3, c2));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "class", false);
emitSchemas("tns:_internal.Test.C1Type", "tns:_internal.Test.C1Type");
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
db->close();
@@ -815,9 +873,11 @@ transformClass(const DBEnvironmentPtr& dbEnv)
c2->d = 2;
map.insert(make_pair(2, c2));
}
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "failure", false);
emitSchemas("tns:_internal.Test.C1Type", "tns:_internal.Test.C1Type");
-
try
{
transformer.transform(dbEnv, db, dummy, dummy, paths, paths, oldSchema, newSchema);
@@ -827,7 +887,13 @@ transformClass(const DBEnvironmentPtr& dbEnv)
{
// Expected.
}
+ db->close();
+ db = 0;
+ //
+ // Make sure nothing changed.
+ //
+ db = dbEnv->openDB("failure", false);
{
IntC1Map map(db);
for(IntC1Map::iterator p = map.begin(); p != map.end(); ++p)
@@ -961,8 +1027,11 @@ transformEvictor(const DBEnvironmentPtr& dbEnv)
ident.name = "3";
evictor->createObject(ident, c2);
}
-
evictor->deactivate();
+ db->close();
+ db = 0;
+
+ db = dbEnv->openDBWithTxn(0, "evictor", false);
transformer.transform(dbEnv, db, loadOld, loadNew, paths, paths, evictorSchema);
db->close();
db = 0;
@@ -1005,9 +1074,11 @@ transformEvictor(const DBEnvironmentPtr& dbEnv)
ident.name = "2";
evictor->createObject(ident, c2);
}
-
evictor->deactivate();
+ db->close();
+ db = 0;
+ db = dbEnv->openDBWithTxn(0, "failure", false);
try
{
transformer.transform(dbEnv, db, loadOld, loadNew, paths, paths, evictorSchema);