diff --git a/CHANGELOG b/CHANGELOG index 5732dd97b2be..1f9e9e438ffe 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,22 @@ devel ----- +* APM-132: Clean up collection statuses + Removes collection statuses "new born", "loading", "unloading" and "unloaded". + These statuses were last relevant with the MMFiles storage engine, when it + was important to differentiate which collections are present in main memory + memory and which aren't. With the RocksDB storage engine, all that was + automatically handled anyway, and the statuses were not important anymore. + + The change removes the "Load" and "Unload" buttons for collections from the + web interface. All collections in the web interface will be marked as + "loaded" permanently. + + This change also obsoletes the `load()` and `unload()` calls for collections + as well as their HTTP API equivalents. The APIs will remain in place for now + but are changed to no-ops. They will removed eventually in a future version + of ArangoDB. This will be announced separately. + * Include K_SHORTEST_PATHS and SHORTEST_PATH execution nodes in AQL query memory usage accounting. The memory used by these execution node types was previously not tracked against the configured query memory limit. diff --git a/arangod/ClusterEngine/ClusterCollection.cpp b/arangod/ClusterEngine/ClusterCollection.cpp index f3dc875d9045..b097f2b33d5c 100644 --- a/arangod/ClusterEngine/ClusterCollection.cpp +++ b/arangod/ClusterEngine/ClusterCollection.cpp @@ -186,21 +186,8 @@ ErrorCode ClusterCollection::close() { for (auto it : _indexes) { it->unload(); } - return TRI_ERROR_NO_ERROR; -} - -void ClusterCollection::load() { - RECURSIVE_READ_LOCKER(_indexesLock, _indexesLockWriteOwner); - for (auto it : _indexes) { - it->load(); - } -} -void ClusterCollection::unload() { - RECURSIVE_READ_LOCKER(_indexesLock, _indexesLockWriteOwner); - for (auto it : _indexes) { - it->unload(); - } + return TRI_ERROR_NO_ERROR; } RevisionId ClusterCollection::revision(transaction::Methods* trx) const { diff --git a/arangod/ClusterEngine/ClusterCollection.h b/arangod/ClusterEngine/ClusterCollection.h index fa4eb6962445..13cb47ea7adf 100644 --- a/arangod/ClusterEngine/ClusterCollection.h +++ b/arangod/ClusterEngine/ClusterCollection.h @@ -81,8 +81,6 @@ class ClusterCollection final : public PhysicalCollection { /// @brief closes an open collection ErrorCode close() override; - void load() override; - void unload() override; RevisionId revision(arangodb::transaction::Methods* trx) const override; uint64_t numberDocuments(transaction::Methods* trx) const override; diff --git a/arangod/RocksDBEngine/RocksDBCollection.cpp b/arangod/RocksDBEngine/RocksDBCollection.cpp index 6bc1e3fcdd21..185e06fc5480 100644 --- a/arangod/RocksDBEngine/RocksDBCollection.cpp +++ b/arangod/RocksDBEngine/RocksDBCollection.cpp @@ -285,34 +285,6 @@ ErrorCode RocksDBCollection::close() { return TRI_ERROR_NO_ERROR; } -void RocksDBCollection::load() { - if (_cacheEnabled) { - createCache(); - if (_cache) { - uint64_t numDocs = _meta.numberDocuments(); - if (numDocs > 0) { - _cache->sizeHint(static_cast(0.3 * numDocs)); - } - } - } - RECURSIVE_READ_LOCKER(_indexesLock, _indexesLockWriteOwner); - for (auto it : _indexes) { - it->load(); - } -} - -void RocksDBCollection::unload() { - WRITE_LOCKER(guard, _exclusiveLock); - if (useCache()) { - destroyCache(); - TRI_ASSERT(_cache.get() == nullptr); - } - RECURSIVE_READ_LOCKER(_indexesLock, _indexesLockWriteOwner); - for (auto it : _indexes) { - it->unload(); - } -} - /// return bounds for all documents RocksDBKeyBounds RocksDBCollection::bounds() const { return RocksDBKeyBounds::CollectionDocuments(objectId()); diff --git a/arangod/RocksDBEngine/RocksDBCollection.h b/arangod/RocksDBEngine/RocksDBCollection.h index 8b6ce69ec0d2..5758ee33861a 100644 --- a/arangod/RocksDBEngine/RocksDBCollection.h +++ b/arangod/RocksDBEngine/RocksDBCollection.h @@ -66,8 +66,6 @@ class RocksDBCollection final : public RocksDBMetaCollection { /// @brief closes an open collection ErrorCode close() override; - void load() override; - void unload() override; /// return bounds for all documents RocksDBKeyBounds bounds() const override; diff --git a/arangod/StorageEngine/PhysicalCollection.h b/arangod/StorageEngine/PhysicalCollection.h index 64760a48bf8f..c4e3d93d75f9 100644 --- a/arangod/StorageEngine/PhysicalCollection.h +++ b/arangod/StorageEngine/PhysicalCollection.h @@ -68,8 +68,6 @@ class PhysicalCollection { virtual void getPropertiesVPack(velocypack::Builder&) const = 0; virtual ErrorCode close() = 0; - virtual void load() = 0; - virtual void unload() = 0; // @brief Return the number of documents in this collection virtual uint64_t numberDocuments(transaction::Methods* trx) const = 0; diff --git a/arangod/VocBase/LogicalCollection.cpp b/arangod/VocBase/LogicalCollection.cpp index b6f319976c18..81c56686d0ae 100644 --- a/arangod/VocBase/LogicalCollection.cpp +++ b/arangod/VocBase/LogicalCollection.cpp @@ -60,18 +60,11 @@ namespace { static std::string translateStatus(TRI_vocbase_col_status_e status) { switch (status) { - case TRI_VOC_COL_STATUS_UNLOADED: - return "unloaded"; case TRI_VOC_COL_STATUS_LOADED: return "loaded"; - case TRI_VOC_COL_STATUS_UNLOADING: - return "unloading"; case TRI_VOC_COL_STATUS_DELETED: return "deleted"; - case TRI_VOC_COL_STATUS_LOADING: - return "loading"; case TRI_VOC_COL_STATUS_CORRUPTED: - case TRI_VOC_COL_STATUS_NEW_BORN: default: return "unknown"; } @@ -585,16 +578,9 @@ Result LogicalCollection::rename(std::string&& newName) { break; } - switch (_status) { - case TRI_VOC_COL_STATUS_UNLOADED: - case TRI_VOC_COL_STATUS_LOADED: - case TRI_VOC_COL_STATUS_UNLOADING: - case TRI_VOC_COL_STATUS_LOADING: { - break; - } - default: - // Unknown status - return TRI_ERROR_INTERNAL; + if (_status != TRI_VOC_COL_STATUS_LOADED) { + // Unknown status + return TRI_ERROR_INTERNAL; } auto doSync = databaseFeature.forceSyncProperties(); @@ -625,14 +611,9 @@ Result LogicalCollection::rename(std::string&& newName) { } ErrorCode LogicalCollection::close() { - // This was unload() in 3.0 return getPhysical()->close(); } -void LogicalCollection::load() { _physical->load(); } - -void LogicalCollection::unload() { _physical->unload(); } - arangodb::Result LogicalCollection::drop() { // make sure collection has been closed this->close(); diff --git a/arangod/VocBase/LogicalCollection.h b/arangod/VocBase/LogicalCollection.h index 02b9f5e6bebd..0c276d6f56d0 100644 --- a/arangod/VocBase/LogicalCollection.h +++ b/arangod/VocBase/LogicalCollection.h @@ -236,9 +236,6 @@ class LogicalCollection : public LogicalDataSource { bool allowUserKeys() const; // SECTION: Modification Functions - void load(); - void unload(); - virtual arangodb::Result drop() override; virtual Result rename(std::string&& name) override; virtual void setStatus(TRI_vocbase_col_status_e); diff --git a/arangod/VocBase/Methods/Collections.cpp b/arangod/VocBase/Methods/Collections.cpp index c5f940af7cd0..7b63a990dc21 100644 --- a/arangod/VocBase/Methods/Collections.cpp +++ b/arangod/VocBase/Methods/Collections.cpp @@ -583,50 +583,16 @@ void Collections::createSystemCollectionProperties(std::string const& collection return res; } -Result Collections::load(TRI_vocbase_t& vocbase, LogicalCollection* coll) { - TRI_ASSERT(coll != nullptr); - - if (ServerState::instance()->isCoordinator()) { -#ifdef USE_ENTERPRISE - auto& feature = vocbase.server().getFeature(); - return ULColCoordinatorEnterprise(feature, coll->vocbase().name(), - std::to_string(coll->id().id()), - TRI_VOC_COL_STATUS_LOADED); -#else - auto& ci = vocbase.server().getFeature().clusterInfo(); - return ci.setCollectionStatusCoordinator(coll->vocbase().name(), - std::to_string(coll->id().id()), - TRI_VOC_COL_STATUS_LOADED); -#endif - } - - auto ctx = transaction::V8Context::CreateWhenRequired(vocbase, true); - SingleCollectionTransaction trx(ctx, *coll, AccessMode::Type::READ); - Result res = trx.begin(); - - if (res.fail()) { - return res; - } - - return trx.finish(res); +Result Collections::load(TRI_vocbase_t& /*vocbase*/, LogicalCollection* /*coll*/) { + // load doesn't do anything from ArangoDB 3.9 onwards, and the method + // may be deleted in a future version + return {}; } -Result Collections::unload(TRI_vocbase_t* vocbase, LogicalCollection* coll) { - if (ServerState::instance()->isCoordinator()) { -#ifdef USE_ENTERPRISE - auto& feature = vocbase->server().getFeature(); - return ULColCoordinatorEnterprise(feature, vocbase->name(), - std::to_string(coll->id().id()), - TRI_VOC_COL_STATUS_UNLOADED); -#else - auto& ci = vocbase->server().getFeature().clusterInfo(); - return ci.setCollectionStatusCoordinator(vocbase->name(), - std::to_string(coll->id().id()), - TRI_VOC_COL_STATUS_UNLOADED); -#endif - } - - return vocbase->unloadCollection(coll, false); +Result Collections::unload(TRI_vocbase_t* /*vocbase*/, LogicalCollection* /*coll*/) { + // unload doesn't do anything from ArangoDB 3.9 onwards, and the method + // may be deleted in a future version + return {}; } Result Collections::properties(Context& ctxt, VPackBuilder& builder) { diff --git a/arangod/VocBase/Methods/Collections.h b/arangod/VocBase/Methods/Collections.h index 7e63f8b14cf7..b43c4179e30a 100644 --- a/arangod/VocBase/Methods/Collections.h +++ b/arangod/VocBase/Methods/Collections.h @@ -143,11 +143,8 @@ struct Collections { /// @brief filters properties for collection creation static arangodb::velocypack::Builder filterInput(arangodb::velocypack::Slice slice); }; -#ifdef USE_ENTERPRISE -Result ULColCoordinatorEnterprise(ClusterFeature& feature, std::string const& databaseName, - std::string const& collectionCID, - TRI_vocbase_col_status_e status); +#ifdef USE_ENTERPRISE Result DropColCoordinatorEnterprise(LogicalCollection* collection, bool allowDropSystem); #endif } // namespace methods diff --git a/arangod/VocBase/vocbase.cpp b/arangod/VocBase/vocbase.cpp index a4e2e3da01d5..0825d3e4c31e 100644 --- a/arangod/VocBase/vocbase.cpp +++ b/arangod/VocBase/vocbase.cpp @@ -223,7 +223,7 @@ void TRI_vocbase_t::registerCollection(bool doLock, std::shared_ptrsetStatus(TRI_VOC_COL_STATUS_UNLOADED); + collection->setStatus(TRI_VOC_COL_STATUS_LOADED); } } @@ -450,118 +450,25 @@ arangodb::Result TRI_vocbase_t::loadCollection(arangodb::LogicalCollection& coll // read lock // check if the collection is already loaded - { - READ_LOCKER_EVENTUAL(locker, collection.statusLock()); - - TRI_vocbase_col_status_e status = collection.status(); - - if (status == TRI_VOC_COL_STATUS_LOADED) { - // DO NOT release the lock - locker.steal(); - return {}; - } - - if (status == TRI_VOC_COL_STATUS_DELETED) { - return {TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND, std::string("collection '") + collection.name() + "' not found"}; - } - - if (status == TRI_VOC_COL_STATUS_CORRUPTED) { - return {TRI_ERROR_ARANGO_CORRUPTED_COLLECTION}; - } - } - // release the read lock and acquire a write lock, we have to do some work - - // ............................................................................. - // write lock - // ............................................................................. + READ_LOCKER_EVENTUAL(locker, collection.statusLock()); - WRITE_LOCKER_EVENTUAL(locker, collection.statusLock()); - TRI_vocbase_col_status_e status = collection.status(); - // someone else loaded the collection, release the WRITE lock and try again if (status == TRI_VOC_COL_STATUS_LOADED) { - // we should never get here - locker.unlock(); - return loadCollection(collection, false); + // DO NOT release the lock + locker.steal(); + return {}; } - // someone is trying to unload the collection, cancel this, - // release the WRITE lock and try again - if (status == TRI_VOC_COL_STATUS_UNLOADING) { - // check if the collection is dropped - if (!collection.deleted()) { - collection.setStatus(TRI_VOC_COL_STATUS_LOADED); - } - locker.unlock(); - - return loadCollection(collection, false); - } - - // deleted, give up if (status == TRI_VOC_COL_STATUS_DELETED) { return {TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND, std::string("collection '") + collection.name() + "' not found"}; } - // corrupted, give up if (status == TRI_VOC_COL_STATUS_CORRUPTED) { return {TRI_ERROR_ARANGO_CORRUPTED_COLLECTION}; } - // currently loading - if (status == TRI_VOC_COL_STATUS_LOADING) { - locker.unlock(); - - // loop until the status changes - while (true) { - { - READ_LOCKER_EVENTUAL(readLocker, collection.statusLock()); - status = collection.status(); - } - - if (status != TRI_VOC_COL_STATUS_LOADING) { - break; - } - - std::this_thread::sleep_for(std::chrono::microseconds(collectionStatusPollInterval())); - } - - return loadCollection(collection, false); - } - - // unloaded, load collection - if (collection.status() == TRI_VOC_COL_STATUS_UNLOADED) { - // set the status to loading - collection.setStatus(TRI_VOC_COL_STATUS_LOADING); - - // release the lock on the collection temporarily - // this will allow other threads to check the collection's - // status while it is loading (loading may take a long time because of - // disk activity, index creation etc.) - locker.unlock(); - - TRI_UpdateTickServer(collection.id().id()); - - // lock again to adjust the status - locker.lockEventual(); - - // no one else must have changed the status - TRI_ASSERT(collection.status() == TRI_VOC_COL_STATUS_LOADING); - - collection.setStatus(TRI_VOC_COL_STATUS_LOADED); - collection.load(); - - // release the WRITE lock and try again - locker.unlock(); - - return loadCollection(collection, false); - } - - std::string const colName(collection.name()); - LOG_TOPIC("56df6", ERR, arangodb::Logger::FIXME) - << "unknown collection status " << collection.status() << " for '" - << colName << "'"; - + TRI_ASSERT(false); return {TRI_ERROR_INTERNAL, "unknwon collection status"}; } @@ -634,47 +541,7 @@ ErrorCode TRI_vocbase_t::dropCollectionWorker(arangodb::LogicalCollection* colle unregisterCollection(*collection); break; } - case TRI_VOC_COL_STATUS_LOADING: { - // collection is loading - // loop until status changes - // try again later - state = DROP_AGAIN; - break; - } - case TRI_VOC_COL_STATUS_UNLOADED: { - // collection is unloaded - bool doSync = !engine.inRecovery() && - server().getFeature().forceSyncProperties(); - - if (!collection->deleted()) { - collection->deleted(true); - - try { - engine.changeCollection(*this, *collection, doSync); - } catch (arangodb::basics::Exception const& ex) { - collection->deleted(false); - events::DropCollection(dbName, colName, ex.code()); - return ex.code(); - } catch (std::exception const&) { - collection->deleted(false); - events::DropCollection(dbName, colName, TRI_ERROR_INTERNAL); - return TRI_ERROR_INTERNAL; - } - } - - collection->setStatus(TRI_VOC_COL_STATUS_DELETED); - unregisterCollection(*collection); - - locker.unlock(); - writeLocker.unlock(); - - engine.dropCollection(*this, *collection); - - dropCollectionCallback(*collection); - break; - } - case TRI_VOC_COL_STATUS_LOADED: - case TRI_VOC_COL_STATUS_UNLOADING: { + case TRI_VOC_COL_STATUS_LOADED: { // collection is loaded collection->deleted(true); @@ -746,11 +613,8 @@ void TRI_vocbase_t::shutdown() { // starts unloading of collections for (auto& collection : collections) { - { - WRITE_LOCKER_EVENTUAL(locker, collection->statusLock()); - collection->close(); // required to release indexes - } - unloadCollection(collection.get(), true); + WRITE_LOCKER_EVENTUAL(locker, collection->statusLock()); + collection->close(); // required to release indexes } { @@ -1058,65 +922,6 @@ std::shared_ptr TRI_vocbase_t::createCollection( return collection; } -/// @brief unloads a collection -arangodb::Result TRI_vocbase_t::unloadCollection(arangodb::LogicalCollection* collection, bool force) { - { - WRITE_LOCKER_EVENTUAL(locker, collection->statusLock()); - - TRI_vocbase_col_status_e status = collection->status(); - - // an unloaded collection is unloaded - // a deleted collection is treated as unloaded - if (status == TRI_VOC_COL_STATUS_UNLOADED || - status == TRI_VOC_COL_STATUS_UNLOADING || - status == TRI_VOC_COL_STATUS_DELETED) { - return {}; - } - - // cannot unload a corrupted collection - if (status == TRI_VOC_COL_STATUS_CORRUPTED) { - return {TRI_ERROR_ARANGO_CORRUPTED_COLLECTION}; - } - - // a loading collection - if (status == TRI_VOC_COL_STATUS_LOADING) { - // throw away the write locker. we're going to switch to a read locker now - locker.unlock(); - - // loop until status changes - while (1) { - { - READ_LOCKER_EVENTUAL(readLocker, collection->statusLock()); - status = collection->status(); - } - - if (status != TRI_VOC_COL_STATUS_LOADING) { - break; - } - // sleep without lock - std::this_thread::sleep_for( - std::chrono::microseconds(collectionStatusPollInterval())); - } - // if we get here, the status has changed - return unloadCollection(collection, force); - } - - // must be loaded - if (collection->status() != TRI_VOC_COL_STATUS_LOADED) { - return {TRI_ERROR_INTERNAL, "invalid collection status"}; - } - - // mark collection as unloading - collection->setStatus(TRI_VOC_COL_STATUS_UNLOADING); - } // release locks - - collection->unload(); - - collection->setStatus(TRI_VOC_COL_STATUS_UNLOADED); - - return {}; -} - /// @brief drops a collection arangodb::Result TRI_vocbase_t::dropCollection(DataSourceId cid, bool allowDropSystem, double timeout) { diff --git a/arangod/VocBase/vocbase.h b/arangod/VocBase/vocbase.h index c28240f4aaa1..db1c6ce6ec4c 100644 --- a/arangod/VocBase/vocbase.h +++ b/arangod/VocBase/vocbase.h @@ -94,16 +94,15 @@ enum TRI_vocbase_type_e { }; /// @brief status of a collection -/// note: the NEW_BORN status is not used in ArangoDB 1.3 anymore, but is left -/// in this enum for compatibility with earlier versions +/// note: the following status existed before, but are now obosolete: +/// - TRI_VOC_COL_STATUS_NEW_BORN = 1 +/// - TRI_VOC_COL_STATUS_UNLOADED = 2 +/// - TRI_VOC_COL_STATUS_UNLOADING = 4 +/// - TRI_VOC_COL_STATUS_LOADING = 6 enum TRI_vocbase_col_status_e : int { TRI_VOC_COL_STATUS_CORRUPTED = 0, - TRI_VOC_COL_STATUS_NEW_BORN = 1, // DEPRECATED, and shouldn't be used anymore - TRI_VOC_COL_STATUS_UNLOADED = 2, TRI_VOC_COL_STATUS_LOADED = 3, - TRI_VOC_COL_STATUS_UNLOADING = 4, TRI_VOC_COL_STATUS_DELETED = 5, - TRI_VOC_COL_STATUS_LOADING = 6 }; /// @brief database @@ -314,9 +313,6 @@ struct TRI_vocbase_t { arangodb::Result dropCollection(arangodb::DataSourceId cid, bool allowDropSystem, double timeout); - /// @brief unloads a collection - arangodb::Result unloadCollection(arangodb::LogicalCollection* collection, bool force); - /// @brief locks a collection for usage by id /// Note that this will READ lock the collection you have to release the /// collection lock by yourself and call @ref TRI_ReleaseCollectionVocBase diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoCollections.js b/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoCollections.js index 24e300c3c4dd..69a0ccb8751b 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoCollections.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoCollections.js @@ -14,8 +14,6 @@ includeSystem: false, includeDocument: true, includeEdge: true, - includeLoaded: true, - includeUnloaded: true, sortBy: 'name', sortOrder: 1 }, @@ -24,18 +22,10 @@ switch (status) { case 0: return 'corrupted'; - case 1: - return 'new born collection'; - case 2: - return 'unloaded'; case 3: return 'loaded'; - case 4: - return 'unloading'; case 5: return 'deleted'; - case 6: - return 'loading'; default: return 'unknown'; } @@ -123,12 +113,6 @@ if (options.includeDocument === false && model.get('type') === 'document') { return; } - if (options.includeLoaded === false && model.get('status') === 'loaded') { - return; - } - if (options.includeUnloaded === false && model.get('status') === 'unloaded') { - return; - } result.push(model); }); diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/collectionsItemView.ejs b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/collectionsItemView.ejs index fcf248b1a4ca..fdfa19958478 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/collectionsItemView.ejs +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/collectionsItemView.ejs @@ -11,15 +11,11 @@
<%= model.get('status') %>
- <% } else if (model.get('status') === "loaded" || model.get('status') === 'unloaded' || model.get('status') === 'loading' || model.get('status') === 'unloading') { %> - <% if (!model.get('locked') && model.get("status") !== "loading" && model.get("status") !== "unloading") { %> + <% } else if (model.get('status') === "loaded") { %> + <% if (!model.get('locked')) { %>
<%= model.get('status') %>
- <% } else if (model.get('status') === 'loading' || model.get('status') === 'unloading') { %> -
- <%= model.get('status') %> -
<% } else { %>
<%= model.get('status') %> diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/collectionsView.ejs b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/collectionsView.ejs index ffebfc3d2048..6ca993da97a1 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/collectionsView.ejs +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/collectionsView.ejs @@ -50,26 +50,6 @@ -
    diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsItemView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsItemView.js index ac786b914691..e2cfa345f82c 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsItemView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsItemView.js @@ -29,9 +29,6 @@ } else { $(this.el).removeClass('locked'); } - if (this.model.get('status') === 'loading' || this.model.get('status') === 'unloading') { - $(this.el).addClass('locked'); - } $(this.el).html(this.template.render({ model: this.model })); @@ -64,68 +61,19 @@ if (this.model.get('locked')) { return 0; } - if (this.model.get('status') === 'loading') { - return 0; - } if (this.model.get('status') === 'corrupted') { return 0; } - if (this.model.get('status') === 'unloaded') { - this.loadCollection(); - } else { - window.App.navigate( - 'collection/' + encodeURIComponent(this.model.get('name')) + '/documents/1', {trigger: true} - ); - } + window.App.navigate( + 'collection/' + encodeURIComponent(this.model.get('name')) + '/documents/1', {trigger: true} + ); }, noop: function (event) { event.stopPropagation(); }, - unloadCollection: function () { - var unloadCollectionCallback = function (error) { - if (error) { - arangoHelper.arangoError('Collection error', this.model.get('name') + ' could not be unloaded.'); - } else if (error === undefined) { - this.model.set('status', 'unloading'); - this.render(); - } else { - if (window.location.hash === '#collections') { - this.model.set('status', 'unloaded'); - this.render(); - } else { - arangoHelper.arangoNotification('Collection ' + this.model.get('name') + ' unloaded.'); - } - } - }.bind(this); - - this.model.unloadCollection(unloadCollectionCallback); - window.modalView.hide(); - }, - - loadCollection: function () { - var loadCollectionCallback = function (error) { - if (error) { - arangoHelper.arangoError('Collection error', this.model.get('name') + ' could not be loaded.'); - } else if (error === undefined) { - this.model.set('status', 'loading'); - this.render(); - } else { - if (window.location.hash === '#collections') { - this.model.set('status', 'loaded'); - this.render(); - } else { - arangoHelper.arangoNotification('Collection ' + this.model.get('name') + ' loaded.'); - } - } - }.bind(this); - - this.model.loadCollection(loadCollectionCallback); - window.modalView.hide(); - }, - truncateCollection: function () { this.model.truncateCollection(); window.modalView.hide(); @@ -161,56 +109,34 @@ } else { newname = $('#change-collection-name').val(); } - var status = this.model.get('status'); - - if (status === 'loaded') { - var callbackChange = function (error) { - if (error) { - arangoHelper.arangoError('Collection error: ' + error.responseText); - } else { - this.collectionsView.render(); - window.modalView.hide(); - } - }.bind(this); - - var callbackRename = function (error) { - if (error) { - arangoHelper.arangoError('Collection error: ' + error.responseText); - } else { - var wfs = $('#change-collection-sync').val(); - var replicationFactor; - if (frontendConfig.isCluster) { - replicationFactor = $('#change-replication-factor').val(); - } - - this.model.changeCollection(wfs, replicationFactor, callbackChange); - } - }.bind(this); - if (frontendConfig.isCluster === false) { - this.model.renameCollection(newname, callbackRename); + var callbackChange = function (error) { + if (error) { + arangoHelper.arangoError('Collection error: ' + error.responseText); } else { - callbackRename(); + this.collectionsView.render(); + window.modalView.hide(); } - } else if (status === 'unloaded') { - if (this.model.get('name') !== newname) { - var callbackRename2 = function (error, data) { - if (error) { - arangoHelper.arangoError('Collection error: ' + data.responseText); - } else { - this.collectionsView.render(); - window.modalView.hide(); - } - }.bind(this); - - if (frontendConfig.isCluster === false) { - this.model.renameCollection(newname, callbackRename2); - } else { - callbackRename2(); - } + }.bind(this); + + var callbackRename = function (error) { + if (error) { + arangoHelper.arangoError('Collection error: ' + error.responseText); } else { - window.modalView.hide(); + var wfs = $('#change-collection-sync').val(); + var replicationFactor; + if (frontendConfig.isCluster) { + replicationFactor = $('#change-replication-factor').val(); + } + + this.model.changeCollection(wfs, replicationFactor, callbackChange); } + }.bind(this); + + if (frontendConfig.isCluster === false) { + this.model.renameCollection(newname, callbackRename); + } else { + callbackRename(); } } }.bind(this); @@ -223,11 +149,6 @@ if (error) { arangoHelper.arangoError('Error', 'Could not get coordinator info'); } else { - var collectionIsLoaded = false; - - if (this.model.get('status') === 'loaded') { - collectionIsLoaded = true; - } var buttons = []; var tableContent = []; @@ -296,21 +217,6 @@ ) ); } - if (collectionIsLoaded) { - buttons.push( - window.modalView.createNotificationButton( - 'Unload', - this.unloadCollection.bind(this) - ) - ); - } else { - buttons.push( - window.modalView.createNotificationButton( - 'Load', - this.loadCollection.bind(this) - ) - ); - } buttons.push( window.modalView.createSuccessButton( @@ -330,37 +236,29 @@ this.events, null, tabBar ); - if (this.model.get('status') === 'loaded') { - this.getIndex(); - } else { - $($('#infoTab').children()[1]).remove(); - } + this.getIndex(); }.bind(this); - if (collectionIsLoaded) { - var callback2 = function (error, data) { - if (error) { - arangoHelper.arangoError('Collection', 'Could not fetch properties'); - } else { - var wfs = data.waitForSync; - - // prevent "unexpected sync method error" - tableContent.push( - window.modalView.createSelectEntry( - 'change-collection-sync', - 'Wait for sync', - wfs, - 'Synchronize to disk before returning from a create or update of a document.', - [{value: false, label: 'No'}, {value: true, label: 'Yes'}]) - ); - } - after(); - }; - - this.model.getProperties(callback2); - } else { + var callback2 = function (error, data) { + if (error) { + arangoHelper.arangoError('Collection', 'Could not fetch properties'); + } else { + var wfs = data.waitForSync; + + // prevent "unexpected sync method error" + tableContent.push( + window.modalView.createSelectEntry( + 'change-collection-sync', + 'Wait for sync', + wfs, + 'Synchronize to disk before returning from a create or update of a document.', + [{value: false, label: 'No'}, {value: true, label: 'Yes'}]) + ); + } after(); - } + }; + + this.model.getProperties(callback2); } }.bind(this); window.isCoordinator(callback); diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsView.js index 19283dd9082d..73e93da37917 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsView.js @@ -60,26 +60,12 @@ $('#collection_' + model.get('name') + ' .corneredBadge').addClass(model.get('status')); } - if (model.get('locked') || model.get('status') === 'loading') { - $('#collection_' + model.get('name')).addClass('locked'); - if (model.get('locked')) { - $('#collection_' + model.get('name')).find('.corneredBadge').removeClass('loaded unloaded'); - $('#collection_' + model.get('name')).find('.corneredBadge').addClass('inProgress'); - $('#collection_' + model.get('name') + ' .corneredBadge').text(model.get('desc')); - } else { - $('#collection_' + model.get('name') + ' .corneredBadge').text(model.get('status')); - } - } else { - $('#collection_' + model.get('name')).removeClass('locked'); + $('#collection_' + model.get('name')).removeClass('locked'); + $('#collection_' + model.get('name') + ' .corneredBadge').text(model.get('status')); + if ($('#collection_' + model.get('name') + ' .corneredBadge').hasClass('inProgress')) { $('#collection_' + model.get('name') + ' .corneredBadge').text(model.get('status')); - if ($('#collection_' + model.get('name') + ' .corneredBadge').hasClass('inProgress')) { - $('#collection_' + model.get('name') + ' .corneredBadge').text(model.get('status')); - $('#collection_' + model.get('name') + ' .corneredBadge').removeClass('inProgress'); - $('#collection_' + model.get('name') + ' .corneredBadge').addClass('loaded'); - } - if (model.get('status') === 'unloaded') { - $('#collection_' + model.get('name') + ' .icon_arangodb_info').addClass('disabled'); - } + $('#collection_' + model.get('name') + ' .corneredBadge').removeClass('inProgress'); + $('#collection_' + model.get('name') + ' .corneredBadge').addClass('loaded'); } }); } @@ -164,8 +150,6 @@ 'change #searchInput': 'restrictToSearchPhrase', 'click #searchSubmit': 'restrictToSearchPhrase', 'click .checkSystemCollections': 'checkSystem', - 'click #checkLoaded': 'checkLoaded', - 'click #checkUnloaded': 'checkUnloaded', 'click #checkDocument': 'checkDocument', 'click #checkEdge': 'checkEdge', 'click #sortName': 'sortName', @@ -226,26 +210,6 @@ this.render(); } }, - checkLoaded: function () { - var searchOptions = this.collection.searchOptions; - var oldValue = searchOptions.includeLoaded; - - searchOptions.includeLoaded = ($('#checkLoaded').is(':checked') === true); - - if (oldValue !== searchOptions.includeLoaded) { - this.render(); - } - }, - checkUnloaded: function () { - var searchOptions = this.collection.searchOptions; - var oldValue = searchOptions.includeUnloaded; - - searchOptions.includeUnloaded = ($('#checkUnloaded').is(':checked') === true); - - if (oldValue !== searchOptions.includeUnloaded) { - this.render(); - } - }, sortName: function () { var searchOptions = this.collection.searchOptions; var oldValue = searchOptions.sortBy; @@ -276,8 +240,6 @@ setFilterValues: function () { var searchOptions = this.collection.searchOptions; - $('#checkLoaded').attr('checked', searchOptions.includeLoaded); - $('#checkUnloaded').attr('checked', searchOptions.includeUnloaded); $('.checkSystemCollections').attr('checked', searchOptions.includeSystem); $('#checkEdge').attr('checked', searchOptions.includeEdge); $('#checkDocument').attr('checked', searchOptions.includeDocument); diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/settingsView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/settingsView.js index fb8e39e1b0a4..658006cfeabf 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/settingsView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/settingsView.js @@ -30,52 +30,6 @@ ); }, - unloadCollection: function () { - if (!this.readOnly) { - var unloadCollectionCallback = function (error) { - if (error) { - arangoHelper.arangoError('Collection error', this.model.get('name') + ' could not be unloaded.'); - } else if (error === undefined) { - this.model.set('status', 'unloading'); - this.render(); - } else { - if (window.location.hash === '#collections') { - this.model.set('status', 'unloaded'); - this.render(); - } else { - arangoHelper.arangoNotification('Collection ' + this.model.get('name') + ' unloaded.'); - } - } - }.bind(this); - - this.model.unloadCollection(unloadCollectionCallback); - window.modalView.hide(); - } - }, - - loadCollection: function () { - if (!this.readOnly) { - var loadCollectionCallback = function (error) { - if (error) { - arangoHelper.arangoError('Collection error', this.model.get('name') + ' could not be loaded.'); - } else if (error === undefined) { - this.model.set('status', 'loading'); - this.render(); - } else { - if (window.location.hash === '#collections') { - this.model.set('status', 'loaded'); - this.render(); - } else { - arangoHelper.arangoNotification('Collection ' + this.model.get('name') + ' loaded.'); - } - } - }.bind(this); - - this.model.loadCollection(loadCollectionCallback); - window.modalView.hide(); - } - }, - truncateCollection: function () { if (!this.readOnly) { this.model.truncateCollection(); @@ -119,72 +73,50 @@ } else { newname = $('#change-collection-name').val(); } - var status = this.model.get('status'); - - if (status === 'loaded') { - var self = this; - var callbackChange = function (error, data) { - if (error) { - self.render(); - arangoHelper.arangoError('Collection error: ' + data.responseJSON.errorMessage); - } else { - arangoHelper.arangoNotification('Collection: ' + 'Successfully changed.'); - window.App.navigate('#cSettings/' + newname, {trigger: true}); - } - }; + var self = this; - var callbackRename = function (error) { - var abort = false; - if (error) { - arangoHelper.arangoError('Collection error: ' + error.responseText); - } else { - var wfs = $('#change-collection-sync').val(); - var replicationFactor; - var writeConcern; + var callbackChange = function (error, data) { + if (error) { + self.render(); + arangoHelper.arangoError('Collection error: ' + data.responseJSON.errorMessage); + } else { + arangoHelper.arangoNotification('Collection: ' + 'Successfully changed.'); + window.App.navigate('#cSettings/' + newname, {trigger: true}); + } + }; - if (frontendConfig.isCluster) { - replicationFactor = $('#change-replication-factor').val(); - writeConcern = $('#change-write-concern').val(); - try { - if (Number.parseInt(writeConcern) > Number.parseInt(replicationFactor)) { - // validation here, as our Joi integration misses some core features - arangoHelper.arangoError("Change Collection", "Write concern is not allowed to be greater than replication factor"); - abort = true; - } - } catch (ignore) { + var callbackRename = function (error) { + var abort = false; + if (error) { + arangoHelper.arangoError('Collection error: ' + error.responseText); + } else { + var wfs = $('#change-collection-sync').val(); + var replicationFactor; + var writeConcern; + + if (frontendConfig.isCluster) { + replicationFactor = $('#change-replication-factor').val(); + writeConcern = $('#change-write-concern').val(); + try { + if (Number.parseInt(writeConcern) > Number.parseInt(replicationFactor)) { + // validation here, as our Joi integration misses some core features + arangoHelper.arangoError("Change Collection", "Write concern is not allowed to be greater than replication factor"); + abort = true; } - } - if (!abort) { - this.model.changeCollection(wfs, replicationFactor, writeConcern, callbackChange); + } catch (ignore) { } } - }.bind(this); - - if (frontendConfig.isCluster === false) { - this.model.renameCollection(newname, callbackRename); - } else { - callbackRename(); - } - } else if (status === 'unloaded') { - if (this.model.get('name') !== newname) { - var callbackRename2 = function (error, data) { - if (error) { - arangoHelper.arangoError('Collection' + data.responseText); - } else { - arangoHelper.arangoNotification('Collection' + 'Successfully changed.'); - window.App.navigate('#cSettings/' + newname, {trigger: true}); - } - }; - - if (frontendConfig.isCluster === false) { - this.model.renameCollection(newname, callbackRename2); - } else { - callbackRename2(); + if (!abort) { + this.model.changeCollection(wfs, replicationFactor, writeConcern, callbackChange); } - } else { - window.modalView.hide(); } + }.bind(this); + + if (frontendConfig.isCluster === false) { + this.model.renameCollection(newname, callbackRename); + } else { + callbackRename(); } } }.bind(this); @@ -210,11 +142,6 @@ if (error) { arangoHelper.arangoError('Error', 'Could not get coordinator info'); } else { - var collectionIsLoaded = false; - - if (this.model.get('status') === 'loaded') { - collectionIsLoaded = true; - } var buttons = []; var tableContent = []; @@ -309,21 +236,6 @@ ) ); } - if (collectionIsLoaded) { - buttons.push( - window.modalView.createNotificationButton( - 'Unload', - this.unloadCollection.bind(this) - ) - ); - } else { - buttons.push( - window.modalView.createNotificationButton( - 'Load', - this.loadCollection.bind(this) - ) - ); - } buttons.push( window.modalView.createSuccessButton( @@ -346,92 +258,86 @@ $($('#infoTab').children()[1]).remove(); }.bind(this); - if (collectionIsLoaded) { - var callback2 = function (error, data) { - if (error) { - arangoHelper.arangoError('Collection', 'Could not fetch properties'); - } else { - var wfs = data.waitForSync; - if (data.replicationFactor && frontendConfig.isCluster) { - if (data.replicationFactor === 'satellite') { - tableContent.push( - window.modalView.createReadOnlyEntry( - 'change-replication-factor', - 'Replication factor', - data.replicationFactor, - 'This collection is a SatelliteCollection. The replicationFactor is not changeable.', - '', - true - ) - ); - tableContent.push( - window.modalView.createReadOnlyEntry( - 'change-write-concern', - 'Write concern', - JSON.stringify(data.writeConcern), - 'This collection is a SatelliteCollection. The write concern is not changeable.', - '', - true - ) - ); - } else { - tableContent.push( - window.modalView.createTextEntry( - 'change-replication-factor', - 'Replication factor', - data.replicationFactor, - 'The replicationFactor parameter is the total number of copies being kept, that is, it is one plus the number of followers. Must be a number.', - '', - true, - [ - { - rule: Joi.string().allow('').optional().regex(/^[0-9]*$/), - msg: 'Must be a number.' - } - ] - ) - ); - tableContent.push( - window.modalView.createTextEntry( - 'change-write-concern', - 'Write concern', - data.writeConcern, - 'Numeric value. Must be at least 1. Must be smaller or equal compared to the replication factor. Total number of copies of the data in the cluster that are required for each write operation. If we get below this value the collection will be read-only until enough copies are created.', - '', - true, - [ - { - rule: Joi.string().allow('').optional().regex(/^[1-9]*$/), - msg: 'Must be a number. Must be at least 1 and has to be smaller or equal compared to the replicationFactor.' - } - ] - ) - ); - } + var callback2 = function (error, data) { + if (error) { + arangoHelper.arangoError('Collection', 'Could not fetch properties'); + } else { + var wfs = data.waitForSync; + if (data.replicationFactor && frontendConfig.isCluster) { + if (data.replicationFactor === 'satellite') { + tableContent.push( + window.modalView.createReadOnlyEntry( + 'change-replication-factor', + 'Replication factor', + data.replicationFactor, + 'This collection is a SatelliteCollection. The replicationFactor is not changeable.', + '', + true + ) + ); + tableContent.push( + window.modalView.createReadOnlyEntry( + 'change-write-concern', + 'Write concern', + JSON.stringify(data.writeConcern), + 'This collection is a SatelliteCollection. The write concern is not changeable.', + '', + true + ) + ); + } else { + tableContent.push( + window.modalView.createTextEntry( + 'change-replication-factor', + 'Replication factor', + data.replicationFactor, + 'The replicationFactor parameter is the total number of copies being kept, that is, it is one plus the number of followers. Must be a number.', + '', + true, + [ + { + rule: Joi.string().allow('').optional().regex(/^[0-9]*$/), + msg: 'Must be a number.' + } + ] + ) + ); + tableContent.push( + window.modalView.createTextEntry( + 'change-write-concern', + 'Write concern', + data.writeConcern, + 'Numeric value. Must be at least 1. Must be smaller or equal compared to the replication factor. Total number of copies of the data in the cluster that are required for each write operation. If we get below this value the collection will be read-only until enough copies are created.', + '', + true, + [ + { + rule: Joi.string().allow('').optional().regex(/^[1-9]*$/), + msg: 'Must be a number. Must be at least 1 and has to be smaller or equal compared to the replicationFactor.' + } + ] + ) + ); } - - // prevent "unexpected sync method error" - tableContent.push( - window.modalView.createSelectEntry( - 'change-collection-sync', - 'Wait for sync', - wfs, - 'Synchronize to disk before returning from a create or update of a document.', - [{value: false, label: 'No'}, {value: true, label: 'Yes'}]) - ); } - after(); - // check permissions and adjust views - arangoHelper.checkCollectionPermissions(self.collectionName, self.changeViewToReadOnly.bind(this)); - }; - - this.model.getProperties(callback2); - } else { + // prevent "unexpected sync method error" + tableContent.push( + window.modalView.createSelectEntry( + 'change-collection-sync', + 'Wait for sync', + wfs, + 'Synchronize to disk before returning from a create or update of a document.', + [{value: false, label: 'No'}, {value: true, label: 'Yes'}]) + ); + } after(); + // check permissions and adjust views arangoHelper.checkCollectionPermissions(self.collectionName, self.changeViewToReadOnly.bind(this)); - } + }; + + this.model.getProperties(callback2); } }.bind(this); window.isCoordinator(callback); diff --git a/js/client/modules/@arangodb/arango-collection.js b/js/client/modules/@arangodb/arango-collection.js index dcf362a29f0a..74873a1405bd 100644 --- a/js/client/modules/@arangodb/arango-collection.js +++ b/js/client/modules/@arangodb/arango-collection.js @@ -317,24 +317,13 @@ ArangoCollection.prototype.name = function () { // ////////////////////////////////////////////////////////////////////////////// ArangoCollection.prototype.status = function () { - if (this._status === null || - this._status === ArangoCollection.STATUS_UNLOADING || - this._status === ArangoCollection.STATUS_UNLOADED) { + if (this._status === null) { this._status = null; this.refresh(); } // save original status - var result = this._status; - - if (this._status === ArangoCollection.STATUS_UNLOADING || - this._status === ArangoCollection.STATUS_UNLOADED) { - // if collection is currently unloading, we must not cache this info - this._status = null; - } - - // return the correct result - return result; + return this._status; }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/js/common/modules/@arangodb/arango-collection-common.js b/js/common/modules/@arangodb/arango-collection-common.js index 875a6a350b41..fbd49184ea58 100644 --- a/js/common/modules/@arangodb/arango-collection-common.js +++ b/js/common/modules/@arangodb/arango-collection-common.js @@ -53,41 +53,24 @@ var SimpleQueryFulltext = simple.SimpleQueryFulltext; ArangoCollection.STATUS_CORRUPTED = 0; -// ////////////////////////////////////////////////////////////////////////////// -// / @brief collection is new born -// / @deprecated -// ////////////////////////////////////////////////////////////////////////////// - -ArangoCollection.STATUS_NEW_BORN = 1; - -// ////////////////////////////////////////////////////////////////////////////// -// / @brief collection is unloaded -// ////////////////////////////////////////////////////////////////////////////// - -ArangoCollection.STATUS_UNLOADED = 2; - // ////////////////////////////////////////////////////////////////////////////// // / @brief collection is loaded // ////////////////////////////////////////////////////////////////////////////// ArangoCollection.STATUS_LOADED = 3; -// ////////////////////////////////////////////////////////////////////////////// -// / @brief collection is unloading -// ////////////////////////////////////////////////////////////////////////////// - -ArangoCollection.STATUS_UNLOADING = 4; - // ////////////////////////////////////////////////////////////////////////////// // / @brief collection is deleted // ////////////////////////////////////////////////////////////////////////////// ArangoCollection.STATUS_DELETED = 5; -// ////////////////////////////////////////////////////////////////////////////// -// / @brief collection is currently loading -// ////////////////////////////////////////////////////////////////////////////// - +/// note: the following collection statuses are not used by arangod anymore. +/// they are only here for backwards-compatibility, but they will be rmeoved +/// in a future version +ArangoCollection.STATUS_NEW_BORN = 1; +ArangoCollection.STATUS_UNLOADED = 2; +ArangoCollection.STATUS_UNLOADING = 4; ArangoCollection.STATUS_LOADING = 6; // ////////////////////////////////////////////////////////////////////////////// @@ -114,15 +97,6 @@ ArangoCollection.prototype._PRINT = function (context) { var name = this.name(); switch (this.status()) { - case ArangoCollection.STATUS_NEW_BORN: - status = 'new born'; - break; - case ArangoCollection.STATUS_UNLOADED: - status = 'unloaded'; - break; - case ArangoCollection.STATUS_UNLOADING: - status = 'unloading'; - break; case ArangoCollection.STATUS_LOADED: status = 'loaded'; break; diff --git a/js/common/modules/@arangodb/test-helper-common.js b/js/common/modules/@arangodb/test-helper-common.js index dfe37971f44c..80784558dec6 100644 --- a/js/common/modules/@arangodb/test-helper-common.js +++ b/js/common/modules/@arangodb/test-helper-common.js @@ -91,28 +91,8 @@ exports.Helper = { }, waitUnload: function (collection, waitForCollector) { - var arangodb = require('@arangodb'); - var internal = require('internal'); - - collection.unload(); + let internal = require('internal'); internal.wal.flush(true, waitForCollector || false); - - var iterations = 0; - - while (collection.status() !== arangodb.ArangoCollection.STATUS_UNLOADED) { - collection.unload(); - internal.wait(0.25, true); - - ++iterations; - - if (iterations === 20) { - require('console').log('waiting for collection ' + collection.name() + ' to unload'); - } else if (iterations === 400) { - require('console').log('waited very long for unload of collection ' + collection.name()); - } else if (iterations === 1600) { - throw 'waited too long for unload of collection ' + collection.name(); - } - } }, }; diff --git a/tests/Mocks/StorageEngineMock.h b/tests/Mocks/StorageEngineMock.h index eb8f8ed5608e..83ddb4b0c16c 100644 --- a/tests/Mocks/StorageEngineMock.h +++ b/tests/Mocks/StorageEngineMock.h @@ -123,8 +123,6 @@ class PhysicalCollectionMock : public arangodb::PhysicalCollection { arangodb::ManagedDocumentResult& result, arangodb::OperationOptions& options, arangodb::ManagedDocumentResult& previous) override; - virtual void load() override {} - virtual void unload() override {} virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const& slice, bool doSync) override; diff --git a/tests/js/common/shell/shell-collection-noncluster.js b/tests/js/common/shell/shell-collection-noncluster.js index 12029c7bb184..391b1d0d1683 100644 --- a/tests/js/common/shell/shell-collection-noncluster.js +++ b/tests/js/common/shell/shell-collection-noncluster.js @@ -28,13 +28,13 @@ /// @author Copyright 2012, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// -var jsunity = require("jsunity"); -var arangodb = require("@arangodb"); -var ArangoCollection = arangodb.ArangoCollection; -var testHelper = require("@arangodb/test-helper").Helper; +const jsunity = require("jsunity"); +const arangodb = require("@arangodb"); +const ArangoCollection = arangodb.ArangoCollection; +const testHelper = require("@arangodb/test-helper").Helper; const internal = require("internal"); -var db = arangodb.db; -var ERRORS = arangodb.errors; +const db = arangodb.db; +const ERRORS = arangodb.errors; //////////////////////////////////////////////////////////////////////////////// /// @brief test suite: collection @@ -252,46 +252,6 @@ function CollectionSuite () { assertTrue(idx.figures.cacheLifeTimeHitRate > initial[i].cacheLifeTimeHitRate, idx, { idx, initial }); } }); - - // cache usage should be 0 after unload - c.unload(); // destorys cache - idxs = c.getIndexes(true); // loads collection - idxs.forEach(function(idx, i) { - if (idx.figures.cacheInUse) { - assertTrue(idx.figures.cacheSize > 0); - assertEqual(idx.figures.cacheUsage, 0); - } - }); - - // lets do some reads - for (let i = 0; i < 10000; i++) { - c.outEdges("c/v" + (i / 100)); - c.inEdges("c/v" + (i / 100)); - } - idxs = c.getIndexes(true); - // cache was empty, hit rate should be 0 - idxs.forEach(function(idx) { - if (idx.figures.cacheInUse) { - assertTrue(idx.figures.cacheSize > 0, idx); - assertTrue(idx.figures.cacheUsage > 0, idx); - assertEqual(idx.figures.cacheLifeTimeHitRate, 0, idx); - } - }); - - for(let i = 0; i < 10000; i++) { - c.outEdges("c/v" + (i / 100)); - c.inEdges("c/v" + (i / 100)); - } - idxs = c.getIndexes(true); - // cache was partially filled same queries, lifetime hit rate - // should be about 50 % - // but actual lifetime hit rate is unpredictable due to varying - // load and memory constraints during tests - idxs.forEach(function(idx) { - if (idx.figures.cacheInUse) { - assertTrue(idx.figures.cacheLifeTimeHitRate > 15, idx); - } - }); } finally { db._drop(cn); } diff --git a/tests/js/common/shell/shell-edge-index-noncluster.js b/tests/js/common/shell/shell-edge-index-noncluster.js index cb71bc7ae4b8..974a1aa8c82c 100644 --- a/tests/js/common/shell/shell-edge-index-noncluster.js +++ b/tests/js/common/shell/shell-edge-index-noncluster.js @@ -101,21 +101,10 @@ function EdgeIndexBucketsSuite () { } } - // unload collections - edge2.unload(); - edge3.unload(); edge2 = null; edge3 = null; internal.wal.flush(true, true); - while (db._collection(en2).status() !== ArangoCollection.STATUS_UNLOADED) { - db._collection(en2).unload(); - wait(0.5); - } - while (db._collection(en3).status() !== ArangoCollection.STATUS_UNLOADED) { - db._collection(en3).unload(); - wait(0.5); - } edge2 = db._collection(en2); edge3 = db._collection(en3); @@ -159,21 +148,10 @@ function EdgeIndexBucketsSuite () { edge3.remove(key); } - // unload collections - edge2.unload(); - edge3.unload(); edge2 = null; edge3 = null; internal.wal.flush(true, true); - while (db._collection(en2).status() !== ArangoCollection.STATUS_UNLOADED) { - db._collection(en2).unload(); - wait(0.5); - } - while (db._collection(en3).status() !== ArangoCollection.STATUS_UNLOADED) { - db._collection(en3).unload(); - wait(0.5); - } edge2 = db._collection(en2); edge3 = db._collection(en3); diff --git a/tests/rb/HttpInterface/api-collection-spec.rb b/tests/rb/HttpInterface/api-collection-spec.rb index 166986b0a84c..9e10f2419700 100644 --- a/tests/rb/HttpInterface/api-collection-spec.rb +++ b/tests/rb/HttpInterface/api-collection-spec.rb @@ -795,7 +795,7 @@ doc.parsed_response['code'].should eq(200) doc.parsed_response['id'].should eq(cid) doc.parsed_response['name'].should eq(@cn) - [2, 4].should include(doc.parsed_response['status']) + doc.parsed_response['status'].should eq(3) ArangoDB.drop_collection(@cn) end @@ -813,7 +813,7 @@ doc.parsed_response['code'].should eq(200) doc.parsed_response['id'].should eq(cid) doc.parsed_response['name'].should eq(@cn) - [2, 4].should include(doc.parsed_response['status']) + doc.parsed_response['status'].should eq(3) ArangoDB.drop_collection(@cn) end