mirror of https://gitee.com/bigwinds/arangodb
some fixes for view handling
This commit is contained in:
parent
c46c52d8c8
commit
e3d8ae142e
|
@ -136,7 +136,7 @@ describe ArangoDB do
|
|||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(true)
|
||||
doc.parsed_response['code'].should eq(404)
|
||||
doc.parsed_response['errorNum'].should eq(1203)
|
||||
doc.parsed_response['errorNum'].should eq(1211)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -151,7 +151,7 @@ describe ArangoDB do
|
|||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(true)
|
||||
doc.parsed_response['code'].should eq(404)
|
||||
doc.parsed_response['errorNum'].should eq(1203)
|
||||
doc.parsed_response['errorNum'].should eq(1211)
|
||||
end
|
||||
|
||||
it "getting properties of a non-existent view" do
|
||||
|
@ -162,7 +162,7 @@ describe ArangoDB do
|
|||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(true)
|
||||
doc.parsed_response['code'].should eq(404)
|
||||
doc.parsed_response['errorNum'].should eq(1203)
|
||||
doc.parsed_response['errorNum'].should eq(1211)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -194,7 +194,7 @@ describe ArangoDB do
|
|||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(true)
|
||||
doc.parsed_response['code'].should eq(404)
|
||||
doc.parsed_response['errorNum'].should eq(1203)
|
||||
doc.parsed_response['errorNum'].should eq(1211)
|
||||
end
|
||||
|
||||
it "modifying a view with unacceptable properties" do
|
||||
|
|
|
@ -176,7 +176,7 @@ arangodb::Result MMFilesCollection::updateProperties(VPackSlice const& slice,
|
|||
return {};
|
||||
}
|
||||
|
||||
arangodb::Result MMFilesCollection::persistProperties() noexcept {
|
||||
arangodb::Result MMFilesCollection::persistProperties() {
|
||||
int res = TRI_ERROR_NO_ERROR;
|
||||
try {
|
||||
VPackBuilder infoBuilder =
|
||||
|
|
|
@ -133,7 +133,7 @@ class MMFilesCollection final : public PhysicalCollection {
|
|||
};
|
||||
|
||||
arangodb::Result updateProperties(VPackSlice const& slice, bool doSync) override;
|
||||
virtual arangodb::Result persistProperties() noexcept override;
|
||||
virtual arangodb::Result persistProperties() override;
|
||||
|
||||
virtual PhysicalCollection* clone(LogicalCollection*, PhysicalCollection*) override;
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "Random/RandomGenerator.h"
|
||||
#include "RestServer/DatabaseFeature.h"
|
||||
#include "RestServer/DatabasePathFeature.h"
|
||||
#include "RestServer/ViewTypesFeature.h"
|
||||
#include "StorageEngine/EngineSelectorFeature.h"
|
||||
#include "VocBase/LogicalCollection.h"
|
||||
#include "VocBase/LogicalView.h"
|
||||
|
@ -628,6 +629,8 @@ int MMFilesEngine::getViews(TRI_vocbase_t* vocbase,
|
|||
VPackBuilder builder = loadViewInfo(vocbase, directory);
|
||||
VPackSlice info = builder.slice();
|
||||
|
||||
LOG_TOPIC(TRACE, Logger::FIXME) << "got view slice: " << info.toJson();
|
||||
|
||||
if (VelocyPackHelper::readBooleanValue(info, "deleted", false)) {
|
||||
std::string name = VelocyPackHelper::getStringValue(info, "name", "");
|
||||
_deleted.emplace_back(std::make_pair(name, directory));
|
||||
|
@ -1397,7 +1400,7 @@ void MMFilesEngine::saveViewInfo(TRI_vocbase_t* vocbase, TRI_voc_cid_t id,
|
|||
view->toVelocyPack(builder, true, true);
|
||||
builder.close();
|
||||
|
||||
TRI_ASSERT(id != 0);
|
||||
LOG_TOPIC(TRACE, Logger::FIXME) << "storing view properties in file '" << filename << "': " << builder.slice().toJson();
|
||||
|
||||
bool ok =
|
||||
VelocyPackHelper::velocyPackToFile(filename, builder.slice(), forceSync);
|
||||
|
@ -1406,7 +1409,7 @@ void MMFilesEngine::saveViewInfo(TRI_vocbase_t* vocbase, TRI_voc_cid_t id,
|
|||
int res = TRI_errno();
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(
|
||||
res,
|
||||
std::string("cannot save collection properties file '") + filename +
|
||||
std::string("cannot save view properties file '") + filename +
|
||||
"': " + TRI_errno_string(res));
|
||||
}
|
||||
}
|
||||
|
@ -1991,17 +1994,31 @@ TRI_vocbase_t* MMFilesEngine::openExistingDatabase(TRI_voc_tick_t id,
|
|||
VPackSlice slice = builder.slice();
|
||||
TRI_ASSERT(slice.isArray());
|
||||
|
||||
ViewTypesFeature* viewTypesFeature =
|
||||
application_features::ApplicationServer::getFeature<ViewTypesFeature>(
|
||||
"ViewTypes");
|
||||
|
||||
for (auto const& it : VPackArrayIterator(slice)) {
|
||||
// we found a view that is still active
|
||||
|
||||
std::string type = it.get("type").copyString();
|
||||
// will throw if type is invalid
|
||||
ViewCreator& creator = viewTypesFeature->creator(type);
|
||||
|
||||
TRI_ASSERT(!it.get("id").isNone());
|
||||
|
||||
std::shared_ptr<LogicalView> view =
|
||||
std::make_shared<arangodb::LogicalView>(vocbase.get(), it);
|
||||
|
||||
StorageEngine::registerView(vocbase.get(), view);
|
||||
|
||||
auto physical = static_cast<MMFilesView*>(view->getPhysical());
|
||||
TRI_ASSERT(physical != nullptr);
|
||||
|
||||
registerViewPath(vocbase->id(), view->id(), physical->path());
|
||||
|
||||
view->spawnImplementation(creator, it);
|
||||
view->getImplementation()->open();
|
||||
}
|
||||
} catch (std::exception const& ex) {
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "error while opening database: "
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "Logger/Logger.h"
|
||||
#include "MMFiles/MMFilesEngine.h"
|
||||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
#include "RestServer/DatabaseFeature.h"
|
||||
#include "StorageEngine/EngineSelectorFeature.h"
|
||||
#include "StorageEngine/StorageEngine.h"
|
||||
#include "Utils/Events.h"
|
||||
|
@ -38,21 +39,8 @@
|
|||
using namespace arangodb;
|
||||
|
||||
static std::string ReadPath(VPackSlice info) {
|
||||
if (!info.isObject()) {
|
||||
// ERROR CASE
|
||||
return "";
|
||||
}
|
||||
VPackSlice physical = info.get("physical");
|
||||
if (physical.isNone()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (physical.isObject()) {
|
||||
VPackSlice path = physical.get("path");
|
||||
if (path.isNone()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (info.isObject()) {
|
||||
VPackSlice path = info.get("path");
|
||||
if (path.isString()) {
|
||||
return path.copyString();
|
||||
}
|
||||
|
@ -95,16 +83,24 @@ void MMFilesView::getPropertiesVPack(velocypack::Builder& result,
|
|||
}
|
||||
|
||||
/// @brief opens an existing view
|
||||
void MMFilesView::open(bool ignoreErrors) {}
|
||||
void MMFilesView::open() {}
|
||||
|
||||
void MMFilesView::drop() {}
|
||||
void MMFilesView::drop() {
|
||||
bool const doSync =
|
||||
application_features::ApplicationServer::getFeature<DatabaseFeature>(
|
||||
"Database")
|
||||
->forceSyncProperties();
|
||||
StorageEngine* engine = EngineSelectorFeature::ENGINE;
|
||||
static_cast<MMFilesEngine*>(engine)->saveViewInfo(_logicalView->vocbase(), _logicalView->id(), _logicalView, doSync);
|
||||
}
|
||||
|
||||
arangodb::Result MMFilesView::updateProperties(VPackSlice const& slice,
|
||||
bool doSync) {
|
||||
// nothing to do here
|
||||
return {};
|
||||
}
|
||||
|
||||
arangodb::Result MMFilesView::persistProperties() noexcept {
|
||||
arangodb::Result MMFilesView::persistProperties() {
|
||||
int res = TRI_ERROR_NO_ERROR;
|
||||
try {
|
||||
VPackBuilder infoBuilder;
|
||||
|
@ -127,7 +123,7 @@ arangodb::Result MMFilesView::persistProperties() noexcept {
|
|||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
// TODO: what to do here
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME)
|
||||
<< "could not save collection view marker in log: "
|
||||
<< "could not save view change marker in log: "
|
||||
<< TRI_errno_string(res);
|
||||
return {res, TRI_errno_string(res)};
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class MMFilesView final : public PhysicalView {
|
|||
|
||||
arangodb::Result updateProperties(VPackSlice const& slice,
|
||||
bool doSync) override;
|
||||
virtual arangodb::Result persistProperties() noexcept override;
|
||||
virtual arangodb::Result persistProperties() override;
|
||||
|
||||
virtual PhysicalView* clone(LogicalView*, PhysicalView*) override;
|
||||
|
||||
|
@ -71,7 +71,7 @@ class MMFilesView final : public PhysicalView {
|
|||
bool includeSystem = false) const override;
|
||||
|
||||
/// @brief opens an existing view
|
||||
void open(bool ignoreErrors) override;
|
||||
void open() override;
|
||||
|
||||
void drop() override;
|
||||
|
||||
|
|
|
@ -148,8 +148,7 @@ void RestViewHandler::modifyView() {
|
|||
std::shared_ptr<LogicalView> view = _vocbase->lookupView(name);
|
||||
if (view == nullptr) {
|
||||
generateError(rest::ResponseCode::NOT_FOUND,
|
||||
TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"could not find view by that name");
|
||||
TRI_ERROR_ARANGO_VIEW_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -209,10 +208,9 @@ void RestViewHandler::deleteView() {
|
|||
|
||||
if (res == TRI_ERROR_NO_ERROR) {
|
||||
generateOk();
|
||||
} else if (res == TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND) {
|
||||
} else if (res == TRI_ERROR_ARANGO_VIEW_NOT_FOUND) {
|
||||
generateError(rest::ResponseCode::NOT_FOUND,
|
||||
TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"could not find view by that name");
|
||||
TRI_ERROR_ARANGO_VIEW_NOT_FOUND);
|
||||
} else {
|
||||
generateError(rest::ResponseCode::SERVER_ERROR, TRI_ERROR_INTERNAL,
|
||||
"problem dropping view");
|
||||
|
@ -280,8 +278,7 @@ void RestViewHandler::getSingleView(std::string const& name) {
|
|||
generateResult(rest::ResponseCode::OK, props.slice());
|
||||
} else {
|
||||
generateError(rest::ResponseCode::NOT_FOUND,
|
||||
TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"could not find view by that name");
|
||||
TRI_ERROR_ARANGO_VIEW_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,7 +293,6 @@ void RestViewHandler::getViewProperties(std::string const& name) {
|
|||
generateResult(rest::ResponseCode::OK, props.slice());
|
||||
} else {
|
||||
generateError(rest::ResponseCode::NOT_FOUND,
|
||||
TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
|
||||
"could not find view by that name");
|
||||
TRI_ERROR_ARANGO_VIEW_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ ViewTypesFeature::ViewTypesFeature(ApplicationServer* server)
|
|||
}
|
||||
|
||||
void ViewTypesFeature::prepare() {
|
||||
// register the "logger" example view type
|
||||
registerViewImplementation(LoggerView::type, LoggerView::creator);
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ static void JS_DropViewVocbase(
|
|||
int res = vocbase->dropView(name);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR &&
|
||||
res != TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND) {
|
||||
res != TRI_ERROR_ARANGO_VIEW_NOT_FOUND) {
|
||||
TRI_V8_THROW_EXCEPTION(res);
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ static void JS_NameViewVocbase(
|
|||
std::string const name(view->name());
|
||||
|
||||
if (name.empty()) {
|
||||
TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
|
||||
TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_VIEW_NOT_FOUND);
|
||||
}
|
||||
|
||||
v8::Handle<v8::Value> result = TRI_V8_STD_STRING(name);
|
||||
|
@ -428,12 +428,6 @@ static void JS_PropertiesViewVocbase(
|
|||
TRI_V8_THROW_EXCEPTION_MESSAGE(updateRes.errorNumber(),
|
||||
updateRes.errorMessage());
|
||||
}
|
||||
|
||||
auto physical = view->getPhysical();
|
||||
TRI_ASSERT(physical != nullptr);
|
||||
arangodb::Result res2 = physical->persistProperties();
|
||||
// TODO Review
|
||||
// TODO API compatibility, for now we ignore if persisting fails...
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,10 +73,12 @@ std::string LoggerView::type("logger");
|
|||
|
||||
std::unique_ptr<ViewImplementation> LoggerView::creator(
|
||||
LogicalView* view, arangodb::velocypack::Slice const& info) {
|
||||
return std::make_unique<LoggerView>(ConstructionGuard(), view, info);
|
||||
LOG_TOPIC(INFO, Logger::FIXME) << "called LoggerView::creator";
|
||||
|
||||
return std::make_unique<LoggerView>(view, info);
|
||||
}
|
||||
|
||||
LoggerView::LoggerView(ConstructionGuard const& guard, LogicalView* logical,
|
||||
LoggerView::LoggerView(LogicalView* logical,
|
||||
arangodb::velocypack::Slice const& info)
|
||||
: ViewImplementation(logical, info) {
|
||||
VPackSlice properties = info.get("properties");
|
||||
|
@ -97,6 +99,9 @@ LoggerView::LoggerView(ConstructionGuard const& guard, LogicalView* logical,
|
|||
|
||||
arangodb::Result LoggerView::updateProperties(
|
||||
arangodb::velocypack::Slice const& slice, bool doSync) {
|
||||
LOG_TOPIC(INFO, Logger::FIXME) << "called LoggerView::updateProperties with data " << slice.toJson()
|
||||
<< ". view data: " << _logicalView->toVelocyPack(true, false).slice().toJson();
|
||||
|
||||
VPackSlice levelSlice = slice.get("level");
|
||||
if (!levelSlice.isString()) {
|
||||
return {TRI_ERROR_BAD_PARAMETER,
|
||||
|
@ -111,12 +116,18 @@ arangodb::Result LoggerView::updateProperties(
|
|||
|
||||
/// @brief export properties
|
||||
void LoggerView::getPropertiesVPack(velocypack::Builder& builder) const {
|
||||
LOG_TOPIC(INFO, Logger::FIXME) << "called LoggerView::getPropertiesVPack";
|
||||
|
||||
TRI_ASSERT(builder.isOpenObject());
|
||||
builder.add("level", VPackValue(LevelEnumToString(_level)));
|
||||
TRI_ASSERT(builder.isOpenObject());
|
||||
}
|
||||
|
||||
/// @brief opens an existing view
|
||||
void LoggerView::open(bool ignoreErrors) {}
|
||||
void LoggerView::open() {
|
||||
LOG_TOPIC(INFO, Logger::FIXME) << "called LoggerView::open. view data: " << _logicalView->toVelocyPack(true, false).slice().toJson();
|
||||
}
|
||||
|
||||
void LoggerView::drop() {}
|
||||
void LoggerView::drop() {
|
||||
LOG_TOPIC(INFO, Logger::FIXME) << "called LoggerView::drop. view data: " << _logicalView->toVelocyPack(true, false).slice().toJson();
|
||||
}
|
||||
|
|
|
@ -42,37 +42,27 @@ class LoggerView final : public ViewImplementation {
|
|||
static std::unique_ptr<ViewImplementation> creator(
|
||||
LogicalView*, arangodb::velocypack::Slice const&);
|
||||
|
||||
private:
|
||||
struct ConstructionGuard {
|
||||
ConstructionGuard() {}
|
||||
};
|
||||
|
||||
public:
|
||||
LoggerView(ConstructionGuard const& guard, LogicalView* logical,
|
||||
LoggerView(LogicalView* logical,
|
||||
arangodb::velocypack::Slice const& info);
|
||||
~LoggerView() = default;
|
||||
|
||||
arangodb::Result updateProperties(arangodb::velocypack::Slice const& slice,
|
||||
bool doSync);
|
||||
arangodb::Result persistProperties() noexcept;
|
||||
bool doSync) override;
|
||||
|
||||
/// @brief export properties
|
||||
void getPropertiesVPack(velocypack::Builder&) const;
|
||||
void getPropertiesVPack(velocypack::Builder&) const override;
|
||||
|
||||
/// @brief opens an existing view
|
||||
void open(bool ignoreErrors);
|
||||
void open() override;
|
||||
|
||||
void drop();
|
||||
void drop() override;
|
||||
|
||||
protected:
|
||||
LogicalView* _logicalView;
|
||||
private:
|
||||
// example data
|
||||
arangodb::LogLevel _level;
|
||||
};
|
||||
|
||||
typedef std::function<std::unique_ptr<ViewImplementation>(
|
||||
LogicalView*, arangodb::velocypack::Slice const&)>
|
||||
ViewCreator;
|
||||
|
||||
} // namespace arangodb
|
||||
|
||||
#endif
|
||||
|
|
|
@ -182,14 +182,27 @@ bool LogicalView::deleted() const { return _isDeleted; }
|
|||
void LogicalView::setDeleted(bool newValue) { _isDeleted = newValue; }
|
||||
|
||||
void LogicalView::drop() {
|
||||
TRI_ASSERT(!ServerState::instance()->isCoordinator());
|
||||
StorageEngine* engine = EngineSelectorFeature::ENGINE;
|
||||
engine->destroyView(_vocbase, this);
|
||||
_isDeleted = true;
|
||||
|
||||
if (getImplementation() != nullptr) {
|
||||
getImplementation()->drop();
|
||||
}
|
||||
|
||||
TRI_ASSERT(!ServerState::instance()->isCoordinator());
|
||||
//StorageEngine* engine = EngineSelectorFeature::ENGINE;
|
||||
//engine->destroyView(_vocbase, this);
|
||||
|
||||
_physical->drop();
|
||||
}
|
||||
|
||||
VPackBuilder LogicalView::toVelocyPack(bool includeProperties, bool includeSystem) const {
|
||||
VPackBuilder builder;
|
||||
builder.openObject();
|
||||
toVelocyPack(builder, includeProperties, includeSystem);
|
||||
builder.close();
|
||||
return builder;
|
||||
}
|
||||
|
||||
void LogicalView::toVelocyPack(VPackBuilder& result, bool includeProperties,
|
||||
bool includeSystem) const {
|
||||
// We write into an open object
|
||||
|
@ -204,9 +217,7 @@ void LogicalView::toVelocyPack(VPackBuilder& result, bool includeProperties,
|
|||
result.add("planId", VPackValue(std::to_string(_planId)));
|
||||
if (getPhysical() != nullptr) {
|
||||
// Physical Information
|
||||
result.add("physical", VPackValue(VPackValueType::Object));
|
||||
getPhysical()->getPropertiesVPack(result, includeSystem);
|
||||
result.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,6 +235,8 @@ arangodb::Result LogicalView::updateProperties(VPackSlice const& slice,
|
|||
bool doSync) {
|
||||
WRITE_LOCKER(writeLocker, _infoLock);
|
||||
|
||||
TRI_ASSERT(getImplementation() != nullptr);
|
||||
|
||||
// the implementation may filter/change/react to the changes
|
||||
arangodb::Result implResult =
|
||||
getImplementation()->updateProperties(slice, doSync);
|
||||
|
@ -243,10 +256,10 @@ arangodb::Result LogicalView::updateProperties(VPackSlice const& slice,
|
|||
/// This should be called AFTER the view is successfully
|
||||
/// created and only on Single/DBServer
|
||||
void LogicalView::persistPhysicalView() {
|
||||
// Coordinators are not allowed to have local collections!
|
||||
// Coordinators are not allowed to have local views!
|
||||
TRI_ASSERT(!ServerState::instance()->isCoordinator());
|
||||
|
||||
// We have not yet persisted this collection!
|
||||
// We have not yet persisted this view
|
||||
TRI_ASSERT(getPhysical()->path().empty());
|
||||
StorageEngine* engine = EngineSelectorFeature::ENGINE;
|
||||
engine->createView(_vocbase, _id, this);
|
||||
|
|
|
@ -80,6 +80,8 @@ class LogicalView {
|
|||
void drop();
|
||||
|
||||
// SECTION: Serialization
|
||||
VPackBuilder toVelocyPack(bool includeProperties = false, bool includeSystem = false) const;
|
||||
|
||||
void toVelocyPack(velocypack::Builder&, bool includeProperties = false,
|
||||
bool includeSystem = false) const;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class PhysicalCollection {
|
|||
// creation happens atm in engine->createCollection
|
||||
virtual arangodb::Result updateProperties(
|
||||
arangodb::velocypack::Slice const& slice, bool doSync) = 0;
|
||||
virtual arangodb::Result persistProperties() noexcept = 0;
|
||||
virtual arangodb::Result persistProperties() = 0;
|
||||
|
||||
virtual PhysicalCollection* clone(LogicalCollection*, PhysicalCollection*) = 0;
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ class PhysicalView {
|
|||
public:
|
||||
virtual ~PhysicalView() = default;
|
||||
|
||||
// path to logical collection
|
||||
// path to logical view
|
||||
virtual std::string const& path() const = 0;
|
||||
virtual void setPath(std::string const&) = 0;
|
||||
virtual arangodb::Result updateProperties(
|
||||
arangodb::velocypack::Slice const& slice, bool doSync) = 0;
|
||||
virtual arangodb::Result persistProperties() noexcept = 0;
|
||||
virtual arangodb::Result persistProperties() = 0;
|
||||
|
||||
virtual PhysicalView* clone(LogicalView*, PhysicalView*) = 0;
|
||||
|
||||
|
@ -56,7 +56,7 @@ class PhysicalView {
|
|||
bool includeSystem = false) const = 0;
|
||||
|
||||
/// @brief opens an existing view
|
||||
virtual void open(bool ignoreErrors) = 0;
|
||||
virtual void open() = 0;
|
||||
|
||||
virtual void drop() = 0;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class ViewImplementation {
|
|||
virtual void getPropertiesVPack(velocypack::Builder&) const = 0;
|
||||
|
||||
/// @brief opens an existing view
|
||||
virtual void open(bool ignoreErrors) = 0;
|
||||
virtual void open() = 0;
|
||||
|
||||
virtual void drop() = 0;
|
||||
|
||||
|
|
|
@ -1340,7 +1340,7 @@ int TRI_vocbase_t::dropView(std::string const& name) {
|
|||
std::shared_ptr<LogicalView> view = lookupView(name);
|
||||
|
||||
if (view == nullptr) {
|
||||
return TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND;
|
||||
return TRI_ERROR_ARANGO_VIEW_NOT_FOUND;
|
||||
}
|
||||
|
||||
return dropView(view);
|
||||
|
@ -1389,7 +1389,8 @@ int TRI_vocbase_t::dropView(std::shared_ptr<arangodb::LogicalView> view) {
|
|||
arangodb::aql::PlanCache::instance()->invalidate(this);
|
||||
arangodb::aql::QueryCache::instance()->invalidate(this);
|
||||
|
||||
view->setDeleted(true);
|
||||
view->drop();
|
||||
/*
|
||||
VPackBuilder b;
|
||||
b.openObject();
|
||||
view->toVelocyPack(b, true, true);
|
||||
|
@ -1400,7 +1401,7 @@ int TRI_vocbase_t::dropView(std::shared_ptr<arangodb::LogicalView> view) {
|
|||
"Database")
|
||||
->forceSyncProperties();
|
||||
view->updateProperties(b.slice(), doSync);
|
||||
|
||||
*/
|
||||
unregisterView(view);
|
||||
|
||||
StorageEngine* engine = EngineSelectorFeature::ENGINE;
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
"ERROR_ARANGO_ILLEGAL_NAME" : { "code" : 1208, "message" : "illegal name" },
|
||||
"ERROR_ARANGO_NO_INDEX" : { "code" : 1209, "message" : "no suitable index known" },
|
||||
"ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED" : { "code" : 1210, "message" : "unique constraint violated" },
|
||||
"ERROR_ARANGO_VIEW_NOT_FOUND" : { "code" : 1211, "message" : "view not found" },
|
||||
"ERROR_ARANGO_INDEX_NOT_FOUND" : { "code" : 1212, "message" : "index not found" },
|
||||
"ERROR_ARANGO_CROSS_COLLECTION_REQUEST" : { "code" : 1213, "message" : "cross collection request not allowed" },
|
||||
"ERROR_ARANGO_INDEX_HANDLE_BAD" : { "code" : 1214, "message" : "illegal index handle" },
|
||||
|
|
|
@ -92,7 +92,7 @@ ERROR_ARANGO_SYNC_TIMEOUT,1111,"sync timeout","Will be raised when the server wa
|
|||
ERROR_ARANGO_CONFLICT,1200,"conflict","Will be raised when updating or deleting a document and a conflict has been detected."
|
||||
ERROR_ARANGO_DATADIR_INVALID,1201,"invalid database directory","Will be raised when a non-existing database directory was specified when starting the database."
|
||||
ERROR_ARANGO_DOCUMENT_NOT_FOUND,1202,"document not found","Will be raised when a document with a given identifier or handle is unknown."
|
||||
ERROR_ARANGO_COLLECTION_NOT_FOUND,1203,"collection not found","Will be raised when a collection with a given identifier or name is unknown."
|
||||
ERROR_ARANGO_COLLECTION_NOT_FOUND,1203,"collection not found","Will be raised when a collection with the given identifier or name is unknown."
|
||||
ERROR_ARANGO_COLLECTION_PARAMETER_MISSING,1204,"parameter 'collection' not found","Will be raised when the collection parameter is missing."
|
||||
ERROR_ARANGO_DOCUMENT_HANDLE_BAD,1205,"illegal document handle","Will be raised when a document handle is corrupt."
|
||||
ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL,1206,"maximal size of journal too small","Will be raised when the maximal size of the journal is too small."
|
||||
|
@ -100,6 +100,7 @@ ERROR_ARANGO_DUPLICATE_NAME,1207,"duplicate name","Will be raised when a name du
|
|||
ERROR_ARANGO_ILLEGAL_NAME,1208,"illegal name","Will be raised when an illegal name is detected."
|
||||
ERROR_ARANGO_NO_INDEX,1209,"no suitable index known","Will be raised when no suitable index for the query is known."
|
||||
ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED,1210,"unique constraint violated","Will be raised when there is a unique constraint violation."
|
||||
ERROR_ARANGO_VIEW_NOT_FOUND,1211,"view not found","Will be raised when a view with the given identifier or name is unknown."
|
||||
ERROR_ARANGO_INDEX_NOT_FOUND,1212,"index not found","Will be raised when an index with a given identifier is unknown."
|
||||
ERROR_ARANGO_CROSS_COLLECTION_REQUEST,1213,"cross collection request not allowed","Will be raised when a cross-collection is requested."
|
||||
ERROR_ARANGO_INDEX_HANDLE_BAD,1214,"illegal index handle","Will be raised when a index handle is corrupt."
|
||||
|
|
|
@ -76,6 +76,7 @@ void TRI_InitializeErrorMessages () {
|
|||
REG_ERROR(ERROR_ARANGO_ILLEGAL_NAME, "illegal name");
|
||||
REG_ERROR(ERROR_ARANGO_NO_INDEX, "no suitable index known");
|
||||
REG_ERROR(ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED, "unique constraint violated");
|
||||
REG_ERROR(ERROR_ARANGO_VIEW_NOT_FOUND, "view not found");
|
||||
REG_ERROR(ERROR_ARANGO_INDEX_NOT_FOUND, "index not found");
|
||||
REG_ERROR(ERROR_ARANGO_CROSS_COLLECTION_REQUEST, "cross collection request not allowed");
|
||||
REG_ERROR(ERROR_ARANGO_INDEX_HANDLE_BAD, "illegal index handle");
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
/// Will be raised when a document with a given identifier or handle is
|
||||
/// unknown.
|
||||
/// - 1203: @LIT{collection not found}
|
||||
/// Will be raised when a collection with a given identifier or name is
|
||||
/// Will be raised when a collection with the given identifier or name is
|
||||
/// unknown.
|
||||
/// - 1204: @LIT{parameter 'collection' not found}
|
||||
/// Will be raised when the collection parameter is missing.
|
||||
|
@ -164,6 +164,8 @@
|
|||
/// Will be raised when no suitable index for the query is known.
|
||||
/// - 1210: @LIT{unique constraint violated}
|
||||
/// Will be raised when there is a unique constraint violation.
|
||||
/// - 1211: @LIT{view not found}
|
||||
/// Will be raised when a view with the given identifier or name is unknown.
|
||||
/// - 1212: @LIT{index not found}
|
||||
/// Will be raised when an index with a given identifier is unknown.
|
||||
/// - 1213: @LIT{cross collection request not allowed}
|
||||
|
@ -1311,7 +1313,8 @@ void TRI_InitializeErrorMessages ();
|
|||
///
|
||||
/// collection not found
|
||||
///
|
||||
/// Will be raised when a collection with a given identifier or name is unknown.
|
||||
/// Will be raised when a collection with the given identifier or name is
|
||||
/// unknown.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND (1203)
|
||||
|
@ -1386,6 +1389,16 @@ void TRI_InitializeErrorMessages ();
|
|||
|
||||
#define TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED (1210)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1211: ERROR_ARANGO_VIEW_NOT_FOUND
|
||||
///
|
||||
/// view not found
|
||||
///
|
||||
/// Will be raised when a view with the given identifier or name is unknown.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TRI_ERROR_ARANGO_VIEW_NOT_FOUND (1211)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief 1212: ERROR_ARANGO_INDEX_NOT_FOUND
|
||||
///
|
||||
|
|
|
@ -420,6 +420,7 @@ rest::ResponseCode GeneralResponse::responseCode(int code) {
|
|||
|
||||
case TRI_ERROR_ARANGO_DATABASE_NOT_FOUND:
|
||||
case TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND:
|
||||
case TRI_ERROR_ARANGO_VIEW_NOT_FOUND:
|
||||
case TRI_ERROR_ARANGO_COLLECTION_NOT_LOADED:
|
||||
case TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND:
|
||||
case TRI_ERROR_ARANGO_ENDPOINT_NOT_FOUND:
|
||||
|
|
Loading…
Reference in New Issue