diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 11 | ||||
-rw-r--r-- | cpp/slice/Freeze/Evictor.ice | 11 | ||||
-rw-r--r-- | cpp/src/Freeze/EvictorI.cpp | 24 | ||||
-rw-r--r-- | cpp/src/Freeze/EvictorI.h | 1 | ||||
-rw-r--r-- | cpp/test/Freeze/evictor/Client.cpp | 50 | ||||
-rw-r--r-- | cpp/test/Freeze/evictor/Test.ice | 5 | ||||
-rw-r--r-- | cpp/test/Freeze/evictor/TestI.cpp | 44 | ||||
-rw-r--r-- | cpp/test/Freeze/evictor/TestI.h | 12 |
8 files changed, 10 insertions, 148 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 4505aa5027e..6fdf051acf1 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -252,23 +252,12 @@ Changes since version 1.1.1 void removeFacet(Ice::Identity identity, Ice::FacetPath facet); void removeAllFacets(Ice::Identity identity); - The application can request an immediate save by calling - saveNow() on the evictor object. Also, creating a Freeze Evictor - Iterator triggers an immediate save. - When saving an object (facet), the background saving thread locks this object. In Java, it locks the object itself; in C++, the object is expected to implement IceUtil::AbstractMutex. Naturally the application must use the same synchronization to access the persistent state of the object. - The configuration variable Freeze.Evictor.NoSyncAllowed can be set - to a value other than 0 to allow C++ objects that do not implement - IceUtil::AbstractMutex to be saved. For such objects, no - synchronization is performed: it is recommended to only use this - feature with explict saves (SaveSizeTrigger set to -1 and - SavePeriod set to 0). NoSyncAllowed defaults to 0. - The EvictorIterator also changed slightly: the destroy operation has been removed. More importantly, identities are now retrieved in batch (internally) and the application can request that diff --git a/cpp/slice/Freeze/Evictor.ice b/cpp/slice/Freeze/Evictor.ice index f5d7656d3c3..3f05419730b 100644 --- a/cpp/slice/Freeze/Evictor.ice +++ b/cpp/slice/Freeze/Evictor.ice @@ -340,17 +340,6 @@ local interface Evictor extends Ice::ServantLocator * **/ bool hasObject(Ice::Identity ident); - - - /** - * - * Saves immediately all created, modified and destroyed objects. - * - * @throws DatabaseException Raised if a database failure occurred. - * - **/ - void saveNow(); - }; }; diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp index 4ed65ed4863..8d60ac135dc 100644 --- a/cpp/src/Freeze/EvictorI.cpp +++ b/cpp/src/Freeze/EvictorI.cpp @@ -241,7 +241,6 @@ Freeze::EvictorI::EvictorI(const CommunicatorPtr communicator, _dbEnv(0), _dbEnvHolder(SharedDbEnv::get(communicator, envName)), _trace(0), - _noSyncAllowed(false), _generation(0) { _dbEnv = _dbEnvHolder.get(); @@ -258,7 +257,6 @@ Freeze::EvictorI::EvictorI(const CommunicatorPtr communicator, _communicator(communicator), _dbEnv(&dbEnv), _trace(0), - _noSyncAllowed(false), _generation(0) { init(envName, dbName, createDb); @@ -268,8 +266,7 @@ void Freeze::EvictorI::init(const string& envName, const string& dbName, bool createDb) { _trace = _communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Evictor"); - _noSyncAllowed = (_communicator->getProperties()->getPropertyAsInt("Freeze.Evictor.NoSyncAllowed") != 0); - + string propertyPrefix = string("Freeze.Evictor.") + envName + '.' + dbName; // @@ -1327,21 +1324,10 @@ Freeze::EvictorI::run() } else { - if(_noSyncAllowed) - { - facet->status = clean; - size_t index = streamedObjectQueue.size(); - streamedObjectQueue.resize(index + 1); - StreamedObject& obj = streamedObjectQueue[index]; - streamFacet(facet, allObjects[i]->first, status, saveStart, obj); - } - else - { - DatabaseException ex(__FILE__, __LINE__); - ex.message = string(typeid(*facet->rec.servant).name()) - + " does not implement IceUtil::AbstractMutex and Freeze.Evictor.NoSyncAllowed is 0"; - throw ex; - } + DatabaseException ex(__FILE__, __LINE__); + ex.message = string(typeid(*facet->rec.servant).name()) + + " does not implement IceUtil::AbstractMutex"; + throw ex; } } } while(tryAgain); diff --git a/cpp/src/Freeze/EvictorI.h b/cpp/src/Freeze/EvictorI.h index c5f0c3188fa..d8107e0d910 100644 --- a/cpp/src/Freeze/EvictorI.h +++ b/cpp/src/Freeze/EvictorI.h @@ -225,7 +225,6 @@ private: std::auto_ptr<Db> _db; ServantInitializerPtr _initializer; Ice::Int _trace; - bool _noSyncAllowed; // // Threads that have requested a "saveNow" and are waiting for diff --git a/cpp/test/Freeze/evictor/Client.cpp b/cpp/test/Freeze/evictor/Client.cpp index a49af3bd46a..035550928b4 100644 --- a/cpp/test/Freeze/evictor/Client.cpp +++ b/cpp/test/Freeze/evictor/Client.cpp @@ -44,7 +44,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) evictor->setSize(size); // - // Create some servants and verify they did not get saved + // Create some servants // vector<Test::ServantPrx> servants; for(i = 0; i < size; i++) @@ -58,23 +58,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2"); test(facet2); facet2->setValue(100 * i); - - test(evictor->getLastSavedValue() == -1); } - - // - // save and verify - // - evictor->saveNow(); - test(evictor->getLastSavedValue() == 100 * (i - 1)); - - + // // Evict and verify values. // evictor->setSize(0); evictor->setSize(size); - evictor->clearLastSavedValue(); for(i = 0; i < size; i++) { test(servants[i]->getValue() == i); @@ -102,21 +92,6 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) } // - // Servants should not be saved yet. - // - test(evictor->getLastSavedValue() == -1); - for(i = 0; i < size; i++) - { - test(servants[i]->getValue() == i + 100); - Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1"); - test(facet1); - test(facet1->getValue() == 10 * i + 100); - Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2"); - test(facet2); - test(facet2->getValue() == 100 * i + 100); - } - - // // Evict and verify values. // evictor->setSize(0); @@ -131,17 +106,12 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) test(facet2); test(facet2->getValue() == 100 * i + 100); } - - evictor->saveNow(); - // // Test saving while busy // Test::AMI_Servant_setValueAsyncPtr setCB = new AMI_Servant_setValueAsyncI; for(i = 0; i < size; i++) { - evictor->clearLastSavedValue(); - // // Start a mutating operation so that the object is not idle. // @@ -150,30 +120,20 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) // Wait for setValueAsync to be dispatched. // IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(100)); - // - // Object should not have been modified or saved yet. - // + test(servants[i]->getValue() == i + 100); - test(evictor->getLastSavedValue() == -1); // // This operation modifies the object state but is not saved // because the setValueAsync operation is still pending. // servants[i]->setValue(i + 200); test(servants[i]->getValue() == i + 200); - test(evictor->getLastSavedValue() == -1); - - evictor->saveNow(); - test(evictor->getLastSavedValue() == i + 200); // // Force the response to setValueAsync // servants[i]->releaseAsync(); test(servants[i]->getValue() == i + 300); - test(evictor->getLastSavedValue() == i + 200); - evictor->saveNow(); - test(evictor->getLastSavedValue() == i + 300); } // @@ -218,10 +178,6 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) servants[i]->removeAllFacets(); } - // - // Save and verify - // - evictor->saveNow(); evictor->setSize(0); evictor->setSize(size); diff --git a/cpp/test/Freeze/evictor/Test.ice b/cpp/test/Freeze/evictor/Test.ice index 41e7b509237..4af226d8d1e 100644 --- a/cpp/test/Freeze/evictor/Test.ice +++ b/cpp/test/Freeze/evictor/Test.ice @@ -56,10 +56,7 @@ interface RemoteEvictor void setSize(int size); Servant* createServant(int id, int value); Servant* getServant(int id); - - nonmutating int getLastSavedValue(); - void clearLastSavedValue(); - void saveNow(); + void deactivate(); void destroyAllServants(); }; diff --git a/cpp/test/Freeze/evictor/TestI.cpp b/cpp/test/Freeze/evictor/TestI.cpp index 1e64f33f929..ed64564511c 100644 --- a/cpp/test/Freeze/evictor/TestI.cpp +++ b/cpp/test/Freeze/evictor/TestI.cpp @@ -124,13 +124,6 @@ Test::ServantI::destroy(const Current& current) _evictor->destroyObject(current.id); } -void -Test::ServantI::__write(IceInternal::BasicStream* os, bool marshalFacets) const -{ - assert(_remoteEvictor); - _remoteEvictor->setLastSavedValue(value); - Servant::__write(os, marshalFacets); -} Test::FacetI::FacetI() { @@ -157,20 +150,11 @@ Test::FacetI::setData(const string& d, const Current&) data = d; } -void -Test::FacetI::__write(::IceInternal::BasicStream* os, bool marshalFacets) const -{ - assert(_remoteEvictor); - _remoteEvictor->setLastSavedValue(value); - Facet::__write(os, marshalFacets); -} - Test::RemoteEvictorI::RemoteEvictorI(const ObjectAdapterPtr& adapter, const string& category, const Freeze::EvictorPtr& evictor) : _adapter(adapter), _category(category), - _evictor(evictor), - _lastSavedValue(-1) + _evictor(evictor) { CommunicatorPtr communicator = adapter->getCommunicator(); _evictorAdapter = communicator->createObjectAdapterWithEndpoints(IceUtil::generateUUID(), "default"); @@ -210,25 +194,6 @@ Test::RemoteEvictorI::getServant(Int id, const Current&) return ServantPrx::uncheckedCast(_evictorAdapter->createProxy(ident)); } -Int -Test::RemoteEvictorI::getLastSavedValue(const Current&) const -{ - Int result = _lastSavedValue; - return result; -} - -void -Test::RemoteEvictorI::clearLastSavedValue(const Current&) -{ - _lastSavedValue = -1; -} - - -void -Test::RemoteEvictorI::saveNow(const Current&) -{ - _evictor->saveNow(); -} void Test::RemoteEvictorI::deactivate(const Current& current) @@ -250,16 +215,9 @@ Test::RemoteEvictorI::destroyAllServants(const Current&) while(p->hasNext()) { _evictor->destroyObject(p->next()); - _evictor->saveNow(); } } -void -Test::RemoteEvictorI::setLastSavedValue(Int value) -{ - _lastSavedValue = value; -} - class Initializer : public Freeze::ServantInitializer { public: diff --git a/cpp/test/Freeze/evictor/TestI.h b/cpp/test/Freeze/evictor/TestI.h index 3f10cc0bf89..f08ebed1a4e 100644 --- a/cpp/test/Freeze/evictor/TestI.h +++ b/cpp/test/Freeze/evictor/TestI.h @@ -54,8 +54,6 @@ public: virtual void destroy(const Ice::Current& = Ice::Current()); - virtual void __write(::IceInternal::BasicStream*, bool) const; - protected: RemoteEvictorIPtr _remoteEvictor; @@ -77,7 +75,6 @@ public: virtual void setData(const std::string&, const Ice::Current& = Ice::Current()); - virtual void __write(::IceInternal::BasicStream*, bool) const; }; class RemoteEvictorI : virtual public RemoteEvictor @@ -92,25 +89,16 @@ public: virtual ::Test::ServantPrx getServant(::Ice::Int, const Ice::Current&); - virtual ::Ice::Int getLastSavedValue(const Ice::Current&) const; - - virtual void clearLastSavedValue(const Ice::Current&); - - virtual void saveNow(const Ice::Current&); - virtual void deactivate(const Ice::Current&); virtual void destroyAllServants(const Ice::Current&); - void setLastSavedValue(Ice::Int); - private: Ice::ObjectAdapterPtr _adapter; std::string _category; Freeze::EvictorPtr _evictor; Ice::ObjectAdapterPtr _evictorAdapter; - Ice::Int _lastSavedValue; }; class RemoteEvictorFactoryI : virtual public RemoteEvictorFactory |