diff --git a/arangod/Cluster/DBServerAgencySync.cpp b/arangod/Cluster/DBServerAgencySync.cpp index 6f64795efd..0df0fddb28 100644 --- a/arangod/Cluster/DBServerAgencySync.cpp +++ b/arangod/Cluster/DBServerAgencySync.cpp @@ -73,6 +73,7 @@ Result DBServerAgencySync::getLocalCollections(VPackBuilder& collections) { } VPackObjectBuilder c(&collections); + for (auto const& database : Databases::list()) { try { @@ -80,23 +81,33 @@ Result DBServerAgencySync::getLocalCollections(VPackBuilder& collections) { auto vocbase = &guard.database(); collections.add(VPackValue(database)); + VPackObjectBuilder db(&collections); auto cols = vocbase->collections(false); for (auto const& collection : cols) { collections.add(VPackValue(collection->name())); + VPackObjectBuilder col(&collections); - collection->toVelocyPack(collections,true,false); + + collection->properties(collections,true,false); + auto const& folls = collection->followers(); std::string const theLeader = folls->getLeader(); + collections.add("theLeader", VPackValue(theLeader)); + if (theLeader.empty()) { // we are the leader ourselves // In this case we report our in-sync followers here in the format // of the agency: [ leader, follower1, follower2, ... ] collections.add(VPackValue("servers")); + { VPackArrayBuilder guard(&collections); + collections.add(VPackValue(arangodb::ServerState::instance()->getId())); + std::shared_ptr const> srvs = folls->get(); + for (auto const& s : *srvs) { collections.add(VPackValue(s)); } @@ -108,11 +119,9 @@ Result DBServerAgencySync::getLocalCollections(VPackBuilder& collections) { TRI_ERROR_INTERNAL, std::string("Failed to guard database ") + database + ": " + e.what()); } - } return Result(); - } DBServerAgencySyncResult DBServerAgencySync::execute() { diff --git a/arangod/Cluster/UpdateCollection.cpp b/arangod/Cluster/UpdateCollection.cpp index 9b4c9d7ba2..a03cd0b91c 100644 --- a/arangod/Cluster/UpdateCollection.cpp +++ b/arangod/Cluster/UpdateCollection.cpp @@ -45,7 +45,7 @@ UpdateCollection::UpdateCollection( ActionBase(feature, desc) { std::stringstream error; - + _labels.emplace(FAST_TRACK); if (!desc.has(COLLECTION)) { @@ -145,7 +145,6 @@ bool UpdateCollection::first() { auto const& props = properties(); try { - DatabaseGuard guard(database); auto vocbase = &guard.database(); @@ -162,7 +161,7 @@ bool UpdateCollection::first() { // ourselves does not appear in shards[shard] but only // "_" + ourselves. handleLeadership(*coll, localLeader, plannedLeader, followersToDrop); - _result = Collections::updateProperties(coll.get(), props); + _result = Collections::updateProperties(*coll, props, false); // always a full-update if (!_result.ok()) { LOG_TOPIC(ERR, Logger::MAINTENANCE) << "failed to update properties" @@ -179,6 +178,7 @@ bool UpdateCollection::first() { } } catch (std::exception const& e) { std::stringstream error; + error << "action " << _description << " failed with exception " << e.what(); LOG_TOPIC(WARN, Logger::MAINTENANCE) << "UpdateCollection: " << error.str(); _result.reset(TRI_ERROR_INTERNAL, error.str()); @@ -190,6 +190,6 @@ bool UpdateCollection::first() { } notify(); - return false; + return false; } diff --git a/arangod/IResearch/IResearchLink.cpp b/arangod/IResearch/IResearchLink.cpp index 11d519821c..2925dbdec5 100644 --- a/arangod/IResearch/IResearchLink.cpp +++ b/arangod/IResearch/IResearchLink.cpp @@ -69,10 +69,18 @@ IResearchLink::IResearchLink( } IResearchLink::~IResearchLink() { - if (_dropCollectionInDestructor) { - drop(); - } else { + if (!_dropCollectionInDestructor) { unload(); // disassociate from view if it has not been done yet + + return; + } + + auto res = drop(); + + if (!res.ok()) { + LOG_TOPIC(ERR, arangodb::iresearch::TOPIC) + << "failed to drop arangosearch view link in link destructor: " + << res.errorNumber() << " " << res.errorMessage(); } } @@ -87,6 +95,21 @@ bool IResearchLink::operator==(IResearchLinkMeta const& meta) const noexcept { return _meta == meta; } +void IResearchLink::afterTruncate() { + ReadMutex mutex(_mutex); // '_view' can be asynchronously modified + SCOPED_LOCK(mutex); + + if (!_view) { + THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_LOADED); // IResearchView required + } + + auto res = _view->drop(_view->id(), false); + + if (!res.ok()) { + THROW_ARANGO_EXCEPTION(res); + } +} + void IResearchLink::batchInsert( transaction::Methods* trx, std::vector> const& batch, @@ -126,22 +149,24 @@ bool IResearchLink::canBeDropped() const { return true; // valid for a link to be dropped from an iResearch view } -int IResearchLink::drop() { +arangodb::Result IResearchLink::drop() { ReadMutex mutex(_mutex); // '_view' can be asynchronously modified SCOPED_LOCK(mutex); if (!_view) { - return TRI_ERROR_ARANGO_COLLECTION_NOT_LOADED; // IResearchView required + return arangodb::Result( + TRI_ERROR_ARANGO_COLLECTION_NOT_LOADED, // IResearchView required + std::string("failed to drop collection '") + _collection.name() + "' from an unset arangosearch view" + ); } auto res = _view->drop(_collection.id()); if (!res.ok()) { - LOG_TOPIC(WARN, arangodb::iresearch::TOPIC) - << "failed to drop collection '" << _collection.name() - << "' from arangosearch view '" << _view->name() << "': " << res.errorMessage(); - - return res.errorNumber(); + return arangodb::Result( + res.errorNumber(), + std::string("failed to drop collection '") + _collection.name() + "' from arangosearch view '" + _view->name() + "': " + res.errorMessage() + ); } _dropCollectionInDestructor = false; // will do drop now @@ -153,25 +178,10 @@ int IResearchLink::drop() { // FIXME TODO this workaround should be in ClusterInfo when moving 'Plan' to 'Current', i.e. IResearchViewDBServer::drop if (arangodb::ServerState::instance()->isDBServer()) { - return view->drop().errorNumber(); // cluster-view in ClusterInfo should already not have cid-view + return view->drop(); // cluster-view in ClusterInfo should already not have cid-view } - return TRI_ERROR_NO_ERROR; -} - -void IResearchLink::doAfterTruncate() { - ReadMutex mutex(_mutex); // '_view' can be asynchronously modified - SCOPED_LOCK(mutex); - - if (!_view) { - THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_LOADED); // IResearchView required - } - - auto res = _view->drop(_view->id(), false); - - if (!res.ok()) { - THROW_ARANGO_EXCEPTION(res); - } + return arangodb::Result(); } bool IResearchLink::hasBatchInsert() const { @@ -501,7 +511,7 @@ int IResearchLink::unload() { // FIXME TODO remove once LogicalCollection::drop(...) will drop its indexes explicitly if (_collection.deleted() || TRI_vocbase_col_status_e::TRI_VOC_COL_STATUS_DELETED == _collection.status()) { - return drop(); + return drop().errorNumber(); } _dropCollectionInDestructor = false; // valid link (since unload(..) called), should not be dropped @@ -545,4 +555,4 @@ NS_END // arangodb // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE -// ----------------------------------------------------------------------------- \ No newline at end of file +// ----------------------------------------------------------------------------- diff --git a/arangod/IResearch/IResearchLink.h b/arangod/IResearch/IResearchLink.h index 05cc028159..42273c46d4 100644 --- a/arangod/IResearch/IResearchLink.h +++ b/arangod/IResearch/IResearchLink.h @@ -64,6 +64,8 @@ class IResearchLink { return !(*this == meta); } + void afterTruncate(); // arangodb::Index override + //////////////////////////////////////////////////////////////////////////////// /// @brief insert a set of ArangoDB documents into an iResearch View using /// '_meta' params @@ -79,9 +81,7 @@ class IResearchLink { //////////////////////////////////////////////////////////////////////////////// /// @brief called when the iResearch Link is dropped //////////////////////////////////////////////////////////////////////////////// - int drop(); // arangodb::Index override - - void doAfterTruncate(); + arangodb::Result drop(); // arangodb::Index override bool hasBatchInsert() const; // arangodb::Index override bool hasSelectivityEstimate() const; // arangodb::Index override diff --git a/arangod/IResearch/IResearchLinkHelper.cpp b/arangod/IResearch/IResearchLinkHelper.cpp index 8cea0d02c9..90cbcf2dea 100644 --- a/arangod/IResearch/IResearchLinkHelper.cpp +++ b/arangod/IResearch/IResearchLinkHelper.cpp @@ -219,8 +219,17 @@ arangodb::Result modifyLinks( linkDefinitions.emplace_back(std::move(namedJson), std::move(linkMeta)); } + auto trxCtx = arangodb::transaction::StandaloneContext::Create(vocbase); + // add removals for any 'stale' links not found in the 'links' definition for (auto& id: stale) { + if (!trxCtx->resolver().getCollection(id)) { + LOG_TOPIC(WARN, arangodb::iresearch::TOPIC) + << "request for removal of a stale link to a missing collection '" << id << "', ignoring"; + + continue; // skip adding removal requests to stale links to non-existant collections (already dropped) + } + linkModifications.emplace_back(collectionsToLock.size()); linkModifications.back()._stale = true; collectionsToLock.emplace_back(std::to_string(id)); @@ -233,7 +242,7 @@ arangodb::Result modifyLinks( static std::vector const EMPTY; arangodb::ExecContextScope scope(arangodb::ExecContext::superuser()); // required to remove links from non-RW collections arangodb::transaction::Methods trx( - arangodb::transaction::StandaloneContext::Create(vocbase), + trxCtx, EMPTY, // readCollections EMPTY, // writeCollections collectionsToLock, // exclusiveCollections @@ -251,7 +260,10 @@ arangodb::Result modifyLinks( auto res = trx.begin(); if (!res.ok()) { - return res; + return arangodb::Result( + res.errorNumber(), + std::string("failed to start transaction while updating arangosearch view '") + view.name() + "' error: " + res.errorMessage() + ); } { @@ -419,7 +431,15 @@ arangodb::Result modifyLinks( } if (error.empty()) { - return arangodb::Result(trx.commit()); + auto res = trx.commit(); + + return res.ok() + ? arangodb::Result() + : arangodb::Result( + res.errorNumber(), + std::string("failed to commit transaction while updating arangosearch view '") + view.name() + "' error: " + res.errorMessage() + ) + ; } return arangodb::Result( diff --git a/arangod/IResearch/IResearchMMFilesLink.h b/arangod/IResearch/IResearchMMFilesLink.h index d867921919..02f0dda5b3 100644 --- a/arangod/IResearch/IResearchMMFilesLink.h +++ b/arangod/IResearch/IResearchMMFilesLink.h @@ -38,6 +38,10 @@ class IResearchMMFilesLink final virtual ~IResearchMMFilesLink(); + void afterTruncate(TRI_voc_tick_t /*tick*/) override { + IResearchLink::afterTruncate(); + }; + virtual void batchInsert( transaction::Methods* trx, std::vector> const& documents, @@ -51,12 +55,8 @@ class IResearchMMFilesLink final } virtual int drop() override { - return IResearchLink::drop(); + return IResearchLink::drop().errorNumber(); } - - void afterTruncate(TRI_voc_tick_t /*tick*/) override { - IResearchLink::doAfterTruncate(); - }; virtual bool hasBatchInsert() const override { return IResearchLink::hasBatchInsert(); @@ -152,4 +152,4 @@ class IResearchMMFilesLink final NS_END // iresearch NS_END // arangodb -#endif +#endif \ No newline at end of file diff --git a/arangod/IResearch/IResearchRocksDBLink.h b/arangod/IResearch/IResearchRocksDBLink.h index e9bb949f61..6880a48968 100644 --- a/arangod/IResearch/IResearchRocksDBLink.h +++ b/arangod/IResearch/IResearchRocksDBLink.h @@ -38,6 +38,10 @@ class IResearchRocksDBLink final virtual ~IResearchRocksDBLink(); + virtual void afterTruncate(TRI_voc_tick_t/*tick*/) override { + IResearchLink::afterTruncate(); + }; + virtual void batchInsert( transaction::Methods* trx, std::vector> const& documents, @@ -52,12 +56,9 @@ class IResearchRocksDBLink final virtual int drop() override { writeRocksWalMarker(); - return IResearchLink::drop(); + + return IResearchLink::drop().errorNumber(); } - - virtual void afterTruncate(TRI_voc_tick_t/*tick*/) override { - IResearchLink::doAfterTruncate(); - }; virtual bool hasBatchInsert() const override { return IResearchLink::hasBatchInsert(); @@ -152,4 +153,4 @@ class IResearchRocksDBLink final NS_END // iresearch NS_END // arangodb -#endif +#endif \ No newline at end of file diff --git a/arangod/IResearch/IResearchView.cpp b/arangod/IResearch/IResearchView.cpp index 5d4ea3c3a7..d9dc821042 100644 --- a/arangod/IResearch/IResearchView.cpp +++ b/arangod/IResearch/IResearchView.cpp @@ -826,10 +826,7 @@ IResearchView::IResearchView( auto* viewPtr = view->get(); if (!viewPtr) { - LOG_TOPIC(WARN, arangodb::iresearch::TOPIC) - << "Invalid call to post-recovery callback of arangosearch view"; - - return arangodb::Result(); // view no longer in recovery state + return arangodb::Result(); // view no longer in recovery state, i.e. during recovery it was created and later dropped } viewPtr->verifyKnownCollections(); @@ -1154,7 +1151,7 @@ arangodb::Result IResearchView::drop( ) { auto filter = iresearch::FilterFactory::filter(cid); - WriteMutex rmutex(_mutex); // '_meta' and '_storeByTid' can be asynchronously updated + ReadMutex rmutex(_mutex); // '_meta' and '_storeByTid' can be asynchronously updated WriteMutex wmutex(_mutex); // '_meta' and '_storeByTid' can be asynchronously updated DEFER_SCOPED_LOCK_NAMED(rmutex, rlock); DEFER_SCOPED_LOCK_NAMED(wmutex, wlock); @@ -1414,11 +1411,9 @@ bool IResearchView::emplace(TRI_voc_cid_t cid) { } arangodb::Result IResearchView::commit() { - ReadMutex mutex(_mutex); // '_storePersisted' can be asynchronously updated - SCOPED_LOCK(mutex); - + // '_storePersisted' protected by '_asyncSelf' held by snapshot()/registerFlushCallback() if (!_storePersisted) { - return {}; // nothing more to do + return arangodb::Result(); // nothing more to do } try { @@ -1855,6 +1850,7 @@ PrimaryKeyIndexReader* IResearchView::snapshot( break; case Snapshot::SyncAndReplace: { // ingore existing cookie, recreate snapshot + SCOPED_LOCK(_asyncSelf->mutex()); // '_storePersisted' may be modified asynchronously auto const res = const_cast(this)->commit(); if (!res.ok()) { @@ -1887,9 +1883,7 @@ PrimaryKeyIndexReader* IResearchView::snapshot( } try { - ReadMutex mutex(_mutex); // _storePersisted can be asynchronously updated - SCOPED_LOCK(mutex); - + // '_storePersisted' protected by '_asyncSelf' held by ViewStateRead if (_storePersisted) { reader->add(_storePersisted._reader); } @@ -2030,7 +2024,8 @@ arangodb::Result IResearchView::updateProperties( return IResearchLinkHelper::updateLinks( collections, vocbase(), *this, links, stale - ); } catch (arangodb::basics::Exception& e) { + ); + } catch (arangodb::basics::Exception& e) { LOG_TOPIC(WARN, iresearch::TOPIC) << "caught exception while updating properties for arangosearch view '" << name() << "': " << e.code() << " " << e.what(); IR_LOG_EXCEPTION(); diff --git a/arangod/IResearch/IResearchView.h b/arangod/IResearch/IResearchView.h index 3431c836a2..9c8c1a447c 100644 --- a/arangod/IResearch/IResearchView.h +++ b/arangod/IResearch/IResearchView.h @@ -274,7 +274,6 @@ class IResearchView final ////////////////////////////////////////////////////////////////////////////// /// @brief updates properties of an existing view ////////////////////////////////////////////////////////////////////////////// - using LogicalView::updateProperties; arangodb::Result updateProperties(std::shared_ptr const& meta); // nullptr == TRI_ERROR_BAD_PARAMETER /////////////////////////////////////////////////////////////////////////////// @@ -363,7 +362,7 @@ class IResearchView final std::shared_ptr _meta; // the shared view configuration (never null!!!) IResearchViewMetaState _metaState; // the per-instance configuration state mutable irs::async_utils::read_write_mutex _mutex; // for use with member maps/sets and '_metaState' - PersistedStore _storePersisted; + PersistedStore _storePersisted; // protected by _asyncSelf->mutex() std::mutex _readerLock; // prevents query cache double invalidation std::mutex _updateLinksLock; // prevents simultaneous 'updateLinks' FlushCallback _flushCallback; // responsible for flush callback unregistration @@ -376,4 +375,4 @@ class IResearchView final } // iresearch } // arangodb -#endif +#endif \ No newline at end of file diff --git a/arangod/IResearch/IResearchViewCoordinator.cpp b/arangod/IResearch/IResearchViewCoordinator.cpp index 30d1d7cf00..018905b376 100644 --- a/arangod/IResearch/IResearchViewCoordinator.cpp +++ b/arangod/IResearch/IResearchViewCoordinator.cpp @@ -98,7 +98,7 @@ struct IResearchViewCoordinator::ViewFactory: public arangodb::ViewFactory { arangodb::velocypack::Builder builder; builder.openObject(); - res = impl->toVelocyPack(builder, true, true); // include links so that Agency will always have a full definition + res = impl->properties(builder, true, true); // include links so that Agency will always have a full definition if (!res.ok()) { return res; @@ -327,10 +327,9 @@ bool IResearchViewCoordinator::visitCollections( return true; } -arangodb::Result IResearchViewCoordinator::updateProperties( +arangodb::Result IResearchViewCoordinator::properties( velocypack::Slice const& slice, - bool partialUpdate, - bool /*doSync*/ + bool partialUpdate ) { auto* engine = arangodb::ClusterInfo::instance(); @@ -394,7 +393,7 @@ arangodb::Result IResearchViewCoordinator::updateProperties( builder.openObject(); meta.json(builder); - auto result = toVelocyPack(builder, false, true); + auto result = properties(builder, false, true); if (!result.ok()) { return result; diff --git a/arangod/IResearch/IResearchViewCoordinator.h b/arangod/IResearch/IResearchViewCoordinator.h index 5533b9ae60..adbcb24e81 100644 --- a/arangod/IResearch/IResearchViewCoordinator.h +++ b/arangod/IResearch/IResearchViewCoordinator.h @@ -76,18 +76,19 @@ class IResearchViewCoordinator final : public arangodb::LogicalViewClusterInfo { ////////////////////////////////////////////////////////////////////////////// static arangodb::ViewFactory const& factory(); - bool visitCollections(CollectionVisitor const& visitor) const override; - void open() override { // NOOP } - virtual arangodb::Result updateProperties( + using LogicalDataSource::properties; + virtual arangodb::Result properties( velocypack::Slice const& properties, - bool partialUpdate, - bool doSync + bool partialUpdate ) override; + bool visitCollections(CollectionVisitor const& visitor) const override; + + protected: virtual Result appendVelocyPackDetailed( arangodb::velocypack::Builder& builder, diff --git a/arangod/IResearch/IResearchViewDBServer.cpp b/arangod/IResearch/IResearchViewDBServer.cpp index 8f7844c56c..4fb52eb102 100644 --- a/arangod/IResearch/IResearchViewDBServer.cpp +++ b/arangod/IResearch/IResearchViewDBServer.cpp @@ -212,7 +212,7 @@ struct IResearchViewDBServer::ViewFactory: public arangodb::ViewFactory { arangodb::velocypack::Builder builder; builder.openObject(); - res = impl->toVelocyPack(builder, true, true); // include links so that Agency will always have a full definition + res = impl->properties(builder, true, true); // include links so that Agency will always have a full definition if (!res.ok()) { return res; @@ -735,10 +735,9 @@ PrimaryKeyIndexReader* IResearchViewDBServer::snapshot( return reader; } -arangodb::Result IResearchViewDBServer::updateProperties( +arangodb::Result IResearchViewDBServer::properties( arangodb::velocypack::Slice const& slice, - bool partialUpdate, - bool doSync + bool partialUpdate ) { if (!slice.isObject()) { return arangodb::Result( diff --git a/arangod/IResearch/IResearchViewDBServer.h b/arangod/IResearch/IResearchViewDBServer.h index 3a66f57932..1c2ae4c4c9 100644 --- a/arangod/IResearch/IResearchViewDBServer.h +++ b/arangod/IResearch/IResearchViewDBServer.h @@ -83,6 +83,11 @@ class IResearchViewDBServer final: public arangodb::LogicalViewClusterInfo { virtual void open() override; + virtual arangodb::Result properties( + arangodb::velocypack::Slice const& properties, + bool partialUpdate + ) override; + //////////////////////////////////////////////////////////////////////////////// /// @return pointer to an index reader containing the datastore record snapshot /// associated with 'state' @@ -95,11 +100,6 @@ class IResearchViewDBServer final: public arangodb::LogicalViewClusterInfo { IResearchView::Snapshot mode = IResearchView::Snapshot::Find ) const; - virtual arangodb::Result updateProperties( - arangodb::velocypack::Slice const& properties, - bool partialUpdate, - bool doSync - ) override; virtual bool visitCollections( CollectionVisitor const& visitor ) const override; diff --git a/arangod/MMFiles/MMFilesCollection.cpp b/arangod/MMFiles/MMFilesCollection.cpp index edeb077c59..e7cb2d96b1 100644 --- a/arangod/MMFiles/MMFilesCollection.cpp +++ b/arangod/MMFiles/MMFilesCollection.cpp @@ -2154,15 +2154,11 @@ std::shared_ptr MMFilesCollection::createIndex(transaction::Methods* trx, addIndexLocal(idx); { - bool const doSync = - application_features::ApplicationServer::getFeature( - "Database") - ->forceSyncProperties(); auto builder = _logicalCollection.toVelocyPackIgnore( {"path", "statusString"}, true, true ); - _logicalCollection.updateProperties(builder.slice(), doSync); + _logicalCollection.properties(builder.slice(), false); // always a full-update } created = true; @@ -2353,15 +2349,11 @@ bool MMFilesCollection::dropIndex(TRI_idx_iid_t iid) { engine->dropIndex(&vocbase, cid, iid); { - bool const doSync = - application_features::ApplicationServer::getFeature( - "Database") - ->forceSyncProperties(); auto builder = _logicalCollection.toVelocyPackIgnore( {"path", "statusString"}, true, true ); - _logicalCollection.updateProperties(builder.slice(), doSync); + _logicalCollection.properties(builder.slice(), false); // always a full-update } if (!engine->inRecovery()) { diff --git a/arangod/MMFiles/MMFilesEngine.cpp b/arangod/MMFiles/MMFilesEngine.cpp index 26410494e8..d55e481f40 100644 --- a/arangod/MMFiles/MMFilesEngine.cpp +++ b/arangod/MMFiles/MMFilesEngine.cpp @@ -1356,14 +1356,16 @@ Result MMFilesEngine::createView( } VPackBuilder builder; + builder.openObject(); - view.toVelocyPack(builder, true, true); + view.properties(builder, true, true); builder.close(); TRI_ASSERT(id != 0); TRI_UpdateTickServer(static_cast(id)); res = TRI_ERROR_NO_ERROR; + try { MMFilesViewMarker marker(TRI_DF_MARKER_VPACK_CREATE_VIEW, vocbase.id(), view.id(), builder.slice()); @@ -1463,10 +1465,10 @@ void MMFilesEngine::saveViewInfo(TRI_vocbase_t* vocbase, arangodb::LogicalView const* view, bool forceSync) const { std::string const filename = viewParametersFilename(vocbase->id(), view->id()); - VPackBuilder builder; + builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); LOG_TOPIC(TRACE, Logger::VIEWS) @@ -1499,8 +1501,9 @@ Result MMFilesEngine::changeView( ) { if (!inRecovery()) { VPackBuilder infoBuilder; + infoBuilder.openObject(); - view.toVelocyPack(infoBuilder, true, true); + view.properties(infoBuilder, true, true); infoBuilder.close(); MMFilesViewMarker marker( diff --git a/arangod/MMFiles/MMFilesWalRecoverState.cpp b/arangod/MMFiles/MMFilesWalRecoverState.cpp index f352f69d02..2b4a7d49a6 100644 --- a/arangod/MMFiles/MMFilesWalRecoverState.cpp +++ b/arangod/MMFiles/MMFilesWalRecoverState.cpp @@ -772,12 +772,8 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker, return true; } - // turn off sync temporarily if the database or collection are going to - // be - // dropped later - bool const forceSync = state->willBeDropped(databaseId, collectionId); - arangodb::Result res = - collection->updateProperties(payloadSlice, forceSync); + auto res = collection->properties(payloadSlice, false); // always a full-update + if (!res.ok()) { LOG_TOPIC(WARN, arangodb::Logger::ENGINES) << "cannot change properties for collection " << collectionId @@ -795,16 +791,6 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker, TRI_voc_cid_t const viewId = MMFilesDatafileHelper::ViewId(marker); VPackSlice const payloadSlice(reinterpret_cast(marker) + MMFilesDatafileHelper::VPackOffset(type)); - auto* databaseFeature = application_features::ApplicationServer::lookupFeature< - DatabaseFeature - >("Database"); - - if (!databaseFeature) { - LOG_TOPIC(WARN, arangodb::Logger::ENGINES) - << "failed to find feature 'Database' while renaming view"; - ++state->errorCount; - return state->canContinue(); - } if (!payloadSlice.isObject()) { LOG_TOPIC(WARN, arangodb::Logger::ENGINES) @@ -842,10 +828,6 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker, return true; } - // turn off sync temporarily if the database or collection are going to - // be dropped later - bool const forceSync = state->willViewBeDropped(databaseId, viewId); - VPackSlice nameSlice = payloadSlice.get("name"); if (nameSlice.isString() && !nameSlice.isEqualString(view->name())) { @@ -863,9 +845,7 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker, vocbase->dropView(other->id(), true); } - auto res = view->rename( - std::string(name), databaseFeature->forceSyncProperties() - ); + auto res = view->rename(std::string(name)); if (!res.ok()) { LOG_TOPIC(WARN, arangodb::Logger::ENGINES) @@ -878,7 +858,8 @@ bool MMFilesWalRecoverState::ReplayMarker(MMFilesMarker const* marker, } } - auto res = view->updateProperties(payloadSlice, false, forceSync); + auto res = view->properties(payloadSlice, false); // always a full-update + if (!res.ok()) { LOG_TOPIC(WARN, arangodb::Logger::ENGINES) << "cannot change properties for view " << viewId diff --git a/arangod/Replication/DatabaseInitialSyncer.cpp b/arangod/Replication/DatabaseInitialSyncer.cpp index 19864e7449..4255ce0a68 100644 --- a/arangod/Replication/DatabaseInitialSyncer.cpp +++ b/arangod/Replication/DatabaseInitialSyncer.cpp @@ -1036,12 +1036,8 @@ Result DatabaseInitialSyncer::fetchCollectionSync( Result DatabaseInitialSyncer::changeCollection(arangodb::LogicalCollection* col, VPackSlice const& slice) { arangodb::CollectionGuard guard(&vocbase(), col->id()); - bool doSync = - application_features::ApplicationServer::getFeature( - "Database") - ->forceSyncProperties(); - return guard.collection()->updateProperties(slice, doSync); + return guard.collection()->properties(slice, false); // always a full-update } /// @brief determine the number of documents in a collection diff --git a/arangod/Replication/Syncer.cpp b/arangod/Replication/Syncer.cpp index 7063fc9e5a..d9089aa1bf 100644 --- a/arangod/Replication/Syncer.cpp +++ b/arangod/Replication/Syncer.cpp @@ -805,17 +805,6 @@ Result Syncer::dropIndex(arangodb::velocypack::Slice const& slice) { /// @brief creates a view, based on the VelocyPack provided Result Syncer::createView(TRI_vocbase_t& vocbase, arangodb::velocypack::Slice const& slice) { - auto* databaseFeature = application_features::ApplicationServer::lookupFeature< - DatabaseFeature - >("Database"); - - if (!databaseFeature) { - return Result( - TRI_ERROR_INTERNAL, - "failed to find feature 'Database' while creating view" - ); - } - if (!slice.isObject()) { return Result(TRI_ERROR_REPLICATION_INVALID_RESPONSE, "collection slice is no object"); @@ -848,29 +837,28 @@ Result Syncer::createView(TRI_vocbase_t& vocbase, VPackSlice nameSlice = slice.get(StaticStrings::DataSourceName); if (nameSlice.isString() && !nameSlice.isEqualString(view->name())) { - auto res = view->rename( - nameSlice.copyString(), databaseFeature->forceSyncProperties() - ); + auto res = view->rename(nameSlice.copyString()); if (!res.ok()) { return res; } } - bool doSync = DatabaseFeature::DATABASE->forceSyncProperties(); - - return view->updateProperties(slice, false, doSync); + return view->properties(slice, false); // always a full-update } view = vocbase.lookupView(nameSlice.copyString()); + if (view) { // resolve name conflict by deleting existing Result res = vocbase.dropView(view->id(), /*dropSytem*/false); + if (res.fail()) { return res; } } VPackBuilder s; + s.openObject(); s.add("id", VPackSlice::nullSlice()); s.close(); diff --git a/arangod/Replication/TailingSyncer.cpp b/arangod/Replication/TailingSyncer.cpp index 7d90b56d34..97e4e8e11b 100644 --- a/arangod/Replication/TailingSyncer.cpp +++ b/arangod/Replication/TailingSyncer.cpp @@ -691,9 +691,8 @@ Result TailingSyncer::changeCollection(VPackSlice const& slice) { } arangodb::CollectionGuard guard(vocbase, col); - bool doSync = DatabaseFeature::DATABASE->forceSyncProperties(); - return guard.collection()->updateProperties(data, doSync); + return guard.collection()->properties(data, false); // always a full-update } /// @brief truncate a collections. Assumes no trx are running @@ -740,17 +739,6 @@ Result TailingSyncer::truncateCollection(arangodb::velocypack::Slice const& slic /// @brief changes the properties of a view, /// based on the VelocyPack provided Result TailingSyncer::changeView(VPackSlice const& slice) { - auto* databaseFeature = application_features::ApplicationServer::lookupFeature< - DatabaseFeature - >("Database"); - - if (!databaseFeature) { - return Result( - TRI_ERROR_INTERNAL, - "failed to find feature 'Database' while changing view properties" - ); - } - if (!slice.isObject()) { return Result(TRI_ERROR_REPLICATION_INVALID_RESPONSE, "view marker slice is no object"); @@ -799,9 +787,7 @@ Result TailingSyncer::changeView(VPackSlice const& slice) { VPackSlice nameSlice = data.get(StaticStrings::DataSourceName); if (nameSlice.isString() && !nameSlice.isEqualString(view->name())) { - auto res = view->rename( - nameSlice.copyString(), databaseFeature->forceSyncProperties() - ); + auto res = view->rename(nameSlice.copyString()); if (!res.ok()) { return res; @@ -811,9 +797,7 @@ Result TailingSyncer::changeView(VPackSlice const& slice) { VPackSlice properties = data.get("properties"); if (properties.isObject()) { - bool doSync = DatabaseFeature::DATABASE->forceSyncProperties(); - - return view->updateProperties(properties, false, doSync); + return view->properties(properties, false); // always a full-update } return {}; diff --git a/arangod/RestHandler/RestCollectionHandler.cpp b/arangod/RestHandler/RestCollectionHandler.cpp index 8d3a945d68..e4133b6952 100644 --- a/arangod/RestHandler/RestCollectionHandler.cpp +++ b/arangod/RestHandler/RestCollectionHandler.cpp @@ -137,7 +137,7 @@ void RestCollectionHandler::handleCommandGet() { if (sub == "checksum") { // /_api/collection//checksum - if (!coll->isLocal()) { + if (ServerState::instance()->isCoordinator()) { THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED); } @@ -411,9 +411,9 @@ void RestCollectionHandler::handleCommandPut() { } if (res.ok()) { - if (!coll->isLocal()) { // ClusterInfo::loadPlan eventually updates status - coll->setStatus(TRI_vocbase_col_status_e::TRI_VOC_COL_STATUS_LOADED); - } + if (ServerState::instance()->isCoordinator()) { // ClusterInfo::loadPlan eventually updates status + coll->setStatus(TRI_vocbase_col_status_e::TRI_VOC_COL_STATUS_LOADED); + } collectionRepresentation( builder, @@ -424,14 +424,15 @@ void RestCollectionHandler::handleCommandPut() { /*detailedCount*/ true ); } - } else if (sub == "properties") { std::vector keep = {"doCompact", "journalSize", "waitForSync", "indexBuckets", "replicationFactor", "cacheEnabled"}; VPackBuilder props = VPackCollection::keep(body, keep); - res = methods::Collections::updateProperties(coll.get(), props.slice()); + res = methods::Collections::updateProperties( + *coll, props.slice(), false // always a full-update + ); if (res.ok()) { collectionRepresentation(builder, name, /*showProperties*/ true, @@ -454,7 +455,6 @@ void RestCollectionHandler::handleCommandPut() { /*showFigures*/ false, /*showCount*/ false, /*detailedCount*/ true); } - } else if (sub == "loadIndexesIntoMemory") { res = methods::Collections::warmup(_vocbase, *coll); diff --git a/arangod/RestHandler/RestReplicationHandler.cpp b/arangod/RestHandler/RestReplicationHandler.cpp index e1d484a5c0..32d1f49b4a 100644 --- a/arangod/RestHandler/RestReplicationHandler.cpp +++ b/arangod/RestHandler/RestReplicationHandler.cpp @@ -691,8 +691,6 @@ void RestReplicationHandler::handleCommandClusterInventory() { ClusterInfo* ci = ClusterInfo::instance(); std::vector> cols = ci->getCollections(dbName); - auto views = ci->getViews(dbName); // ci does not store links in the view objects - VPackBuilder resultBuilder; resultBuilder.openObject(); resultBuilder.add("collections", VPackValue(VPackValueType::Array)); @@ -720,12 +718,18 @@ void RestReplicationHandler::handleCommandClusterInventory() { } resultBuilder.close(); // collections resultBuilder.add("views", VPackValue(VPackValueType::Array)); - for (auto const& view : views) { - resultBuilder.openObject(); - view->toVelocyPack(resultBuilder, /*details*/true, /*forPersistence*/false); - resultBuilder.add(StaticStrings::DataSourceGuid, VPackValue(view->guid())); - resultBuilder.close(); - } + LogicalView::enumerate( + _vocbase, + [&resultBuilder](LogicalView::ptr const& view)->bool { + if (view) { + resultBuilder.openObject(); + view->properties(resultBuilder, true, false); // details, !forPersistence because on restore any datasource ids will differ, so need an end-user representation + resultBuilder.close(); + } + + return true; + } + ); resultBuilder.close(); // views TRI_voc_tick_t tick = TRI_CurrentTickServer(); diff --git a/arangod/RestHandler/RestViewHandler.cpp b/arangod/RestHandler/RestViewHandler.cpp index 511ead577a..aa1448731b 100644 --- a/arangod/RestHandler/RestViewHandler.cpp +++ b/arangod/RestHandler/RestViewHandler.cpp @@ -92,7 +92,7 @@ void RestViewHandler::getView(std::string const& nameOrId, bool detailed) { viewBuilder.openObject(); - auto res = view->toVelocyPack(viewBuilder, true, false); + auto res = view->properties(viewBuilder, true, false); if (!res.ok()) { generateError(res); @@ -109,7 +109,7 @@ void RestViewHandler::getView(std::string const& nameOrId, bool detailed) { builder.openObject(); - auto res = view->toVelocyPack(builder, detailed, false); + auto res = view->properties(builder, detailed, false); builder.close(); @@ -221,7 +221,7 @@ void RestViewHandler::createView() { velocypack::Builder builder; builder.openObject(); - res = view->toVelocyPack(builder, true, false); + res = view->properties(builder, true, false); if (!res.ok()) { generateError(res); @@ -273,19 +273,6 @@ void RestViewHandler::modifyView(bool partialUpdate) { // handle rename functionality if (suffixes[1] == "rename") { - auto* databaseFeature = application_features::ApplicationServer::lookupFeature< - DatabaseFeature - >("Database"); - - if (!databaseFeature) { - generateError(Result( - TRI_ERROR_INTERNAL, - "failed to find feature 'Database' while renaming view" - )); - - return; - } - VPackSlice newName = body.get("name"); if (!newName.isString()) { @@ -312,7 +299,7 @@ void RestViewHandler::modifyView(bool partialUpdate) { viewBuilder.openObject(); - auto res = view->toVelocyPack(viewBuilder, true, false); + auto res = view->properties(viewBuilder, true, false); if (!res.ok()) { generateError(res); @@ -325,9 +312,7 @@ void RestViewHandler::modifyView(bool partialUpdate) { return; // skip view } - auto res = view->rename( - newName.copyString(), databaseFeature->forceSyncProperties() - ); + auto res = view->rename(newName.copyString()); if (res.ok()) { getView(view->name(), false); @@ -355,7 +340,7 @@ void RestViewHandler::modifyView(bool partialUpdate) { builderCurrent.openObject(); - auto resCurrent = view->toVelocyPack(builderCurrent, true, false); + auto resCurrent = view->properties(builderCurrent, true, false); if (!resCurrent.ok()) { generateError(resCurrent); @@ -364,9 +349,7 @@ void RestViewHandler::modifyView(bool partialUpdate) { } } - auto const result = view->updateProperties( - body, partialUpdate, true - ); // TODO: not force sync? + auto result = view->properties(body, partialUpdate); if (!result.ok()) { generateError(result); @@ -386,7 +369,7 @@ void RestViewHandler::modifyView(bool partialUpdate) { updated.openObject(); - auto res = view->toVelocyPack(updated, true, false); + auto res = view->properties(updated, true, false); updated.close(); @@ -528,7 +511,7 @@ void RestViewHandler::getViews() { viewBuilder.openObject(); - if (!view->toVelocyPack(viewBuilder, true, false).ok()) { + if (!view->properties(viewBuilder, true, false).ok()) { continue; // skip view } } catch(...) { @@ -540,7 +523,7 @@ void RestViewHandler::getViews() { viewBuilder.openObject(); try { - auto res = view->toVelocyPack(viewBuilder, false, false); + auto res = view->properties(viewBuilder, false, false); if (!res.ok()) { generateError(res); diff --git a/arangod/RocksDBEngine/RocksDBEngine.cpp b/arangod/RocksDBEngine/RocksDBEngine.cpp index 265f9e3d6a..b16018aaf8 100644 --- a/arangod/RocksDBEngine/RocksDBEngine.cpp +++ b/arangod/RocksDBEngine/RocksDBEngine.cpp @@ -1408,17 +1408,22 @@ Result RocksDBEngine::createView( RocksDBLogValue logValue = RocksDBLogValue::ViewCreate(vocbase.id(), id); VPackBuilder props; + props.openObject(); - view.toVelocyPack(props, true, true); + view.properties(props, true, true); props.close(); + RocksDBValue const value = RocksDBValue::View(props.slice()); // Write marker + key into RocksDB inside one batch batch.PutLogData(logValue.slice()); batch.Put(RocksDBColumnFamily::definitions(), key.string(), value.string()); + auto res = _db->Write(wo, &batch); + LOG_TOPIC_IF(TRACE, Logger::VIEWS, !res.ok()) << "could not create view: " << res.ToString(); + return rocksutils::convertStatus(res); } @@ -1432,7 +1437,7 @@ arangodb::Result RocksDBEngine::dropView( VPackBuilder builder; builder.openObject(); - view.toVelocyPack(builder, true, true); + view.properties(builder, true, true); builder.close(); auto logValue = @@ -1478,11 +1483,13 @@ Result RocksDBEngine::changeView( } RocksDBKey key; + key.constructView(vocbase.id(), view.id()); VPackBuilder infoBuilder; + infoBuilder.openObject(); - view.toVelocyPack(infoBuilder, true, true); + view.properties(infoBuilder, true, true); infoBuilder.close(); RocksDBLogValue log = RocksDBLogValue::ViewChange(vocbase.id(), view.id()); @@ -1491,14 +1498,18 @@ Result RocksDBEngine::changeView( rocksdb::WriteBatch batch; rocksdb::WriteOptions wo; // TODO: check which options would make sense rocksdb::Status s; + s = batch.PutLogData(log.slice()); + if (!s.ok()) { LOG_TOPIC(TRACE, Logger::VIEWS) << "failed to write change view marker " << s.ToString(); return rocksutils::convertStatus(s); } + s = batch.Put(RocksDBColumnFamily::definitions(), key.string(), value.string()); + if (!s.ok()) { LOG_TOPIC(TRACE, Logger::VIEWS) << "failed to write change view marker " << s.ToString(); diff --git a/arangod/V8Server/v8-collection.cpp b/arangod/V8Server/v8-collection.cpp index dbbec2de77..b0ee2694d2 100644 --- a/arangod/V8Server/v8-collection.cpp +++ b/arangod/V8Server/v8-collection.cpp @@ -1123,6 +1123,7 @@ static void JS_PropertiesVocbaseCol( } bool const isModification = (args.Length() != 0); + if (isModification) { v8::Handle par = args[0]; @@ -1134,11 +1135,13 @@ static void JS_PropertiesVocbaseCol( TRI_V8_THROW_EXCEPTION(res); } } - + TRI_ASSERT(builder.isClosed()); - - Result res = methods::Collections::updateProperties(consoleColl, builder.slice()); - + + auto res = methods::Collections::updateProperties( + *consoleColl, builder.slice(), false // always a full-update + ); + if (res.fail() && ServerState::instance()->isCoordinator()) { TRI_V8_THROW_EXCEPTION(res); } @@ -1147,6 +1150,7 @@ static void JS_PropertiesVocbaseCol( // TODO API compatibility, for now we ignore if persisting fails... } } + // in the cluster the collection object might contain outdated // properties, which will break tests. We need an extra lookup VPackBuilder builder; diff --git a/arangod/V8Server/v8-views.cpp b/arangod/V8Server/v8-views.cpp index 3961d1ffaa..dbe8bf5b6e 100644 --- a/arangod/V8Server/v8-views.cpp +++ b/arangod/V8Server/v8-views.cpp @@ -381,7 +381,7 @@ static void JS_ViewVocbase(v8::FunctionCallbackInfo const& args) { viewBuilder.openObject(); - auto res = view->toVelocyPack(viewBuilder, true, false); + auto res = view->properties(viewBuilder, true, false); if (!res.ok()) { TRI_V8_THROW_EXCEPTION(res); // skip view @@ -453,7 +453,7 @@ static void JS_ViewsVocbase(v8::FunctionCallbackInfo const& args) { viewBuilder.openObject(); - if (!view->toVelocyPack(viewBuilder, true, false).ok()) { + if (!view->properties(viewBuilder, true, false).ok()) { continue; // skip view } } catch(...) { @@ -563,24 +563,20 @@ static void JS_PropertiesViewVocbase( builderCurrent.openObject(); - auto resCurrent = viewPtr->toVelocyPack(builderCurrent, true, false); + auto resCurrent = viewPtr->properties(builderCurrent, true, false); if (!resCurrent.ok()) { TRI_V8_THROW_EXCEPTION(resCurrent); } } - auto doSync = arangodb::application_features::ApplicationServer::getFeature< - DatabaseFeature - >("Database")->forceSyncProperties(); - auto view = resolver.getView(viewPtr->id()); // ensure have the latest definition if (!view) { TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND); } - auto res = view->updateProperties(builder.slice(), partialUpdate, doSync); + auto res = view->properties(builder.slice(), partialUpdate); if (!res.ok()) { TRI_V8_THROW_EXCEPTION_MESSAGE(res.errorNumber(), res.errorMessage()); @@ -606,7 +602,7 @@ static void JS_PropertiesViewVocbase( builder.openObject(); - auto res = view->toVelocyPack(builder, true, false); + auto res = view->properties(builder, true, false); builder.close(); @@ -629,16 +625,6 @@ static void JS_RenameViewVocbase( TRI_V8_TRY_CATCH_BEGIN(isolate); v8::HandleScope scope(isolate); - auto* databaseFeature = application_features::ApplicationServer::lookupFeature< - DatabaseFeature - >("Database"); - - if (!databaseFeature) { - TRI_V8_THROW_EXCEPTION_INTERNAL( - "failed to find feature 'Database' while renaming view" - ); - } - if (args.Length() < 1) { TRI_V8_THROW_EXCEPTION_USAGE("rename()"); } @@ -672,7 +658,7 @@ static void JS_RenameViewVocbase( viewBuilder.openObject(); - auto res = view->toVelocyPack(viewBuilder, true, false); + auto res = view->properties(viewBuilder, true, false); if (!res.ok()) { TRI_V8_THROW_EXCEPTION(res); // skip view @@ -681,8 +667,7 @@ static void JS_RenameViewVocbase( TRI_V8_THROW_EXCEPTION(TRI_ERROR_INTERNAL); // skip view } - auto res = - view->rename(std::string(name), databaseFeature->forceSyncProperties()); + auto res = view->rename(std::string(name)); if (!res.ok()) { TRI_V8_THROW_EXCEPTION(res); diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 73b8a12118..dc30676e08 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -1358,7 +1358,7 @@ static void MapGetVocBase(v8::Local const name, // check if the collection is still alive if (status != TRI_VOC_COL_STATUS_DELETED && cid > 0 - && collection->isLocal()) { + && !ServerState::instance()->isCoordinator()) { TRI_GET_GLOBAL_STRING(_IdKey); TRI_GET_GLOBAL_STRING(VersionKeyHidden); if (value->Has(_IdKey)) { diff --git a/arangod/VocBase/LogicalCollection.cpp b/arangod/VocBase/LogicalCollection.cpp index 2edf1d8188..17addb0027 100644 --- a/arangod/VocBase/LogicalCollection.cpp +++ b/arangod/VocBase/LogicalCollection.cpp @@ -173,9 +173,7 @@ LogicalCollection::LogicalCollection( info, "status", TRI_VOC_COL_STATUS_CORRUPTED)), _isAStub(isAStub), _isSmart(Helper::readBooleanValue(info, StaticStrings::IsSmart, false)), - _isLocal(!ServerState::instance()->isCoordinator()), _waitForSync(Helper::readBooleanValue(info, StaticStrings::WaitForSyncString, false)), - _allowUserKeys(Helper::readBooleanValue(info, "allowUserKeys", true)), _keyOptions(nullptr), _keyGenerator(), @@ -228,7 +226,7 @@ LogicalCollection::LogicalCollection( return category; } - + LogicalCollection::~LogicalCollection() {} // SECTION: sharding @@ -409,8 +407,6 @@ TRI_voc_rid_t LogicalCollection::revision(transaction::Methods* trx) const { return _physical->revision(trx); } -bool LogicalCollection::isLocal() const { return _isLocal; } - bool LogicalCollection::waitForSync() const { return _waitForSync; } bool LogicalCollection::isSmart() const { return _isSmart; } @@ -418,7 +414,7 @@ bool LogicalCollection::isSmart() const { return _isSmart; } std::unique_ptr const& LogicalCollection::followers() const { return _followers; } - + std::unordered_map LogicalCollection::clusterIndexEstimates(bool allowUpdate) { return getPhysical()->clusterIndexEstimates(allowUpdate); } @@ -456,10 +452,20 @@ bool LogicalCollection::allowUserKeys() const { return _allowUserKeys; } // not fail. the WAL entry for the rename will be written *after* the call // to "renameCollection" returns -Result LogicalCollection::rename(std::string&& newName, bool doSync) { +Result LogicalCollection::rename(std::string&& newName) { // Should only be called from inside vocbase. // Otherwise caching is destroyed. TRI_ASSERT(!ServerState::instance()->isCoordinator()); // NOT YET IMPLEMENTED + auto* databaseFeature = application_features::ApplicationServer::lookupFeature< + DatabaseFeature + >("Database"); + + if (!databaseFeature) { + return Result( + TRI_ERROR_INTERNAL, + "failed to find feature 'Database' while renaming collection" + ); + } // Check for illegal states. switch (_status) { @@ -484,6 +490,7 @@ Result LogicalCollection::rename(std::string&& newName, bool doSync) { return TRI_ERROR_INTERNAL; } + auto doSync = databaseFeature->forceSyncProperties(); std::string oldName = name(); // Okay we can finally rename safely @@ -616,7 +623,6 @@ arangodb::Result LogicalCollection::appendVelocyPack( // with 'forPersistence' added by LogicalDataSource::toVelocyPack // FIXME TODO is this needed in !forPersistence??? result.add(StaticStrings::DataSourceDeleted, VPackValue(deleted())); - result.add(StaticStrings::DataSourceGuid, VPackValue(guid())); result.add(StaticStrings::DataSourceSystem, VPackValue(system())); } @@ -628,11 +634,10 @@ arangodb::Result LogicalCollection::appendVelocyPack( if (_keyGenerator != nullptr) { result.openObject(); _keyGenerator->toVelocyPack(result); - result.close(); } else { result.openArray(); - result.close(); } + result.close(); // Physical Information getPhysical()->getPropertiesVPack(result); @@ -677,7 +682,7 @@ VPackBuilder LogicalCollection::toVelocyPackIgnore( bool forPersistence) const { VPackBuilder full; full.openObject(); - toVelocyPack(full, translateCids, forPersistence); + properties(full, translateCids, forPersistence); full.close(); return VPackCollection::remove(full.slice(), ignoreKeys); } @@ -688,8 +693,10 @@ void LogicalCollection::includeVelocyPackEnterprise(VPackBuilder&) const { void LogicalCollection::increaseInternalVersion() { ++_internalVersion; } -arangodb::Result LogicalCollection::updateProperties(VPackSlice const& slice, - bool doSync) { +arangodb::Result LogicalCollection::properties( + velocypack::Slice const& slice, + bool partialUpdate +) { // the following collection properties are intentionally not updated, // as updating them would be very complicated: // - _cid @@ -699,6 +706,26 @@ arangodb::Result LogicalCollection::updateProperties(VPackSlice const& slice, // - _isVolatile // ... probably a few others missing here ... + auto* databaseFeature = application_features::ApplicationServer::lookupFeature< + DatabaseFeature + >("Database"); + + if (!databaseFeature) { + return Result( + TRI_ERROR_INTERNAL, + "failed to find feature 'Database' while updating collection" + ); + } + + auto* engine = EngineSelectorFeature::ENGINE; + + if (!engine) { + return Result( + TRI_ERROR_INTERNAL, + "failed to find a storage engine while updating collection" + ); + } + MUTEX_LOCKER(guard, _infoLock); // prevent simultanious updates size_t rf = _sharding->replicationFactor(); @@ -716,7 +743,8 @@ arangodb::Result LogicalCollection::updateProperties(VPackSlice const& slice, return Result(TRI_ERROR_BAD_PARAMETER, "bad value for replicationFactor"); } - if (!_isLocal && rf != _sharding->replicationFactor()) { // sanity checks + if (ServerState::instance()->isCoordinator() + && rf != _sharding->replicationFactor()) { // sanity checks if (!_sharding->distributeShardsLike().empty()) { return Result(TRI_ERROR_FORBIDDEN, "Cannot change replicationFactor, " "please change " + _sharding->distributeShardsLike()); @@ -750,6 +778,8 @@ arangodb::Result LogicalCollection::updateProperties(VPackSlice const& slice, } } + auto doSync = !engine->inRecovery() && databaseFeature->forceSyncProperties(); + // The physical may first reject illegal properties. // After this call it either has thrown or the properties are stored Result res = getPhysical()->updateProperties(slice, doSync); @@ -761,15 +791,13 @@ arangodb::Result LogicalCollection::updateProperties(VPackSlice const& slice, _waitForSync = Helper::getBooleanValue(slice, "waitForSync", _waitForSync); _sharding->replicationFactor(rf); - if (!_isLocal) { + if (ServerState::instance()->isCoordinator()) { // We need to inform the cluster as well return ClusterInfo::instance()->setCollectionPropertiesCoordinator( vocbase().name(), std::to_string(id()), this ); } - StorageEngine* engine = EngineSelectorFeature::ENGINE; - engine->changeCollection(vocbase(), id(), *this, doSync); if (DatabaseFeature::DATABASE != nullptr && @@ -920,7 +948,7 @@ Result LogicalCollection::update(transaction::Methods* trx, TRI_IF_FAILURE("LogicalCollection::update") { return Result(TRI_ERROR_DEBUG); } - + resultMarkerTick = 0; if (!newSlice.isObject()) { return Result(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); @@ -1069,4 +1097,3 @@ ChecksumResult LogicalCollection::checksum(bool withRevisions, bool withData) co return ChecksumResult(std::move(b)); } - diff --git a/arangod/VocBase/LogicalCollection.h b/arangod/VocBase/LogicalCollection.h index 5e72a5e2ed..b64b5780b5 100644 --- a/arangod/VocBase/LogicalCollection.h +++ b/arangod/VocBase/LogicalCollection.h @@ -141,7 +141,6 @@ class LogicalCollection : public LogicalDataSource { // SECTION: Properties TRI_voc_rid_t revision(transaction::Methods*) const; - bool isLocal() const; bool waitForSync() const; bool isSmart() const; bool isAStub() const { return _isAStub; } @@ -216,7 +215,7 @@ class LogicalCollection : public LogicalDataSource { void unload(); virtual arangodb::Result drop() override; - virtual Result rename(std::string&& name, bool doSync) override; + virtual Result rename(std::string&& name) override; virtual void setStatus(TRI_vocbase_col_status_e); // SECTION: Serialization @@ -234,7 +233,11 @@ class LogicalCollection : public LogicalDataSource { bool allInSync) const; // Update this collection. - virtual arangodb::Result updateProperties(velocypack::Slice const&, bool); + using LogicalDataSource::properties; + virtual arangodb::Result properties( + velocypack::Slice const& slice, + bool partialUpdate + ) override; /// @brief return the figures for a collection virtual std::shared_ptr figures() const; @@ -375,8 +378,6 @@ class LogicalCollection : public LogicalDataSource { bool _isSmart; // SECTION: Properties - bool _isLocal; - bool _waitForSync; bool const _allowUserKeys; @@ -402,4 +403,4 @@ class LogicalCollection : public LogicalDataSource { } // namespace arangodb -#endif +#endif \ No newline at end of file diff --git a/arangod/VocBase/LogicalDataSource.cpp b/arangod/VocBase/LogicalDataSource.cpp index ab7faf0d23..35fe936fe6 100644 --- a/arangod/VocBase/LogicalDataSource.cpp +++ b/arangod/VocBase/LogicalDataSource.cpp @@ -209,7 +209,7 @@ LogicalDataSource::LogicalDataSource( TRI_ASSERT(!_guid.empty()); } -Result LogicalDataSource::toVelocyPack( +Result LogicalDataSource::properties( velocypack::Builder& builder, bool detailed, bool forPersistence @@ -221,6 +221,7 @@ Result LogicalDataSource::toVelocyPack( ); } + builder.add(StaticStrings::DataSourceGuid, toValuePair(guid())); // required for dump/restore builder.add( StaticStrings::DataSourceId, velocypack::Value(std::to_string(id())) @@ -232,7 +233,6 @@ Result LogicalDataSource::toVelocyPack( // includeSystem if we are persisting the properties if (forPersistence) { builder.add(StaticStrings::DataSourceDeleted, velocypack::Value(deleted())); - builder.add(StaticStrings::DataSourceGuid, toValuePair(guid())); builder.add(StaticStrings::DataSourceSystem, velocypack::Value(system())); // FIXME not sure if the following is relevant @@ -250,4 +250,4 @@ Result LogicalDataSource::toVelocyPack( // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- \ No newline at end of file diff --git a/arangod/VocBase/LogicalDataSource.h b/arangod/VocBase/LogicalDataSource.h index b3d1486d9e..0aab830632 100644 --- a/arangod/VocBase/LogicalDataSource.h +++ b/arangod/VocBase/LogicalDataSource.h @@ -139,9 +139,7 @@ class LogicalDataSource { std::string const& name() const noexcept { return _name; } TRI_voc_cid_t planId() const noexcept { return _planId; } uint64_t planVersion() const noexcept { return _planVersion; } - virtual Result rename(std::string&& newName, bool doSync) = 0; - bool system() const noexcept { return _system; } - + ////////////////////////////////////////////////////////////////////////////// /// @brief append a jSON definition of the data-source to the 'builder' /// @param the buffer to append to, must be an open object @@ -151,12 +149,24 @@ class LogicalDataSource { /// @param forPersistence this definition is meant to be persisted /// @return success ////////////////////////////////////////////////////////////////////////////// - Result toVelocyPack( + Result properties( velocypack::Builder& builder, bool detailed, bool forPersistence - ) const /*final*/; + ) const; + ////////////////////////////////////////////////////////////////////////////// + /// @brief updates properties of an existing DataSource + /// @param definition the properties being updated + /// @param partialUpdate modify only the specified properties (false == all) + ////////////////////////////////////////////////////////////////////////////// + virtual Result properties( + velocypack::Slice const& definition, + bool partialUpdate + ) = 0; + + virtual Result rename(std::string&& newName) = 0; + bool system() const noexcept { return _system; } Type const& type() const noexcept { return _type; } TRI_vocbase_t& vocbase() const noexcept { return _vocbase; } diff --git a/arangod/VocBase/LogicalView.cpp b/arangod/VocBase/LogicalView.cpp index 0a2117a0d8..0f8fa4d31d 100644 --- a/arangod/VocBase/LogicalView.cpp +++ b/arangod/VocBase/LogicalView.cpp @@ -29,6 +29,7 @@ #include "Basics/VelocyPackHelper.h" #include "Cluster/ClusterInfo.h" #include "Cluster/ServerState.h" +#include "RestServer/DatabaseFeature.h" #include "RestServer/ViewTypesFeature.h" #include "StorageEngine/EngineSelectorFeature.h" #include "StorageEngine/StorageEngine.h" @@ -267,9 +268,9 @@ arangodb::Result LogicalViewClusterInfo::drop() { return arangodb::Result(); } -arangodb::Result LogicalViewClusterInfo::rename(std::string&&, bool) { +arangodb::Result LogicalViewClusterInfo::rename(std::string&&) { // renaming a view in a cluster is unsupported - return TRI_ERROR_NOT_IMPLEMENTED; + return TRI_ERROR_CLUSTER_UNSUPPORTED; } // ----------------------------------------------------------------------------- @@ -376,10 +377,29 @@ arangodb::Result LogicalViewStorageEngine::drop() { return arangodb::Result(); } -Result LogicalViewStorageEngine::rename(std::string&& newName, bool doSync) { +Result LogicalViewStorageEngine::rename(std::string&& newName) { TRI_ASSERT(!ServerState::instance()->isCoordinator()); + auto* databaseFeature = application_features::ApplicationServer::lookupFeature< + DatabaseFeature + >("Database"); + + if (!databaseFeature) { + return Result( + TRI_ERROR_INTERNAL, + "failed to find feature 'Database' while renaming view" + ); + } + StorageEngine* engine = EngineSelectorFeature::ENGINE; - TRI_ASSERT(engine); + + if (!engine) { + return Result( + TRI_ERROR_INTERNAL, + "failed to find a storage engine while renaming view" + ); + } + + auto doSync = databaseFeature->forceSyncProperties(); auto oldName = name(); auto res = vocbase().renameView(id(), newName); @@ -414,13 +434,32 @@ Result LogicalViewStorageEngine::rename(std::string&& newName, bool doSync) { return TRI_ERROR_NO_ERROR; } -arangodb::Result LogicalViewStorageEngine::updateProperties( +arangodb::Result LogicalViewStorageEngine::properties( VPackSlice const& slice, - bool partialUpdate, - bool doSync + bool partialUpdate ) { TRI_ASSERT(!ServerState::instance()->isCoordinator()); + auto* databaseFeature = application_features::ApplicationServer::lookupFeature< + DatabaseFeature + >("Database"); + + if (!databaseFeature) { + return Result( + TRI_ERROR_INTERNAL, + "failed to find feature 'Database' while updating collection" + ); + } + + auto* engine = EngineSelectorFeature::ENGINE; + + if (!engine) { + return Result( + TRI_ERROR_INTERNAL, + "failed to find a storage engine while updating collection" + ); + } + auto res = updateProperties(slice, partialUpdate); if (!res.ok()) { @@ -431,10 +470,9 @@ arangodb::Result LogicalViewStorageEngine::updateProperties( LOG_TOPIC(DEBUG, Logger::VIEWS) << "updated view with properties '" << slice.toJson() << "'"; - // after this call the properties are stored - StorageEngine* engine = EngineSelectorFeature::ENGINE; - TRI_ASSERT(engine); + auto doSync = !engine->inRecovery() && databaseFeature->forceSyncProperties(); + // after this call the properties are stored if (engine->inRecovery()) { return arangodb::Result(); // do not modify engine while in recovery } diff --git a/arangod/VocBase/LogicalView.h b/arangod/VocBase/LogicalView.h index 2e59923ad8..2b0fbd0595 100644 --- a/arangod/VocBase/LogicalView.h +++ b/arangod/VocBase/LogicalView.h @@ -150,6 +150,15 @@ class LogicalView : public LogicalDataSource { uint64_t planVersion = 0 // '0' by default for non-cluster ); + ////////////////////////////////////////////////////////////////////////////// + /// @brief updates properties of an existing view + ////////////////////////////////////////////////////////////////////////////// + using LogicalDataSource::properties; + virtual arangodb::Result properties( + velocypack::Slice const& properties, + bool partialUpdate + ) override = 0; + ////////////////////////////////////////////////////////////////////////////// /// @brief opens an existing view when the server is restarted ////////////////////////////////////////////////////////////////////////////// @@ -163,19 +172,7 @@ class LogicalView : public LogicalDataSource { ////////////////////////////////////////////////////////////////////////////// /// @brief renames an existing view ////////////////////////////////////////////////////////////////////////////// - virtual Result rename( - std::string&& newName, - bool doSync - ) override = 0; - - ////////////////////////////////////////////////////////////////////////////// - /// @brief updates properties of an existing view - ////////////////////////////////////////////////////////////////////////////// - virtual arangodb::Result updateProperties( - velocypack::Slice const& properties, - bool partialUpdate, - bool doSync - ) = 0; + virtual Result rename(std::string&& newName) override = 0; ////////////////////////////////////////////////////////////////////////////// /// @brief invoke visitor on all collections that a view will return @@ -204,7 +201,7 @@ class LogicalView : public LogicalDataSource { class LogicalViewClusterInfo: public LogicalView { public: virtual Result drop() override final; - virtual Result rename(std::string&& newName, bool doSync) override final; + virtual Result rename(std::string&& newName) override final; protected: LogicalViewClusterInfo( @@ -242,14 +239,15 @@ class LogicalViewStorageEngine: public LogicalView { ~LogicalViewStorageEngine() override; virtual Result drop() override final; - virtual Result rename(std::string&& newName, bool doSync) override final; - arangodb::Result updateProperties( + using LogicalDataSource::properties; + virtual arangodb::Result properties( velocypack::Slice const& properties, - bool partialUpdate, - bool doSync + bool partialUpdate ) override final; + virtual Result rename(std::string&& newName) override final; + protected: LogicalViewStorageEngine( TRI_vocbase_t& vocbase, diff --git a/arangod/VocBase/Methods/Collections.cpp b/arangod/VocBase/Methods/Collections.cpp index f6a74343a7..41d63eba78 100644 --- a/arangod/VocBase/Methods/Collections.cpp +++ b/arangod/VocBase/Methods/Collections.cpp @@ -382,11 +382,16 @@ Result Collections::properties(Context& ctxt, VPackBuilder& builder) { return TRI_ERROR_NO_ERROR; } -Result Collections::updateProperties(LogicalCollection* coll, - VPackSlice const& props) { +Result Collections::updateProperties( + LogicalCollection& collection, + velocypack::Slice const& props, + bool partialUpdate +) { ExecContext const* exec = ExecContext::CURRENT; + if (exec != nullptr) { - bool canModify = exec->canUseCollection(coll->name(), auth::Level::RW); + bool canModify = exec->canUseCollection(collection.name(), auth::Level::RW); + if ((exec->databaseAuthLevel() != auth::Level::RW || !canModify)) { return TRI_ERROR_FORBIDDEN; } @@ -394,17 +399,17 @@ Result Collections::updateProperties(LogicalCollection* coll, if (ServerState::instance()->isCoordinator()) { ClusterInfo* ci = ClusterInfo::instance(); + auto info = ci->getCollection( + collection.vocbase().name(), std::to_string(collection.id()) + ); - TRI_ASSERT(coll); - - auto info = - ci->getCollection(coll->vocbase().name(), std::to_string(coll->id())); - - return info->updateProperties(props, false); + return info->properties(props, partialUpdate); } else { auto ctx = - transaction::V8Context::CreateWhenRequired(coll->vocbase(), false); - SingleCollectionTransaction trx(ctx, *coll, AccessMode::Type::EXCLUSIVE); + transaction::V8Context::CreateWhenRequired(collection.vocbase(), false); + SingleCollectionTransaction trx( + ctx, collection, AccessMode::Type::EXCLUSIVE + ); Result res = trx.begin(); if (!res.ok()) { @@ -412,15 +417,15 @@ Result Collections::updateProperties(LogicalCollection* coll, } // try to write new parameter to file - bool doSync = DatabaseFeature::DATABASE->forceSyncProperties(); - arangodb::Result updateRes = coll->updateProperties(props, doSync); + auto updateRes = collection.properties(props, partialUpdate); if (!updateRes.ok()) { return updateRes; } - auto physical = coll->getPhysical(); + auto physical = collection.getPhysical(); TRI_ASSERT(physical != nullptr); + return physical->persistProperties(); } } @@ -628,7 +633,7 @@ Result Collections::revisionId(Context& ctxt, TRI_voc_rid_t& rid) { arangodb::aql::Query query(false, vocbase, aql::QueryString(q), binds, std::make_shared(), arangodb::aql::PART_MAIN); - auto queryRegistry = QueryRegistryFeature::registry();; + auto queryRegistry = QueryRegistryFeature::registry(); TRI_ASSERT(queryRegistry != nullptr); aql::QueryResult queryResult = query.executeSync(queryRegistry); diff --git a/arangod/VocBase/Methods/Collections.h b/arangod/VocBase/Methods/Collections.h index 1a8240e67e..20e81541e4 100644 --- a/arangod/VocBase/Methods/Collections.h +++ b/arangod/VocBase/Methods/Collections.h @@ -85,8 +85,11 @@ struct Collections { static Result unload(TRI_vocbase_t* vocbase, LogicalCollection* coll); static Result properties(Context& ctxt, velocypack::Builder&); - static Result updateProperties(LogicalCollection* coll, - velocypack::Slice const&); + static Result updateProperties( + LogicalCollection& collection, + velocypack::Slice const& props, + bool partialUpdate + ); static Result rename(LogicalCollection* coll, std::string const& newName, bool doOverride); diff --git a/arangod/VocBase/vocbase.cpp b/arangod/VocBase/vocbase.cpp index e13145850e..25cb03f4b1 100644 --- a/arangod/VocBase/vocbase.cpp +++ b/arangod/VocBase/vocbase.cpp @@ -811,16 +811,12 @@ int TRI_vocbase_t::dropCollectionWorker(arangodb::LogicalCollection* collection, collection->deleted(true); StorageEngine* engine = EngineSelectorFeature::ENGINE; - bool doSync = - !engine->inRecovery() && - application_features::ApplicationServer::getFeature( - "Database") - ->forceSyncProperties(); - VPackBuilder builder; + engine->getCollectionInfo(*this, collection->id(), builder, false, 0); - arangodb::Result res = collection->updateProperties( - builder.slice().get("parameters"), doSync); + + auto res = + collection->properties(builder.slice().get("parameters"), false); // always a full-update if (!res.ok()) { return res.errorNumber(); @@ -1032,25 +1028,18 @@ void TRI_vocbase_t::inventory( result.close(); // result.add("views", VPackValue(VPackValueType::Array, true)); - if (ServerState::instance()->isCoordinator()) { - auto views = ClusterInfo::instance()->getViews(name()); - for (auto const& view : views) { - result.openObject(); - view->toVelocyPack(result, /*details*/true, /*forPersistence*/false); - result.close(); - } - } else { - for (auto const& dataSource : dataSourceById) { - if (dataSource.second->category() != LogicalView::category()) { - continue; + LogicalView::enumerate( + *this, + [&result](LogicalView::ptr const& view)->bool { + if (view) { + result.openObject(); + view->properties(result, true, false); // details, !forPersistence because on restore any datasource ids will differ, so need an end-user representation + result.close(); + } + + return true; } - LogicalView const* view = static_cast(dataSource.second.get()); - result.openObject(); - view->toVelocyPack(result, /*details*/true, /*forPersistence*/false); - result.add(StaticStrings::DataSourceGuid, VPackValue(view->guid())); - result.close(); - } - } + ); result.close(); // } @@ -1519,11 +1508,7 @@ arangodb::Result TRI_vocbase_t::renameCollection( TRI_ASSERT(std::dynamic_pointer_cast(itr1->second)); - auto* databaseFeature = - application_features::ApplicationServer::getFeature("Database"); - TRI_ASSERT(databaseFeature); - auto doSync = databaseFeature->forceSyncProperties(); - auto res = itr1->second->rename(std::string(newName), doSync); + auto res = itr1->second->rename(std::string(newName)); if (!res.ok()) { return res.errorNumber(); // rename failed diff --git a/js/client/modules/@arangodb/arango-view.js b/js/client/modules/@arangodb/arango-view.js index 6353b3b1dd..431f8fcbc8 100644 --- a/js/client/modules/@arangodb/arango-view.js +++ b/js/client/modules/@arangodb/arango-view.js @@ -210,6 +210,7 @@ ArangoView.prototype.properties = function (properties, partialUpdate) { const mask = { 'code': true, + 'globallyUniqueId': true, 'id': true, 'name': true, 'type': true, diff --git a/lib/V8/v8-globals.h b/lib/V8/v8-globals.h index afc8edcb57..41e6047c07 100644 --- a/lib/V8/v8-globals.h +++ b/lib/V8/v8-globals.h @@ -229,7 +229,7 @@ static inline v8::Handle v8Utf8StringFactory(v8::Isolate* isolate, v /// @brief "not yet implemented" handler for sharding #define TRI_THROW_SHARDING_COLLECTION_NOT_YET_IMPLEMENTED(collection) \ - if (collection != nullptr && !collection->isLocal()) { \ + if (collection && ServerState::instance()->isCoordinator()) { \ TRI_V8_THROW_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED); \ } @@ -746,4 +746,4 @@ void TRI_AddGlobalVariableVocbase(v8::Isolate* isolate, v8::Handle name, v8::Handle value); -#endif +#endif \ No newline at end of file diff --git a/tests/IResearch/IResearchIndex-test.cpp b/tests/IResearch/IResearchIndex-test.cpp index ad253b463b..37d45aa909 100644 --- a/tests/IResearch/IResearchIndex-test.cpp +++ b/tests/IResearch/IResearchIndex-test.cpp @@ -39,6 +39,7 @@ #include "IResearch/IResearchFeature.h" #include "Logger/Logger.h" #include "RestServer/AqlFeature.h" +#include "RestServer/DatabaseFeature.h" #include "RestServer/DatabasePathFeature.h" #include "RestServer/QueryRegistryFeature.h" #include "RestServer/SystemDatabaseFeature.h" @@ -149,6 +150,7 @@ struct IResearchIndexSetup { // setup required application features features.emplace_back(new arangodb::AqlFeature(server), true); // required for arangodb::aql::Query(...) + features.emplace_back(new arangodb::DatabaseFeature(server), false); // required for LogicalViewStorageEngine::modify(...) features.emplace_back(new arangodb::DatabasePathFeature(server), false); // requires for IResearchView::open() features.emplace_back(new arangodb::ShardingFeature(server), false); features.emplace_back(new arangodb::ViewTypesFeature(server), true); // required by TRI_vocbase_t::createView(...) @@ -267,10 +269,10 @@ SECTION("test_analyzer") { } } \ } }"); - CHECK((viewImpl->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson->slice(), false).ok())); } - // docs match from both collections (2 analyzers used for collectio0, 1 analyzer used for collection 1) + // docs match from both collections (2 analyzers used for collection0, 1 analyzer used for collection 1) { auto result = arangodb::tests::executeQuery( vocbase, @@ -293,7 +295,7 @@ SECTION("test_analyzer") { CHECK((i == expected.size())); } - // docs match from both collections (2 analyzers used for collectio0, 1 analyzer used for collection 1) + // docs match from both collections (2 analyzers used for collection0, 1 analyzer used for collection 1) { auto result = arangodb::tests::executeQuery( vocbase, @@ -316,7 +318,7 @@ SECTION("test_analyzer") { CHECK((i == expected.size())); } - // docs match from both collections (2 analyzers used for collectio0, 1 analyzer used for collection 1) + // docs match from both collections (2 analyzers used for collection0, 1 analyzer used for collection 1) { auto result = arangodb::tests::executeQuery( vocbase, @@ -498,7 +500,7 @@ SECTION("test_async_index") { } } \ } }"); - CHECK((viewImpl->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson->slice(), false).ok())); } // `catch` doesn't support cuncurrent checks @@ -872,7 +874,7 @@ SECTION("test_fields") { } } \ } }"); - CHECK((viewImpl->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson->slice(), false).ok())); } // docs match from both collections diff --git a/tests/IResearch/IResearchQueryAggregate-test.cpp b/tests/IResearch/IResearchQueryAggregate-test.cpp index 6f0986039c..306b2604c1 100644 --- a/tests/IResearch/IResearchQueryAggregate-test.cpp +++ b/tests/IResearch/IResearchQueryAggregate-test.cpp @@ -262,7 +262,7 @@ TEST_CASE("IResearchQueryTestAggregate", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"includeAllFields\": true }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQueryAnd-test.cpp b/tests/IResearch/IResearchQueryAnd-test.cpp index f90bc7de5a..3a4340e6f5 100644 --- a/tests/IResearch/IResearchQueryAnd-test.cpp +++ b/tests/IResearch/IResearchQueryAnd-test.cpp @@ -262,7 +262,7 @@ TEST_CASE("IResearchQueryTestAnd", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"analyzers\": [ \"test_analyzer\", \"identity\" ], \"includeAllFields\": true, \"storeValues\":\"id\" }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQueryBooleanTerm-test.cpp b/tests/IResearch/IResearchQueryBooleanTerm-test.cpp index 824c5a1b8d..dff6331f26 100644 --- a/tests/IResearch/IResearchQueryBooleanTerm-test.cpp +++ b/tests/IResearch/IResearchQueryBooleanTerm-test.cpp @@ -270,7 +270,7 @@ TEST_CASE("IResearchQueryTestBooleanTerm", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"includeAllFields\": true }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQueryComplexBoolean-test.cpp b/tests/IResearch/IResearchQueryComplexBoolean-test.cpp index 7b0af11c02..6025dc0012 100644 --- a/tests/IResearch/IResearchQueryComplexBoolean-test.cpp +++ b/tests/IResearch/IResearchQueryComplexBoolean-test.cpp @@ -272,7 +272,7 @@ TEST_CASE("IResearchQueryTestComplexBoolean", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"includeAllFields\": true, \"analyzers\": [ \"test_analyzer\", \"identity\" ], \"storeValues\":\"id\" }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQueryExists-test.cpp b/tests/IResearch/IResearchQueryExists-test.cpp index 5a4f5ccb62..15b7151abe 100644 --- a/tests/IResearch/IResearchQueryExists-test.cpp +++ b/tests/IResearch/IResearchQueryExists-test.cpp @@ -264,7 +264,7 @@ TEST_CASE("IResearchQueryTestExists", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"includeAllFields\": true, \"storeValues\": \"id\" }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); @@ -1522,7 +1522,7 @@ TEST_CASE("IResearchQueryTestExistsStoreMaskPartially", "[iresearch][iresearch-q "\"testCollection1\": { \"includeAllFields\": true, \"storeValues\": \"id\" }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQueryIn-test.cpp b/tests/IResearch/IResearchQueryIn-test.cpp index face2af96a..55cf1dba26 100644 --- a/tests/IResearch/IResearchQueryIn-test.cpp +++ b/tests/IResearch/IResearchQueryIn-test.cpp @@ -98,6 +98,7 @@ struct IResearchQueryInSetup { // setup required application features features.emplace_back(new arangodb::ViewTypesFeature(server), true); features.emplace_back(new arangodb::AuthenticationFeature(server), true); + features.emplace_back(new arangodb::DatabaseFeature(server), false); // required for LogicalViewStorageEngine::modify(...) features.emplace_back(new arangodb::DatabasePathFeature(server), false); features.emplace_back(new arangodb::ShardingFeature(server), false); features.emplace_back(new arangodb::QueryRegistryFeature(server), false); // must be first @@ -262,7 +263,7 @@ TEST_CASE("IResearchQueryTestIn", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"includeAllFields\": true }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQueryJoin-test.cpp b/tests/IResearch/IResearchQueryJoin-test.cpp index 590097589a..a4bc913598 100644 --- a/tests/IResearch/IResearchQueryJoin-test.cpp +++ b/tests/IResearch/IResearchQueryJoin-test.cpp @@ -372,12 +372,12 @@ TEST_CASE("IResearchQueryTestJoinDuplicateDataSource", "[iresearch][iresearch-qu "\"collection_2\": { \"analyzers\": [ \"test_analyzer\", \"identity\" ], \"includeAllFields\": true }" "}}" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -522,12 +522,12 @@ TEST_CASE("IResearchQueryTestJoin", "[iresearch][iresearch-query]") { "\"collection_2\": { \"analyzers\": [ \"test_analyzer\", \"identity\" ], \"includeAllFields\": true }" "}}" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); diff --git a/tests/IResearch/IResearchQueryNullTerm-test.cpp b/tests/IResearch/IResearchQueryNullTerm-test.cpp index 1746c4a273..ed27c4a9ff 100644 --- a/tests/IResearch/IResearchQueryNullTerm-test.cpp +++ b/tests/IResearch/IResearchQueryNullTerm-test.cpp @@ -268,7 +268,7 @@ TEST_CASE("IResearchQueryTestNullTerm", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"includeAllFields\": true }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQueryNumericTerm-test.cpp b/tests/IResearch/IResearchQueryNumericTerm-test.cpp index 2560f455b0..f9c781e204 100644 --- a/tests/IResearch/IResearchQueryNumericTerm-test.cpp +++ b/tests/IResearch/IResearchQueryNumericTerm-test.cpp @@ -226,12 +226,12 @@ TEST_CASE("IResearchQueryTestNumericTerm", "[iresearch][iresearch-query]") { "\"collection_2\" : { \"includeAllFields\" : true }" "}}" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); diff --git a/tests/IResearch/IResearchQueryOr-test.cpp b/tests/IResearch/IResearchQueryOr-test.cpp index b968329065..69fbc6953f 100644 --- a/tests/IResearch/IResearchQueryOr-test.cpp +++ b/tests/IResearch/IResearchQueryOr-test.cpp @@ -227,12 +227,12 @@ TEST_CASE("IResearchQueryTestOr", "[iresearch][iresearch-query]") { "\"collection_2\": { \"analyzers\": [ \"test_analyzer\", \"identity\" ], \"includeAllFields\": true, \"storeValues\":\"id\" }" "}}" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); diff --git a/tests/IResearch/IResearchQueryPhrase-test.cpp b/tests/IResearch/IResearchQueryPhrase-test.cpp index 937e864e2d..a818f2d93a 100644 --- a/tests/IResearch/IResearchQueryPhrase-test.cpp +++ b/tests/IResearch/IResearchQueryPhrase-test.cpp @@ -272,7 +272,7 @@ TEST_CASE("IResearchQueryTestPhrase", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"analyzers\": [ \"test_analyzer\", \"identity\" ], \"includeAllFields\": true }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQuerySelectAll-test.cpp b/tests/IResearch/IResearchQuerySelectAll-test.cpp index 65569f82d8..8dd1596e1e 100644 --- a/tests/IResearch/IResearchQuerySelectAll-test.cpp +++ b/tests/IResearch/IResearchQuerySelectAll-test.cpp @@ -217,12 +217,12 @@ TEST_CASE("IResearchQueryTestSelectAll", "[iresearch][iresearch-query]") { "\"collection_2\" : { \"includeAllFields\" : true }" "}}" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); diff --git a/tests/IResearch/IResearchQueryStartsWith-test.cpp b/tests/IResearch/IResearchQueryStartsWith-test.cpp index 379f927dc9..19894398de 100644 --- a/tests/IResearch/IResearchQueryStartsWith-test.cpp +++ b/tests/IResearch/IResearchQueryStartsWith-test.cpp @@ -217,12 +217,12 @@ TEST_CASE("IResearchQueryTestStartsWith", "[iresearch][iresearch-query]") { "\"collection_2\" : { \"includeAllFields\" : true }" "}}" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); diff --git a/tests/IResearch/IResearchQueryStringTerm-test.cpp b/tests/IResearch/IResearchQueryStringTerm-test.cpp index ea02a00bb7..be9a6c7ff0 100644 --- a/tests/IResearch/IResearchQueryStringTerm-test.cpp +++ b/tests/IResearch/IResearchQueryStringTerm-test.cpp @@ -257,12 +257,12 @@ TEST_CASE("IResearchQueryTestStringTerm", "[iresearch][iresearch-query]") { "\"collection_2\" : { \"includeAllFields\" : true }" "}}" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); diff --git a/tests/IResearch/IResearchQueryTokens-test.cpp b/tests/IResearch/IResearchQueryTokens-test.cpp index 2822d67151..a998215d32 100644 --- a/tests/IResearch/IResearchQueryTokens-test.cpp +++ b/tests/IResearch/IResearchQueryTokens-test.cpp @@ -270,7 +270,7 @@ TEST_CASE("IResearchQueryTestTokens", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"includeAllFields\": true }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQueryTraversal-test.cpp b/tests/IResearch/IResearchQueryTraversal-test.cpp index bfc8469574..c7971e28bc 100644 --- a/tests/IResearch/IResearchQueryTraversal-test.cpp +++ b/tests/IResearch/IResearchQueryTraversal-test.cpp @@ -303,7 +303,7 @@ TEST_CASE("IResearchQueryTestTraversal", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"includeAllFields\": true }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchQueryValue-test.cpp b/tests/IResearch/IResearchQueryValue-test.cpp index 901e20c89f..8108377380 100644 --- a/tests/IResearch/IResearchQueryValue-test.cpp +++ b/tests/IResearch/IResearchQueryValue-test.cpp @@ -262,7 +262,7 @@ TEST_CASE("IResearchQueryTestValue", "[iresearch][iresearch-query]") { "\"testCollection1\": { \"includeAllFields\": true }" "}}" ); - CHECK((impl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((impl->properties(updateJson->slice(), true).ok())); std::set cids; impl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); CHECK((2 == cids.size())); diff --git a/tests/IResearch/IResearchView-test.cpp b/tests/IResearch/IResearchView-test.cpp index 258d44741a..3bbe50bf67 100644 --- a/tests/IResearch/IResearchView-test.cpp +++ b/tests/IResearch/IResearchView-test.cpp @@ -277,7 +277,7 @@ SECTION("test_defaults") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -307,7 +307,7 @@ SECTION("test_defaults") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -315,7 +315,8 @@ SECTION("test_defaults") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK((false == slice.hasKey("deleted"))); @@ -404,14 +405,15 @@ SECTION("test_defaults") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); arangodb::iresearch::IResearchViewMeta meta; std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((false == slice.hasKey("deleted"))); @@ -553,7 +555,7 @@ SECTION("test_drop_with_link") { \"links\": { \"testCollection\": {} } \ }"); - arangodb::Result res = view->updateProperties(links->slice(), true, false); + arangodb::Result res = view->properties(links->slice(), true); CHECK(true == res.ok()); CHECK((false == logicalCollection->getIndexes().empty())); @@ -609,7 +611,7 @@ SECTION("test_drop_collection") { auto* view = dynamic_cast(logicalView.get()); REQUIRE((false == !view)); - CHECK((true == logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((true == logicalView->properties(viewUpdateJson->slice(), true).ok())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); CHECK((true == logicalCollection->drop().ok())); @@ -1897,7 +1899,7 @@ SECTION("test_query") { CHECK((false == !logicalView)); auto* view = dynamic_cast(logicalView.get()); CHECK((false == !view)); - arangodb::Result res = logicalView->updateProperties(links->slice(), true, false); + arangodb::Result res = logicalView->properties(links->slice(), true); CHECK(true == res.ok()); CHECK((false == logicalCollection->getIndexes().empty())); @@ -1986,7 +1988,7 @@ SECTION("test_query") { REQUIRE((false == !logicalView)); auto* view = dynamic_cast(logicalView.get()); REQUIRE((false == !view)); - arangodb::Result res = logicalView->updateProperties(viewUpdateJson->slice(), true, false); + arangodb::Result res = logicalView->properties(viewUpdateJson->slice(), true); REQUIRE(true == res.ok()); // start flush thread @@ -2065,16 +2067,17 @@ SECTION("test_register_link") { { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, false, false); + view->properties(builder, false, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); + CHECK((4U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("id").copyString() == "101"); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties - CHECK(3 == slice.length()); } { @@ -2122,16 +2125,17 @@ SECTION("test_register_link") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, false, false); + view->properties(builder, false, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); + CHECK((4U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("id").copyString() == "101"); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties - CHECK(3 == slice.length()); } { @@ -2329,7 +2333,7 @@ SECTION("test_unregister_link") { \"links\": { \"testCollection\": {} } \ }"); - arangodb::Result res = logicalView->updateProperties(links->slice(), true, false); + arangodb::Result res = logicalView->properties(links->slice(), true); CHECK(true == res.ok()); CHECK((false == logicalCollection->getIndexes().empty())); @@ -2428,7 +2432,7 @@ SECTION("test_unregister_link") { \"links\": { \"testCollection\": {} } \ }"); - arangodb::Result res = logicalView->updateProperties(links->slice(), true, false); + arangodb::Result res = logicalView->properties(links->slice(), true); CHECK(true == res.ok()); CHECK((false == logicalCollection->getIndexes().empty())); @@ -2505,7 +2509,7 @@ SECTION("test_unregister_link") { \"links\": { \"testCollection\": {} } \ }"); - arangodb::Result res = logicalView->updateProperties(links->slice(), true, false); + arangodb::Result res = logicalView->properties(links->slice(), true); CHECK(true == res.ok()); CHECK((false == logicalCollection->getIndexes().empty())); @@ -2533,7 +2537,7 @@ SECTION("test_unregister_link") { REQUIRE((false == !logicalView)); auto* viewImpl = dynamic_cast(logicalView.get()); REQUIRE((nullptr != viewImpl)); - CHECK((viewImpl->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((viewImpl->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection->getIndexes().empty())); std::set cids; viewImpl->visitCollections([&cids](TRI_voc_cid_t cid)->bool { cids.emplace(cid); return true; }); @@ -2624,7 +2628,7 @@ SECTION("test_tracked_cids") { auto* viewImpl = dynamic_cast(logicalView.get()); REQUIRE((nullptr != viewImpl)); - CHECK((viewImpl->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson->slice(), false).ok())); std::set actual; std::set expected = { 100 }; @@ -2656,7 +2660,7 @@ SECTION("test_tracked_cids") { // create link { - CHECK((viewImpl->updateProperties(updateJson0->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson0->slice(), false).ok())); std::set actual; std::set expected = { 100 }; @@ -2671,7 +2675,7 @@ SECTION("test_tracked_cids") { // drop link { - CHECK((viewImpl->updateProperties(updateJson1->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson1->slice(), false).ok())); std::set actual; viewImpl->visitCollections([&actual](TRI_voc_cid_t cid)->bool { actual.emplace(cid); return true; }); @@ -2741,7 +2745,7 @@ SECTION("test_tracked_cids") { auto* viewImpl = dynamic_cast(logicalView.get()); REQUIRE((nullptr != viewImpl)); - CHECK((viewImpl->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson->slice(), false).ok())); std::set actual; std::set expected = { 100 }; @@ -2769,7 +2773,7 @@ SECTION("test_tracked_cids") { // create link { - CHECK((viewImpl->updateProperties(updateJson0->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson0->slice(), false).ok())); std::set actual; std::set expected = { 100 }; @@ -2784,7 +2788,7 @@ SECTION("test_tracked_cids") { // drop link { - CHECK((viewImpl->updateProperties(updateJson1->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson1->slice(), false).ok())); std::set actual; viewImpl->visitCollections([&actual](TRI_voc_cid_t cid)->bool { actual.emplace(cid); return true; }); @@ -2810,7 +2814,7 @@ SECTION("test_transaction_registration") { // link collection to view { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {}, \"testCollection1\": {} } }"); - CHECK((viewImpl->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((viewImpl->properties(updateJson->slice(), false).ok())); } // read transaction (by id) @@ -3282,14 +3286,14 @@ SECTION("test_update_overwrite") { }"); expectedMeta._cleanupIntervalStep = 42; - CHECK((view->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((view->properties(updateJson->slice(), false).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -3297,7 +3301,8 @@ SECTION("test_update_overwrite") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -3311,7 +3316,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3339,14 +3344,14 @@ SECTION("test_update_overwrite") { }"); expectedMeta._cleanupIntervalStep = 62; - CHECK((view->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((view->properties(updateJson->slice(), false).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -3355,7 +3360,8 @@ SECTION("test_update_overwrite") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -3369,7 +3375,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3401,14 +3407,14 @@ SECTION("test_update_overwrite") { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"cleanupIntervalStep\": 0.123 }"); expectedMeta._cleanupIntervalStep = 52; - CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->updateProperties(updateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->properties(updateJson->slice(), false).errorNumber())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -3417,7 +3423,8 @@ SECTION("test_update_overwrite") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -3431,7 +3438,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3462,7 +3469,7 @@ SECTION("test_update_overwrite") { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"cleanupIntervalStep\": 62, \"links\": { \"testCollection\": {} } }"); expectedMeta._cleanupIntervalStep = 52; - CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == logicalView->updateProperties(updateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == logicalView->properties(updateJson->slice(), false).errorNumber())); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); // not for persistence @@ -3470,7 +3477,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -3479,7 +3486,8 @@ SECTION("test_update_overwrite") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -3493,7 +3501,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3528,7 +3536,7 @@ SECTION("test_update_overwrite") { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"cleanupIntervalStep\": 62, \"links\": { \"testCollection\": 42 } }"); expectedMeta._cleanupIntervalStep = 52; - CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->updateProperties(updateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->properties(updateJson->slice(), false).errorNumber())); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); // not for persistence @@ -3536,7 +3544,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -3545,7 +3553,8 @@ SECTION("test_update_overwrite") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -3559,7 +3568,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3599,14 +3608,14 @@ SECTION("test_update_overwrite") { expectedMeta._cleanupIntervalStep = 52; expectedMetaState._collections.insert(logicalCollection->id()); expectedLinkMeta["testCollection"]; // use defaults - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -3615,7 +3624,8 @@ SECTION("test_update_overwrite") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -3646,7 +3656,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3677,14 +3687,14 @@ SECTION("test_update_overwrite") { }"); expectedMeta._cleanupIntervalStep = 62; - CHECK((logicalView->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), false).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -3693,7 +3703,8 @@ SECTION("test_update_overwrite") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -3707,7 +3718,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3752,14 +3763,14 @@ SECTION("test_update_overwrite") { expectedMeta._cleanupIntervalStep = 52; expectedMetaState._collections.insert(logicalCollection0->id()); expectedLinkMeta["testCollection0"]; // use defaults - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -3768,7 +3779,8 @@ SECTION("test_update_overwrite") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -3799,7 +3811,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3832,14 +3844,14 @@ SECTION("test_update_overwrite") { expectedMeta._cleanupIntervalStep = 10; expectedMetaState._collections.insert(logicalCollection1->id()); expectedLinkMeta["testCollection1"]; // use defaults - CHECK((view->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((view->properties(updateJson->slice(), false).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -3848,7 +3860,8 @@ SECTION("test_update_overwrite") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -3879,7 +3892,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3918,19 +3931,20 @@ SECTION("test_update_overwrite") { auto updateJson = arangodb::velocypack::Parser::fromJson( "{ \"links\": { \"testCollection\": { \"includeAllFields\": true } } }" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -3947,7 +3961,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -3967,18 +3981,19 @@ SECTION("test_update_overwrite") { auto updateJson = arangodb::velocypack::Parser::fromJson( "{ \"links\": { \"testCollection\": { } } }" ); - CHECK((view->updateProperties(updateJson->slice(), false, false).ok())); + CHECK((view->properties(updateJson->slice(), false).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -3995,7 +4010,7 @@ SECTION("test_update_overwrite") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -4028,7 +4043,7 @@ SECTION("test_update_overwrite") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -4054,11 +4069,11 @@ SECTION("test_update_overwrite") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 10; - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -4077,11 +4092,11 @@ SECTION("test_update_overwrite") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 62; - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -4119,7 +4134,7 @@ SECTION("test_update_overwrite") { userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database auto resetUserManager = irs::make_finally([userManager]()->void{ userManager->removeAllUsers(); }); - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); CHECK((true == logicalCollection->getIndexes().empty())); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -4142,7 +4157,7 @@ SECTION("test_update_overwrite") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -4165,7 +4180,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection", arangodb::auth::Level::NONE); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); CHECK((false == logicalCollection->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -4177,7 +4192,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); CHECK((true == logicalCollection->getIndexes().empty())); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -4205,7 +4220,7 @@ SECTION("test_update_overwrite") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((true == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4230,7 +4245,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((true == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4244,7 +4259,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((false == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4273,7 +4288,7 @@ SECTION("test_update_overwrite") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {}, \"testCollection1\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((false == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4298,7 +4313,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((false == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4312,7 +4327,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((true == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4337,7 +4352,7 @@ SECTION("test_update_overwrite") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -4360,7 +4375,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection", arangodb::auth::Level::NONE); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); CHECK((false == logicalCollection->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -4372,7 +4387,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); CHECK((true == logicalCollection->getIndexes().empty())); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -4400,7 +4415,7 @@ SECTION("test_update_overwrite") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((true == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4425,7 +4440,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((true == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4439,7 +4454,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((false == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4468,7 +4483,7 @@ SECTION("test_update_overwrite") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {}, \"testCollection1\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((false == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4493,7 +4508,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((false == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4507,7 +4522,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((true == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -4540,14 +4555,14 @@ SECTION("test_update_partial") { }"); expectedMeta._cleanupIntervalStep = 42; - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -4556,7 +4571,8 @@ SECTION("test_update_partial") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -4570,7 +4586,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -4601,14 +4617,14 @@ SECTION("test_update_partial") { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"cleanupIntervalStep\": 0.123 }"); expectedMeta._cleanupIntervalStep = 52; - CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->updateProperties(updateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->properties(updateJson->slice(), true).errorNumber())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -4617,7 +4633,8 @@ SECTION("test_update_partial") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -4631,7 +4648,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -4662,7 +4679,7 @@ SECTION("test_update_partial") { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"cleanupIntervalStep\": 62, \"links\": { \"testCollection\": {} } }"); expectedMeta._cleanupIntervalStep = 52; - CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == logicalView->updateProperties(updateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == logicalView->properties(updateJson->slice(), true).errorNumber())); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); // not for persistence @@ -4670,7 +4687,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -4679,7 +4696,8 @@ SECTION("test_update_partial") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -4693,7 +4711,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -4728,7 +4746,7 @@ SECTION("test_update_partial") { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"cleanupIntervalStep\": 62, \"links\": { \"testCollection\": 42 } }"); expectedMeta._cleanupIntervalStep = 52; - CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->updateProperties(updateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->properties(updateJson->slice(), true).errorNumber())); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); // not for persistence @@ -4736,7 +4754,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -4745,7 +4763,8 @@ SECTION("test_update_partial") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -4759,7 +4778,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -4799,14 +4818,14 @@ SECTION("test_update_partial") { expectedMeta._cleanupIntervalStep = 52; expectedMetaState._collections.insert(logicalCollection->id()); expectedLinkMeta["testCollection"]; // use defaults - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -4815,7 +4834,8 @@ SECTION("test_update_partial") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -4846,7 +4866,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -4880,14 +4900,14 @@ SECTION("test_update_partial") { expectedMeta._cleanupIntervalStep = 62; expectedMetaState._collections.insert(logicalCollection->id()); expectedLinkMeta["testCollection"]; // use defaults - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, false); + logicalView->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -4896,7 +4916,8 @@ SECTION("test_update_partial") { std::string error; CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); CHECK((slice.get("deleted").isNone())); // no system properties @@ -4927,7 +4948,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); + logicalView->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -4968,7 +4989,7 @@ SECTION("test_update_partial") { StorageEngineMock::inRecoveryResult = true; auto restore = irs::make_finally([&before]()->void { StorageEngineMock::inRecoveryResult = before; }); persisted = false; - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); CHECK((false == persisted)); // not for persistence @@ -4976,12 +4997,13 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -4998,7 +5020,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5034,7 +5056,7 @@ SECTION("test_update_partial") { expectedMetaState._collections.insert(logicalCollection->id()); expectedLinkMeta["testCollection"]; // use defaults persisted = false; - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); CHECK((true == persisted)); // link addition does modify and persist view meta // not for persistence @@ -5042,7 +5064,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -5051,7 +5073,8 @@ SECTION("test_update_partial") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5082,7 +5105,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5141,7 +5164,7 @@ SECTION("test_update_partial") { expectedMetaState._collections.insert(logicalCollection->id()); expectedLinkMeta["testCollection"]; // use defaults persisted = false; - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); CHECK((true == persisted)); // link addition does modify and persist view meta // not for persistence @@ -5149,7 +5172,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -5158,7 +5181,8 @@ SECTION("test_update_partial") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5189,7 +5213,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5225,14 +5249,14 @@ SECTION("test_update_partial") { }}"); expectedMeta._cleanupIntervalStep = 52; - CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == view->updateProperties(updateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == view->properties(updateJson->slice(), true).errorNumber())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -5241,7 +5265,8 @@ SECTION("test_update_partial") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5255,7 +5280,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5292,18 +5317,19 @@ SECTION("test_update_partial") { auto beforeRecovery = StorageEngineMock::inRecoveryResult; StorageEngineMock::inRecoveryResult = true; auto restoreRecovery = irs::make_finally([&beforeRecovery]()->void { StorageEngineMock::inRecoveryResult = beforeRecovery; }); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); CHECK((false == persisted)); // link addition does not persist view meta arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5323,18 +5349,19 @@ SECTION("test_update_partial") { StorageEngineMock::inRecoveryResult = true; auto restore = irs::make_finally([&before]()->void { StorageEngineMock::inRecoveryResult = before; }); persisted = false; - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); CHECK((false == persisted)); arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5367,14 +5394,14 @@ SECTION("test_update_partial") { \"testCollection\": {} \ }}"); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -5383,7 +5410,8 @@ SECTION("test_update_partial") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5397,7 +5425,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5424,14 +5452,14 @@ SECTION("test_update_partial") { expectedMeta._cleanupIntervalStep = 52; expectedMetaState._collections.clear(); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -5440,7 +5468,8 @@ SECTION("test_update_partial") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5454,7 +5483,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5488,14 +5517,14 @@ SECTION("test_update_partial") { }}"); expectedMeta._cleanupIntervalStep = 52; - CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == view->updateProperties(updateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == view->properties(updateJson->slice(), true).errorNumber())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -5504,7 +5533,8 @@ SECTION("test_update_partial") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5518,7 +5548,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5554,14 +5584,14 @@ SECTION("test_update_partial") { }}"); expectedMeta._cleanupIntervalStep = 52; - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); @@ -5570,7 +5600,8 @@ SECTION("test_update_partial") { std::string error; CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5584,7 +5615,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5617,19 +5648,20 @@ SECTION("test_update_partial") { auto updateJson = arangodb::velocypack::Parser::fromJson( "{ \"links\": { \"testCollection\": {} } }" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5642,7 +5674,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5669,19 +5701,20 @@ SECTION("test_update_partial") { } CHECK((!initial.empty())); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5694,7 +5727,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5732,19 +5765,20 @@ SECTION("test_update_partial") { auto updateJson = arangodb::velocypack::Parser::fromJson( "{ \"links\": { \"testCollection\": { \"includeAllFields\": true } } }" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5761,7 +5795,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5781,19 +5815,20 @@ SECTION("test_update_partial") { auto updateJson = arangodb::velocypack::Parser::fromJson( "{ \"links\": { \"testCollection\": { } } }" ); - CHECK((view->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((view->properties(updateJson->slice(), true).ok())); // not for persistence { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK(slice.isObject()); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK(slice.get("name").copyString() == "testView"); CHECK(slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name()); CHECK(slice.get("deleted").isNone()); // no system properties @@ -5810,7 +5845,7 @@ SECTION("test_update_partial") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -5844,7 +5879,7 @@ SECTION("test_update_partial") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -5870,11 +5905,11 @@ SECTION("test_update_partial") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 10; - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -5893,11 +5928,11 @@ SECTION("test_update_partial") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 62; - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), true).ok())); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -5935,7 +5970,7 @@ SECTION("test_update_partial") { userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database auto resetUserManager = irs::make_finally([userManager]()->void{ userManager->removeAllUsers(); }); - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); CHECK((true == logicalCollection->getIndexes().empty())); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -5958,7 +5993,7 @@ SECTION("test_update_partial") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -5981,7 +6016,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase.name(), "testCollection", arangodb::auth::Level::NONE); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); CHECK((false == logicalCollection->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -5993,7 +6028,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase.name(), "testCollection", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), true).ok())); CHECK((true == logicalCollection->getIndexes().empty())); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); } @@ -6021,7 +6056,7 @@ SECTION("test_update_partial") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((true == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -6046,7 +6081,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((true == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -6060,7 +6095,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), true).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((false == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -6089,7 +6124,7 @@ SECTION("test_update_partial") { // initial link creation { auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {}, \"testCollection1\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((false == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -6114,7 +6149,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((false == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); @@ -6128,7 +6163,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase.name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), true).ok())); CHECK((false == logicalCollection0->getIndexes().empty())); CHECK((true == logicalCollection1->getIndexes().empty())); CHECK((false == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); diff --git a/tests/IResearch/IResearchViewCoordinator-test.cpp b/tests/IResearch/IResearchViewCoordinator-test.cpp index 6824652b38..a60a106d19 100644 --- a/tests/IResearch/IResearchViewCoordinator-test.cpp +++ b/tests/IResearch/IResearchViewCoordinator-test.cpp @@ -273,9 +273,9 @@ SECTION("test_rename") { CHECK(arangodb::LogicalView::category() == view->category()); CHECK(&vocbase == &view->vocbase()); - auto const res = view->rename("otherName", true); + auto const res = view->rename("otherName"); CHECK(res.fail()); - CHECK(TRI_ERROR_NOT_IMPLEMENTED == res.errorNumber()); + CHECK(TRI_ERROR_CLUSTER_UNSUPPORTED == res.errorNumber()); } SECTION("visit_collections") { @@ -356,7 +356,7 @@ SECTION("test_defaults") { arangodb::iresearch::IResearchViewMeta expectedMeta; arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); arangodb::iresearch::IResearchViewMeta meta; @@ -379,13 +379,14 @@ SECTION("test_defaults") { arangodb::iresearch::IResearchViewMeta expectedMeta; arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); arangodb::iresearch::IResearchViewMeta meta; std::string error; - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("id").copyString() == "1")); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); @@ -399,13 +400,14 @@ SECTION("test_defaults") { { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, false, false); + view->properties(builder, false, false); builder.close(); auto slice = builder.slice(); arangodb::iresearch::IResearchViewMeta meta; std::string error; - CHECK((3 == slice.length())); + CHECK((4U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.get("id").copyString() == "1")); CHECK((slice.get("name").copyString() == "testView")); CHECK((slice.get("type").copyString() == arangodb::iresearch::DATA_SOURCE_TYPE.name())); @@ -418,7 +420,7 @@ SECTION("test_defaults") { { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, false, true); + view->properties(builder, false, true); builder.close(); auto slice = builder.slice(); @@ -744,7 +746,7 @@ SECTION("test_drop_with_link") { CHECK(arangodb::AgencyComm().setValue(path, value->slice(), 0.0).successful()); } - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), true).ok())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -856,7 +858,7 @@ SECTION("test_update_properties") { { VPackBuilder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); arangodb::iresearch::IResearchViewMeta meta; @@ -871,7 +873,7 @@ SECTION("test_update_properties") { // update properties - full update { auto props = arangodb::velocypack::Parser::fromJson("{ \"cleanupIntervalStep\": 42, \"consolidationIntervalMsec\": 50 }"); - CHECK(view->updateProperties(props->slice(), false, true).ok()); + CHECK(view->properties(props->slice(), false).ok()); CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); @@ -891,7 +893,7 @@ SECTION("test_update_properties") { { VPackBuilder builder; builder.openObject(); - fullyUpdatedView->toVelocyPack(builder, true, false); + fullyUpdatedView->properties(builder, true, false); builder.close(); arangodb::iresearch::IResearchViewMeta meta; @@ -908,7 +910,7 @@ SECTION("test_update_properties") { { VPackBuilder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); arangodb::iresearch::IResearchViewMeta meta; @@ -922,7 +924,7 @@ SECTION("test_update_properties") { // partially update properties { auto props = arangodb::velocypack::Parser::fromJson("{ \"consolidationIntervalMsec\": 42 }"); - CHECK(fullyUpdatedView->updateProperties(props->slice(), true, true).ok()); + CHECK(fullyUpdatedView->properties(props->slice(), true).ok()); CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); @@ -942,7 +944,7 @@ SECTION("test_update_properties") { { VPackBuilder builder; builder.openObject(); - partiallyUpdatedView->toVelocyPack(builder, true, false); + partiallyUpdatedView->properties(builder, true, false); builder.close(); arangodb::iresearch::IResearchViewMeta meta; @@ -1082,7 +1084,7 @@ SECTION("test_update_links_partial_remove") { " \"testCollection3\" : { \"id\": \"3\" } " "} }" ); - CHECK(view->updateProperties(linksJson->slice(), true, true).ok()); // add links + CHECK(view->properties(linksJson->slice(), true).ok()); // add links CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); auto oldView = view; @@ -1115,7 +1117,7 @@ SECTION("test_update_links_partial_remove") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -1307,7 +1309,7 @@ SECTION("test_update_links_partial_remove") { CHECK(0 < slice.get("figures").get("memory").getUInt()); } - CHECK(view->updateProperties(linksJson->slice(), true, true).ok()); // same properties -> should not affect plan version + CHECK(view->properties(linksJson->slice(), true).ok()); // same properties -> should not affect plan version CHECK(planVersion == arangodb::tests::getCurrentPlanVersion()); // plan did't change version // remove testCollection2 link @@ -1322,7 +1324,7 @@ SECTION("test_update_links_partial_remove") { " \"2\" : null " "} }" ); - CHECK(view->updateProperties(updateJson->slice(), true, true).ok()); + CHECK(view->properties(updateJson->slice(), true).ok()); CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); oldView = view; @@ -1354,7 +1356,7 @@ SECTION("test_update_links_partial_remove") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -1642,7 +1644,7 @@ SECTION("test_update_links_partial_add") { " \"testCollection3\" : { \"id\": \"3\" } " "} }" ); - CHECK(view->updateProperties(linksJson->slice(), true, true).ok()); // add links + CHECK(view->properties(linksJson->slice(), true).ok()); // add links CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); auto oldView = view; @@ -1674,7 +1676,7 @@ SECTION("test_update_links_partial_add") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -1806,7 +1808,7 @@ SECTION("test_update_links_partial_add") { CHECK(0 < slice.get("figures").get("memory").getUInt()); } - CHECK(view->updateProperties(linksJson->slice(), true, true).ok()); // same properties -> should not affect plan version + CHECK(view->properties(linksJson->slice(), true).ok()); // same properties -> should not affect plan version CHECK(planVersion == arangodb::tests::getCurrentPlanVersion()); // plan did't change version // remove testCollection2 link @@ -1821,7 +1823,7 @@ SECTION("test_update_links_partial_add") { " \"2\" : { \"id\": \"2\", \"trackListPositions\" : true } " "} }" ); - CHECK(view->updateProperties(updateJson->slice(), true, true).ok()); + CHECK(view->properties(updateJson->slice(), true).ok()); CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); oldView = view; @@ -1854,7 +1856,7 @@ SECTION("test_update_links_partial_add") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -2051,7 +2053,7 @@ SECTION("test_update_links_partial_add") { // partial update - empty delta { auto const updateJson = arangodb::velocypack::Parser::fromJson("{ }"); - CHECK(view->updateProperties(updateJson->slice(), true, true).ok()); // empty properties -> should not affect plan version + CHECK(view->properties(updateJson->slice(), true).ok()); // empty properties -> should not affect plan version CHECK(planVersion == arangodb::tests::getCurrentPlanVersion()); // plan did't change version } @@ -2128,7 +2130,7 @@ SECTION("test_update_links_partial_add") { userManager->setQueryRegistry(&queryRegistry); auto resetUserManager = irs::make_finally([userManager]()->void{ userManager->removeAllUsers(); }); - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(linksJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(linksJson->slice(), true).errorNumber())); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection1)); logicalView = ci->getView(vocbase->name(), viewId); // get new version of the view @@ -2250,7 +2252,7 @@ SECTION("test_update_links_replace") { " \"testCollection3\" : { \"id\": \"3\" } " "} }" ); - CHECK(view->updateProperties(linksJson->slice(), false, true).ok()); // add link + CHECK(view->properties(linksJson->slice(), false).ok()); // add link CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); auto oldView = view; @@ -2282,7 +2284,7 @@ SECTION("test_update_links_replace") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -2414,10 +2416,10 @@ SECTION("test_update_links_replace") { CHECK(0 < slice.get("figures").get("memory").getUInt()); } - CHECK(view->updateProperties(linksJson->slice(), false, true).ok()); // same properties -> should not affect plan version + CHECK(view->properties(linksJson->slice(), false).ok()); // same properties -> should not affect plan version CHECK(planVersion == arangodb::tests::getCurrentPlanVersion()); // plan did't change version - CHECK(view->updateProperties(linksJson->slice(), true, true).ok()); // same properties -> should not affect plan version + CHECK(view->properties(linksJson->slice(), true).ok()); // same properties -> should not affect plan version CHECK(planVersion == arangodb::tests::getCurrentPlanVersion()); // plan did't change version // replace links with testCollection2 link @@ -2440,7 +2442,7 @@ SECTION("test_update_links_replace") { " \"2\" : { \"id\": \"2\", \"trackListPositions\" : true } " "} }" ); - CHECK(view->updateProperties(updateJson->slice(), false, true).ok()); + CHECK(view->properties(updateJson->slice(), false).ok()); CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); oldView = view; @@ -2471,7 +2473,7 @@ SECTION("test_update_links_replace") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -2562,7 +2564,7 @@ SECTION("test_update_links_replace") { " \"2\" : null " "} }" ); - CHECK(view->updateProperties(updateJson->slice(), false, true).ok()); + CHECK(view->properties(updateJson->slice(), false).ok()); CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); oldView = view; @@ -2593,7 +2595,7 @@ SECTION("test_update_links_replace") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -2823,7 +2825,7 @@ SECTION("test_update_links_clear") { " \"testCollection3\" : { \"id\": \"3\" } " "} }" ); - CHECK(view->updateProperties(linksJson->slice(), false, true).ok()); // add link + CHECK(view->properties(linksJson->slice(), false).ok()); // add link CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); auto oldView = view; @@ -2856,7 +2858,7 @@ SECTION("test_update_links_clear") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -3049,10 +3051,10 @@ SECTION("test_update_links_clear") { CHECK(0 < slice.get("figures").get("memory").getUInt()); } - CHECK(view->updateProperties(linksJson->slice(), false, true).ok()); // same properties -> should not affect plan version + CHECK(view->properties(linksJson->slice(), false).ok()); // same properties -> should not affect plan version CHECK(planVersion == arangodb::tests::getCurrentPlanVersion()); // plan did't change version - CHECK(view->updateProperties(linksJson->slice(), true, true).ok()); // same properties -> should not affect plan version + CHECK(view->properties(linksJson->slice(), true).ok()); // same properties -> should not affect plan version CHECK(planVersion == arangodb::tests::getCurrentPlanVersion()); // plan did't change version // remove all links @@ -3071,7 +3073,7 @@ SECTION("test_update_links_clear") { } auto const updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": {} }"); - CHECK(view->updateProperties(updateJson->slice(), false, true).ok()); + CHECK(view->properties(updateJson->slice(), false).ok()); CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); oldView = view; @@ -3098,7 +3100,7 @@ SECTION("test_update_links_clear") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -3211,7 +3213,7 @@ SECTION("test_drop_link") { } auto linksJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\" : { \"includeAllFields\" : true } } }"); - CHECK(view->updateProperties(linksJson->slice(), true, true).ok()); // add link + CHECK(view->properties(linksJson->slice(), true).ok()); // add link CHECK(planVersion < arangodb::tests::getCurrentPlanVersion()); // plan version changed planVersion = arangodb::tests::getCurrentPlanVersion(); @@ -3241,7 +3243,7 @@ SECTION("test_drop_link") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -3318,7 +3320,7 @@ SECTION("test_drop_link") { CHECK(0 < slice.get("figures").get("memory").getUInt()); } - CHECK(view->updateProperties(linksJson->slice(), true, true).ok()); // same properties -> should not affect plan version + CHECK(view->properties(linksJson->slice(), true).ok()); // same properties -> should not affect plan version CHECK(planVersion == arangodb::tests::getCurrentPlanVersion()); // plan did't change version // simulate heartbeat thread (drop index from current) @@ -3353,7 +3355,7 @@ SECTION("test_drop_link") { { VPackBuilder info; info.openObject(); - view->toVelocyPack(info, true, false); + view->properties(info, true, false); info.close(); auto const properties = info.slice(); @@ -3410,7 +3412,7 @@ SECTION("test_drop_link") { userManager->setQueryRegistry(&queryRegistry); auto resetUserManager = irs::make_finally([userManager]()->void{ userManager->removeAllUsers(); }); - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection1)); logicalView = ci->getView(vocbase->name(), viewId); // get new version of the view @@ -3462,14 +3464,14 @@ SECTION("test_update_overwrite") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 10; - CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); logicalView = ci->getView(vocbase->name(), viewId); REQUIRE((false == !logicalView)); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -3505,14 +3507,14 @@ SECTION("test_update_overwrite") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 10; - CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); logicalView = ci->getView(vocbase->name(), viewId); REQUIRE((false == !logicalView)); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -3555,7 +3557,7 @@ SECTION("test_update_overwrite") { } auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -3585,13 +3587,13 @@ SECTION("test_update_overwrite") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 10; - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); logicalView = ci->getView(vocbase->name(), viewId); REQUIRE((false == !logicalView)); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -3610,13 +3612,13 @@ SECTION("test_update_overwrite") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 62; - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); logicalView = ci->getView(vocbase->name(), viewId); REQUIRE((false == !logicalView)); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -3664,7 +3666,7 @@ SECTION("test_update_overwrite") { userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database auto resetUserManager = irs::make_finally([userManager]()->void{ userManager->removeAllUsers(); }); - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -3708,7 +3710,7 @@ SECTION("test_update_overwrite") { } auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -3742,7 +3744,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase->name(), "testCollection", arangodb::auth::Level::NONE); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -3758,7 +3760,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase->name(), "testCollection", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -3815,7 +3817,7 @@ SECTION("test_update_overwrite") { } auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -3846,7 +3848,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase->name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -3866,7 +3868,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase->name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -3926,7 +3928,7 @@ SECTION("test_update_overwrite") { } auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {}, \"testCollection1\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -3963,7 +3965,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase->name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), false, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), false).errorNumber())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -3983,7 +3985,7 @@ SECTION("test_update_overwrite") { user.grantCollection(vocbase->name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), false, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), false).ok())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -4039,14 +4041,14 @@ SECTION("test_update_partial") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 10; - CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); logicalView = ci->getView(vocbase->name(), viewId); REQUIRE((false == !logicalView)); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -4082,14 +4084,14 @@ SECTION("test_update_partial") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 10; - CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_BAD_PARAMETER == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); logicalView = ci->getView(vocbase->name(), viewId); REQUIRE((false == !logicalView)); CHECK((true == logicalView->visitCollections([](TRI_voc_cid_t)->bool { return false; }))); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -4132,7 +4134,7 @@ SECTION("test_update_partial") { } auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -4162,13 +4164,13 @@ SECTION("test_update_partial") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 10; - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); logicalView = ci->getView(vocbase->name(), viewId); REQUIRE((false == !logicalView)); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -4187,13 +4189,13 @@ SECTION("test_update_partial") { arangodb::iresearch::IResearchViewMeta expectedMeta; expectedMeta._cleanupIntervalStep = 62; - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), true).ok())); logicalView = ci->getView(vocbase->name(), viewId); REQUIRE((false == !logicalView)); arangodb::velocypack::Builder builder; builder.openObject(); - logicalView->toVelocyPack(builder, true, true); // 'forPersistence' to avoid auth check + logicalView->properties(builder, true, true); // 'forPersistence' to avoid auth check builder.close(); auto slice = builder.slice(); @@ -4241,7 +4243,7 @@ SECTION("test_update_partial") { userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database auto resetUserManager = irs::make_finally([userManager]()->void{ userManager->removeAllUsers(); }); - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -4285,7 +4287,7 @@ SECTION("test_update_partial") { } auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -4318,7 +4320,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase->name(), "testCollection", arangodb::auth::Level::NONE); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -4334,7 +4336,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase->name(), "testCollection", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), true).ok())); logicalCollection = ci->getCollection(vocbase->name(), collectionId); REQUIRE((false == !logicalCollection)); logicalView = ci->getView(vocbase->name(), viewId); @@ -4388,7 +4390,7 @@ SECTION("test_update_partial") { } auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -4428,7 +4430,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase->name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -4448,7 +4450,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase->name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), true).ok())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -4508,7 +4510,7 @@ SECTION("test_update_partial") { } auto updateJson = arangodb::velocypack::Parser::fromJson("{ \"links\": { \"testCollection0\": {}, \"testCollection1\": {} } }"); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -4545,7 +4547,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase->name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((TRI_ERROR_FORBIDDEN == logicalView->updateProperties(viewUpdateJson->slice(), true, false).errorNumber())); + CHECK((TRI_ERROR_FORBIDDEN == logicalView->properties(viewUpdateJson->slice(), true).errorNumber())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); @@ -4565,7 +4567,7 @@ SECTION("test_update_partial") { user.grantCollection(vocbase->name(), "testCollection1", arangodb::auth::Level::RO); // for missing collections User::collectionAuthLevel(...) returns database auth::Level userManager->setAuthInfo(userMap); // set user map to avoid loading configuration from system database - CHECK((logicalView->updateProperties(viewUpdateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(viewUpdateJson->slice(), true).ok())); logicalCollection0 = ci->getCollection(vocbase->name(), collectionId0); REQUIRE((false == !logicalCollection0)); logicalCollection1 = ci->getCollection(vocbase->name(), collectionId1); diff --git a/tests/IResearch/IResearchViewDBServer-test.cpp b/tests/IResearch/IResearchViewDBServer-test.cpp index 68d4a94ead..e0fb024a4d 100644 --- a/tests/IResearch/IResearchViewDBServer-test.cpp +++ b/tests/IResearch/IResearchViewDBServer-test.cpp @@ -358,7 +358,7 @@ SECTION("test_drop_database") { REQUIRE((false == !wiewImpl)); beforeCount = 0; // reset before call to StorageEngine::createView(...) - auto res = logicalWiew->updateProperties(viewUpdateJson->slice(), true, false); + auto res = logicalWiew->properties(viewUpdateJson->slice(), true); REQUIRE(true == res.ok()); CHECK((1 + 2 + 1 == beforeCount)); // +1 for StorageEngineMock::createView(...), +2 for StorageEngineMock::getViewProperties(...), +1 for StorageEngineMock::changeView(...) @@ -599,7 +599,7 @@ SECTION("test_query") { CHECK((false == !logicalWiew)); auto* wiewImpl = dynamic_cast(logicalWiew.get()); CHECK((false == !wiewImpl)); - arangodb::Result res = logicalWiew->updateProperties(links->slice(), true, false); + arangodb::Result res = logicalWiew->properties(links->slice(), true); CHECK(true == res.ok()); CHECK((false == logicalCollection->getIndexes().empty())); @@ -699,7 +699,7 @@ SECTION("test_query") { REQUIRE((false == !logicalWiew)); auto* wiewImpl = dynamic_cast(logicalWiew.get()); REQUIRE((false == !wiewImpl)); - arangodb::Result res = logicalWiew->updateProperties(viewUpdateJson->slice(), true, false); + arangodb::Result res = logicalWiew->properties(viewUpdateJson->slice(), true); REQUIRE(true == res.ok()); // start flush thread @@ -775,19 +775,19 @@ SECTION("test_rename") { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, false, false); + wiew->properties(builder, false, false); builder.close(); CHECK((builder.slice().hasKey("name"))); CHECK((std::string("testView") == builder.slice().get("name").copyString())); } - CHECK((TRI_ERROR_NOT_IMPLEMENTED == wiew->rename("newName", true).errorNumber())); + CHECK((TRI_ERROR_CLUSTER_UNSUPPORTED == wiew->rename("newName").errorNumber())); { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, false, false); + wiew->properties(builder, false, false); builder.close(); CHECK((builder.slice().hasKey("name"))); CHECK((std::string("testView") == builder.slice().get("name").copyString())); @@ -827,26 +827,26 @@ SECTION("test_rename") { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, false, false); + wiew->properties(builder, false, false); builder.close(); CHECK((builder.slice().hasKey("name"))); CHECK((std::string("testView") == builder.slice().get("name").copyString())); } - CHECK((TRI_ERROR_NOT_IMPLEMENTED == wiew->rename("newName", true).errorNumber())); + CHECK((TRI_ERROR_CLUSTER_UNSUPPORTED == wiew->rename("newName").errorNumber())); { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, false, false); + wiew->properties(builder, false, false); builder.close(); CHECK((builder.slice().hasKey("name"))); CHECK((std::string("testView") == builder.slice().get("name").copyString())); } CHECK((("_iresearch_123_" + wiewId) == view->name())); - wiew->rename("testView", true); // rename back or vocbase will be out of sync + wiew->rename("testView"); // rename back or vocbase will be out of sync } } @@ -864,10 +864,11 @@ SECTION("test_toVelocyPack") { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder,false, false); + wiew->properties(builder,false, false); builder.close(); auto slice = builder.slice(); - CHECK((3 == slice.length())); + CHECK((4U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.hasKey("id") && slice.get("id").isString() && std::string("1") == slice.get("id").copyString())); CHECK((slice.hasKey("name") && slice.get("name").isString() && std::string("testView") == slice.get("name").copyString())); CHECK((slice.hasKey("type") && slice.get("type").isString() && arangodb::iresearch::DATA_SOURCE_TYPE.name() == slice.get("type").copyString())); @@ -886,10 +887,11 @@ SECTION("test_toVelocyPack") { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, true, false); + wiew->properties(builder, true, false); builder.close(); auto slice = builder.slice(); - CHECK((9U == slice.length())); + CHECK((10U == slice.length())); + CHECK((slice.hasKey("globallyUniqueId") && slice.get("globallyUniqueId").isString() && false == slice.get("globallyUniqueId").copyString().empty())); CHECK((slice.hasKey("id") && slice.get("id").isString() && std::string("2") == slice.get("id").copyString())); CHECK((slice.hasKey("name") && slice.get("name").isString() && std::string("testView") == slice.get("name").copyString())); CHECK((slice.hasKey("type") && slice.get("type").isString() && arangodb::iresearch::DATA_SOURCE_TYPE.name() == slice.get("type").copyString())); @@ -908,7 +910,7 @@ SECTION("test_toVelocyPack") { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, false, true); + wiew->properties(builder, false, true); builder.close(); auto slice = builder.slice(); CHECK((7 == slice.length())); @@ -1052,12 +1054,12 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, true, false); + wiew->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((9U == slice.length())); + CHECK((10U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 24 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 42 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((!slice.hasKey("links"))); @@ -1065,19 +1067,19 @@ SECTION("test_updateProperties") { { auto update = arangodb::velocypack::Parser::fromJson("{ \"collections\": [ 6, 7, 8, 9 ], \"consolidationIntervalMsec\": 52, \"links\": { \"testCollection\": {} } }"); - CHECK((true == wiew->updateProperties(update->slice(), true, true).ok())); + CHECK((true == wiew->properties(update->slice(), true).ok())); } { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, true, false); + wiew->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((9U == slice.length())); + CHECK((10U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 24 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 52 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((!slice.hasKey("links"))); @@ -1093,12 +1095,12 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 24 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 52 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((slice.hasKey("links") && slice.get("links").isObject() && 0 == slice.get("links").length())); @@ -1109,7 +1111,7 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -1142,12 +1144,12 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, true, false); + wiew->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((9U == slice.length())); + CHECK((10U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 24 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 42 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((!slice.hasKey("links"))); @@ -1155,19 +1157,19 @@ SECTION("test_updateProperties") { { auto update = arangodb::velocypack::Parser::fromJson("{ \"collections\": [ 6, 7, 8, 9 ], \"links\": { \"testCollection\": {} }, \"consolidationIntervalMsec\": 52 }"); - CHECK((true == wiew->updateProperties(update->slice(), false, true).ok())); + CHECK((true == wiew->properties(update->slice(), false).ok())); } { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, true, false); + wiew->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((9U == slice.length())); + CHECK((10U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 10 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 52 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((!slice.hasKey("links"))); @@ -1183,12 +1185,12 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 10 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 52 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((slice.hasKey("links") && slice.get("links").isObject() && 0 == slice.get("links").length())); @@ -1199,7 +1201,7 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -1237,12 +1239,12 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, true, false); + wiew->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((9U == slice.length())); + CHECK((10U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 24 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 42 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((!slice.hasKey("links"))); @@ -1250,19 +1252,19 @@ SECTION("test_updateProperties") { { auto update = arangodb::velocypack::Parser::fromJson("{ \"collections\": [ 6, 7, 8 ], \"links\": { \"testCollection\": {} }, \"consolidationIntervalMsec\": 52 }"); - CHECK((true == wiew->updateProperties(update->slice(), true, true).ok())); + CHECK((true == wiew->properties(update->slice(), true).ok())); } { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, true, false); + wiew->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((9U == slice.length())); + CHECK((10U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 24 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 52 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((!slice.hasKey("links"))); @@ -1275,12 +1277,12 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 24 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 52 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((slice.hasKey("links") && slice.get("links").isObject() && 0 == slice.get("links").length())); @@ -1291,7 +1293,7 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); @@ -1332,12 +1334,12 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, true, false); + wiew->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((9U == slice.length())); + CHECK((10U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 24 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 42 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((!slice.hasKey("links"))); @@ -1345,19 +1347,19 @@ SECTION("test_updateProperties") { { auto update = arangodb::velocypack::Parser::fromJson("{ \"collections\": [ 6, 7, 8 ], \"links\": { \"testCollection\": {} }, \"consolidationIntervalMsec\": 52 }"); - CHECK((true == wiew->updateProperties(update->slice(), false, true).ok())); + CHECK((true == wiew->properties(update->slice(), false).ok())); } { arangodb::velocypack::Builder builder; builder.openObject(); - wiew->toVelocyPack(builder, true, false); + wiew->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((9U == slice.length())); + CHECK((10U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 10 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 52 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((!slice.hasKey("links"))); @@ -1370,12 +1372,12 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, false); + view->properties(builder, true, false); builder.close(); auto slice = builder.slice(); CHECK((slice.isObject())); - CHECK((10U == slice.length())); + CHECK((11U == slice.length())); CHECK((slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber() && 10 == slice.get("cleanupIntervalStep").getNumber())); CHECK((slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber() && 52 == slice.get("consolidationIntervalMsec").getNumber())); CHECK((slice.hasKey("links") && slice.get("links").isObject() && 0 == slice.get("links").length())); @@ -1386,7 +1388,7 @@ SECTION("test_updateProperties") { arangodb::velocypack::Builder builder; builder.openObject(); - view->toVelocyPack(builder, true, true); + view->properties(builder, true, true); builder.close(); auto slice = builder.slice(); diff --git a/tests/IResearch/IResearchViewNode-test.cpp b/tests/IResearch/IResearchViewNode-test.cpp index f5f16f8ad0..f2e7a7e3e2 100644 --- a/tests/IResearch/IResearchViewNode-test.cpp +++ b/tests/IResearch/IResearchViewNode-test.cpp @@ -1052,7 +1052,7 @@ SECTION("collections") { "\"testCollection2\": { \"includeAllFields\": true }" "}}" ); - CHECK((logicalView->updateProperties(updateJson->slice(), true, false).ok())); + CHECK((logicalView->properties(updateJson->slice(), true).ok())); // dummy query arangodb::aql::Query query( diff --git a/tests/IResearch/StorageEngineMock.cpp b/tests/IResearch/StorageEngineMock.cpp index 15f4913d64..c0cf7125b5 100644 --- a/tests/IResearch/StorageEngineMock.cpp +++ b/tests/IResearch/StorageEngineMock.cpp @@ -1004,7 +1004,7 @@ arangodb::Result StorageEngineMock::changeView( arangodb::velocypack::Builder builder; builder.openObject(); - view.toVelocyPack(builder, true, true); + view.properties(builder, true, true); builder.close(); views[std::make_pair(vocbase.id(), view.id())] = std::move(builder); return {}; @@ -1106,7 +1106,7 @@ arangodb::Result StorageEngineMock::createView( arangodb::velocypack::Builder builder; builder.openObject(); - view.toVelocyPack(builder, true, true); + view.properties(builder, true, true); builder.close(); views[std::make_pair(vocbase.id(), view.id())] = std::move(builder); diff --git a/tests/RestHandler/RestUsersHandler-test.cpp b/tests/RestHandler/RestUsersHandler-test.cpp index 680dcd194c..05af7087dc 100644 --- a/tests/RestHandler/RestUsersHandler-test.cpp +++ b/tests/RestHandler/RestUsersHandler-test.cpp @@ -62,8 +62,8 @@ struct TestView: public arangodb::LogicalView { } virtual arangodb::Result drop() override { return arangodb::Result(); } virtual void open() override {} - virtual arangodb::Result rename(std::string&& newName, bool doSync) override { name(std::move(newName)); return arangodb::Result(); } - virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const& properties, bool partialUpdate, bool doSync) override { _properties = arangodb::velocypack::Builder(properties); return arangodb::Result(); } + virtual arangodb::Result rename(std::string&& newName) override { name(std::move(newName)); return arangodb::Result(); } + virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties, bool partialUpdate) override { _properties = arangodb::velocypack::Builder(properties); return arangodb::Result(); } virtual bool visitCollections(CollectionVisitor const& visitor) const override { return true; } }; diff --git a/tests/RestHandler/RestViewHandler-test.cpp b/tests/RestHandler/RestViewHandler-test.cpp index 9690d43d7b..cb52acc370 100644 --- a/tests/RestHandler/RestViewHandler-test.cpp +++ b/tests/RestHandler/RestViewHandler-test.cpp @@ -52,8 +52,8 @@ struct TestView: public arangodb::LogicalView { } virtual arangodb::Result drop() override { return vocbase().dropView(id(), true); } virtual void open() override {} - virtual arangodb::Result rename(std::string&& newName, bool doSync) override { auto res = vocbase().renameView(id(), newName); name(std::move(newName)); return res; } - virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const& properties, bool partialUpdate, bool doSync) override { _properties = arangodb::velocypack::Builder(properties); return arangodb::Result(); } + virtual arangodb::Result rename(std::string&& newName) override { auto res = vocbase().renameView(id(), newName); name(std::move(newName)); return res; } + virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties, bool partialUpdate) override { _properties = arangodb::velocypack::Builder(properties); return arangodb::Result(); } virtual bool visitCollections(CollectionVisitor const& visitor) const override { return true; } }; diff --git a/tests/Utils/CollectionNameResolver-test.cpp b/tests/Utils/CollectionNameResolver-test.cpp index b3bf0ff545..d9d6eafa75 100644 --- a/tests/Utils/CollectionNameResolver-test.cpp +++ b/tests/Utils/CollectionNameResolver-test.cpp @@ -43,8 +43,8 @@ struct TestView: public arangodb::LogicalView { virtual arangodb::Result appendVelocyPack(arangodb::velocypack::Builder&, bool , bool) const override { return arangodb::Result(); } virtual arangodb::Result drop() override { deleted(true); return vocbase().dropView(id(), true); } virtual void open() override {} - virtual arangodb::Result rename(std::string&& newName, bool doSync) override { name(std::move(newName)); return arangodb::Result(); } - virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const&, bool, bool) override { return arangodb::Result(); } + virtual arangodb::Result rename(std::string&& newName) override { name(std::move(newName)); return arangodb::Result(); } + virtual arangodb::Result properties(arangodb::velocypack::Slice const&, bool) override { return arangodb::Result(); } virtual bool visitCollections(CollectionVisitor const& visitor) const override { return true; } }; diff --git a/tests/V8Server/v8-users-test.cpp b/tests/V8Server/v8-users-test.cpp index 796219dd82..7f11e400c6 100644 --- a/tests/V8Server/v8-users-test.cpp +++ b/tests/V8Server/v8-users-test.cpp @@ -81,8 +81,8 @@ struct TestView: public arangodb::LogicalView { } virtual arangodb::Result drop() override { return arangodb::Result(); } virtual void open() override {} - virtual arangodb::Result rename(std::string&& newName, bool doSync) override { name(std::move(newName)); return arangodb::Result(); } - virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const& properties, bool partialUpdate, bool doSync) override { _properties = arangodb::velocypack::Builder(properties); return arangodb::Result(); } + virtual arangodb::Result rename(std::string&& newName) override { name(std::move(newName)); return arangodb::Result(); } + virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties, bool partialUpdate) override { _properties = arangodb::velocypack::Builder(properties); return arangodb::Result(); } virtual bool visitCollections(CollectionVisitor const& visitor) const override { return true; } }; diff --git a/tests/V8Server/v8-views-test.cpp b/tests/V8Server/v8-views-test.cpp index d49fbe91a6..ecd2c900dd 100644 --- a/tests/V8Server/v8-views-test.cpp +++ b/tests/V8Server/v8-views-test.cpp @@ -79,8 +79,8 @@ struct TestView: public arangodb::LogicalView { } virtual arangodb::Result drop() override { return vocbase().dropView(id(), true); } virtual void open() override {} - virtual arangodb::Result rename(std::string&& newName, bool doSync) override { auto res = vocbase().renameView(id(), newName); name(std::move(newName)); return res; } - virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const& properties, bool partialUpdate, bool doSync) override { _properties = arangodb::velocypack::Builder(properties); return arangodb::Result(); } + virtual arangodb::Result rename(std::string&& newName) override { auto res = vocbase().renameView(id(), newName); name(std::move(newName)); return res; } + virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties, bool partialUpdate) override { _properties = arangodb::velocypack::Builder(properties); return arangodb::Result(); } virtual bool visitCollections(CollectionVisitor const& visitor) const override { return true; } }; diff --git a/tests/VocBase/LogicalDataSource-test.cpp b/tests/VocBase/LogicalDataSource-test.cpp index f3da872678..4e4cef61f0 100644 --- a/tests/VocBase/LogicalDataSource-test.cpp +++ b/tests/VocBase/LogicalDataSource-test.cpp @@ -109,8 +109,8 @@ SECTION("test_category") { } virtual arangodb::Result drop() override { return arangodb::Result(); } virtual void open() override {} - virtual arangodb::Result rename(std::string&& newName, bool doSync) override { return arangodb::Result(); } - virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const& properties, bool partialUpdate, bool doSync) override { return arangodb::Result(); } + virtual arangodb::Result rename(std::string&& newName) override { return arangodb::Result(); } + virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties, bool partialUpdate) override { return arangodb::Result(); } virtual bool visitCollections(CollectionVisitor const& visitor) const override { return true; } }; @@ -143,8 +143,8 @@ SECTION("test_construct") { } virtual arangodb::Result drop() override { return arangodb::Result(); } virtual void open() override {} - virtual arangodb::Result rename(std::string&& newName, bool doSync) override { return arangodb::Result(); } - virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const& properties, bool partialUpdate, bool doSync) override { return arangodb::Result(); } + virtual arangodb::Result rename(std::string&& newName) override { return arangodb::Result(); } + virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties, bool partialUpdate) override { return arangodb::Result(); } virtual bool visitCollections(CollectionVisitor const& visitor) const override { return true; } }; @@ -179,8 +179,8 @@ SECTION("test_defaults") { } virtual arangodb::Result drop() override { return arangodb::Result(); } virtual void open() override {} - virtual arangodb::Result rename(std::string&& newName, bool doSync) override { return arangodb::Result(); } - virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const& properties, bool partialUpdate, bool doSync) override { return arangodb::Result(); } + virtual arangodb::Result rename(std::string&& newName) override { return arangodb::Result(); } + virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties, bool partialUpdate) override { return arangodb::Result(); } virtual bool visitCollections(CollectionVisitor const& visitor) const override { return true; } }; diff --git a/tests/VocBase/vocbase-test.cpp b/tests/VocBase/vocbase-test.cpp index 29b4e489c8..e2913f6751 100644 --- a/tests/VocBase/vocbase-test.cpp +++ b/tests/VocBase/vocbase-test.cpp @@ -44,8 +44,8 @@ struct TestView: public arangodb::LogicalView { virtual arangodb::Result appendVelocyPack(arangodb::velocypack::Builder&, bool , bool) const override { return arangodb::Result(); } virtual arangodb::Result drop() override { deleted(true); return vocbase().dropView(id(), true); } virtual void open() override {} - virtual arangodb::Result rename(std::string&& newName, bool doSync) override { name(std::move(newName)); return arangodb::Result(); } - virtual arangodb::Result updateProperties(arangodb::velocypack::Slice const&, bool, bool) override { return arangodb::Result(); } + virtual arangodb::Result rename(std::string&& newName) override { name(std::move(newName)); return arangodb::Result(); } + virtual arangodb::Result properties(arangodb::velocypack::Slice const&, bool) override { return arangodb::Result(); } virtual bool visitCollections(CollectionVisitor const& visitor) const override { return true; } };