1
0
Fork 0
This commit is contained in:
Frank Celler 2016-04-03 13:48:25 +02:00
parent 5da239ac1e
commit 09da78e444
18 changed files with 439 additions and 476 deletions

View File

@ -22,6 +22,7 @@
////////////////////////////////////////////////////////////////////////////////
#include "Aql/Query.h"
#include "Aql/ExecutionBlock.h"
#include "Aql/ExecutionEngine.h"
#include "Aql/ExecutionPlan.h"
@ -42,8 +43,9 @@
#include "Utils/StandaloneTransactionContext.h"
#include "Utils/V8TransactionContext.h"
#include "V8/v8-conv.h"
#include "VocBase/vocbase.h"
#include "V8Server/V8DealerFeature.h"
#include "VocBase/Graphs.h"
#include "VocBase/vocbase.h"
using namespace arangodb;
using namespace arangodb::aql;
@ -270,8 +272,7 @@ Query::~Query() {
ctx->unregisterTransaction();
}
#warning TODO
// _applicationV8->exitContext(_context);
V8DealerFeature::DEALER->exitContext(_context);
_context = nullptr;
}
@ -1153,8 +1154,7 @@ char* Query::registerEscapedString(char const* p, size_t length,
void Query::enterContext() {
if (!_contextOwnedByExterior) {
if (_context == nullptr) {
#warning TODO
// _context = _applicationV8->enterContext(_vocbase, false);
_context = V8DealerFeature::DEALER->enterContext(_vocbase, false);
if (_context == nullptr) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
@ -1193,8 +1193,7 @@ void Query::exitContext() {
ctx->unregisterTransaction();
}
#warning TODO
// _applicationV8->exitContext(_context);
V8DealerFeature::DEALER->exitContext(_context);
_context = nullptr;
}
TRI_ASSERT(_context == nullptr);

View File

@ -54,7 +54,6 @@
#include "Cluster/RestShardHandler.h"
// #include "Dispatcher/ApplicationDispatcher.h"
#include "Dispatcher/Dispatcher.h"
#include "HttpServer/ApplicationEndpointServer.h"
#include "HttpServer/AsyncJobManager.h"
#include "HttpServer/HttpHandlerFactory.h"
#include "Rest/InitializeRest.h"
@ -216,17 +215,6 @@ void ArangoServer::buildApplicationServer() {
#warning TODO
#if 0
// ...........................................................................
// create QueryRegistry
// ...........................................................................
_queryRegistry = new aql::QueryRegistry();
_server->_queryRegistry = _queryRegistry;
// .............................................................................
// V8 engine
// .............................................................................
// .............................................................................
// define server options
// .............................................................................
@ -237,14 +225,12 @@ void ArangoServer::buildApplicationServer() {
additional["General Options:help-default"](
"console",
"do not start as server, start a JavaScript emergency console instead")(
"upgrade", "perform a database upgrade")(
// .............................................................................
// set language of default collator
// .............................................................................
// other options
additional["Hidden Options"]("no-upgrade", "skip a database upgrade")(
"start-service", "used to start as windows service")(
"no-server", "do not start the server, if console is requested")(
"use-thread-affinity", &_threadAffinity,
@ -267,24 +253,14 @@ void ArangoServer::buildApplicationServer() {
// database options
// .............................................................................
additional["Database Options:help-admin"](
"database.directory", &_databasePath, "path to the database directory")(
"database.maximal-journal-size", &_defaultMaximalSize,
"default maximal journal size, can be overwritten when creating a "
"collection")("database.wait-for-sync", &_defaultWaitForSync,
"default wait-for-sync behavior, can be overwritten when "
"creating a collection")(
"database.force-sync-properties", &_forceSyncProperties,
"force syncing of collection properties to disk, will use waitForSync "
"value of collection when turned off")(
(
"database.ignore-datafile-errors", &_ignoreDatafileErrors,
"load collections even if datafiles may contain errors")(
"database.disable-query-tracking", &_disableQueryTracking,
"turn off AQL query tracking by default")(
"database.query-cache-mode", &_queryCacheMode,
"mode for the AQL query cache (on, off, demand)")(
"database.query-cache-max-results", &_queryCacheMaxResults,
"maximum number of results in query cache per database")(
"load collections even if datafiles may contain errors")
(
(
"database.throw-collection-not-loaded-error",
&_throwCollectionNotLoadedError,
"throw an error when accessing a collection that is still loading");

View File

@ -23,13 +23,16 @@
#include "DatabaseFeature.h"
#include "ApplicationFeatures/LoggerFeature.h"
#include "Aql/QueryRegistry.h"
#include "Basics/StringUtils.h"
#include "Basics/ThreadPool.h"
#include "Cluster/v8-cluster.h"
#include "Logger/Logger.h"
#include "ProgramOptions/ProgramOptions.h"
#include "ProgramOptions/Section.h"
#include "V8Server/V8Context.h"
#include "V8Server/V8DealerFeature.h"
#include "V8Server/v8-query.h"
#include "V8Server/v8-vocbase.h"
#include "VocBase/KeyGenerator.h"
#include "VocBase/server.h"
@ -49,11 +52,14 @@ DatabaseFeature::DatabaseFeature(ApplicationServer* server)
_queryCacheMode("off"),
_queryCacheEntries(128),
_checkVersion(false),
_upgrade(false),
_skipUpgrade(false),
_indexThreads(2),
_defaultWaitForSync(false),
_forceSyncProperties(true),
_vocbase(nullptr),
_server(nullptr) {
_server(nullptr),
_replicationApplier(true) {
setOptional(false);
requiresElevatedPrivileges(false);
startsAfter("Language");
@ -92,6 +98,12 @@ void DatabaseFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
"checks the versions of the database and exit",
new BooleanParameter(&_checkVersion, false));
options->addOption("--database.upgrade", "perform a database upgrade",
new BooleanParameter(&_upgrade));
options->addHiddenOption("--database.skip-upgrade", "skip a database upgrade",
new BooleanParameter(&_skipUpgrade));
options->addHiddenOption(
"--database.index-threads",
"threads to start for parallel background index creation",
@ -114,9 +126,9 @@ void DatabaseFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
void DatabaseFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
if (_directory.empty()) {
LOG(FATAL) << "no database path has been supplied, giving up, please use "
"the '--database.directory' option";
FATAL_ERROR_EXIT();
LOG(ERR) << "no database path has been supplied, giving up, please use "
"the '--database.directory' option";
abortInvalidParameters();
}
// strip trailing separators
@ -128,10 +140,26 @@ void DatabaseFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
}
if (_maximalJournalSize < TRI_JOURNAL_MINIMAL_SIZE) {
LOG(FATAL) << "invalid value for '--database.maximal-journal-size'. "
"expected at least "
<< TRI_JOURNAL_MINIMAL_SIZE;
FATAL_ERROR_EXIT();
LOG(ERR) << "invalid value for '--database.maximal-journal-size'. "
"expected at least "
<< TRI_JOURNAL_MINIMAL_SIZE;
abortInvalidParameters();
}
if (_checkVersion && _upgrade) {
LOG(ERR) << "cannot specify both '--database.check-version' and "
"'--database.upgrade'";
abortInvalidParameters();
}
if (_checkVersion || _upgrade) {
_replicationApplier = false;
}
if (_upgrade && _skipUpgrade) {
LOG(ERR) << "cannot specify both '--database.upgrade' and "
"'--database.skip-upgrade'";
abortInvalidParameters();
}
if (_checkVersion) {
@ -155,32 +183,15 @@ void DatabaseFeature::start() {
TRI_InitServerGlobals();
_server = new TRI_server_t();
// initialize the server's write ahead log
// create the query registery
_queryRegistry = new aql::QueryRegistry();
_server->_queryRegistry = _queryRegistry;
// start the WAL manager (but do not open it yet)
LOG(TRACE) << "starting WAL logfile manager";
wal::LogfileManager::initialize(&_databasePath, _server);
// check the version and exit
if (_checkVersion) {
checkVersion();
}
#if 0
// special treatment for the write-ahead log
// the log must exist before all other server operations can start
LOG(TRACE) << "starting WAL logfile manager";
if (!wal::LogfileManager::instance()->prepare() ||
!wal::LogfileManager::instance()->start()) {
// unable to initialize & start WAL logfile manager
LOG(FATAL) << "unable to start WAL logfile manager";
FATAL_ERROR_EXIT();
}
#endif
}
void DatabaseFeature::checkVersion() {
LOG(TRACE) << "starting WAL logfile manager";
if (!wal::LogfileManager::instance()->prepare() ||
!wal::LogfileManager::instance()->start()) {
// unable to initialize & start WAL logfile manager
@ -191,12 +202,22 @@ void DatabaseFeature::checkVersion() {
KeyGenerator::Initialize();
// open all databases
bool const iterateMarkersOnOpen =
!wal::LogfileManager::instance()->hasFoundLastTick();
openDatabases();
openDatabases(true, false, iterateMarkersOnOpen);
// fetch the system database and update the contexts
updateContexts();
// fetch the system database
// check the version and exit
if (_checkVersion) {
checkVersion();
FATAL_ERROR_EXIT();
}
// upgrade the database
upgradeDatabase();
}
void DatabaseFeature::updateContexts() {
_vocbase = TRI_UseDatabaseServer(_server, TRI_VOC_SYSTEM_DATABASE);
if (_vocbase == nullptr) {
@ -205,23 +226,46 @@ void DatabaseFeature::checkVersion() {
FATAL_ERROR_EXIT();
}
#warning TODO fixe queryregistry / _startupLoader
LOG(WARN) << "HERE";
{
aql::QueryRegistry* queryRegistry = nullptr;
auto server = _server;
auto vocbase = _vocbase;
auto queryRegistry = _queryRegistry;
auto server = _server;
auto vocbase = _vocbase;
V8DealerFeature::DEALER->updateContexts(
[&queryRegistry, &server, &vocbase](
v8::Isolate* isolate, v8::Handle<v8::Context> context, size_t i) {
TRI_InitV8VocBridge(isolate, context, queryRegistry, server,
vocbase, i);
}, vocbase);
}
V8DealerFeature::DEALER->updateContexts(
[&queryRegistry, &server, &vocbase](
v8::Isolate* isolate, v8::Handle<v8::Context> context, size_t i) {
TRI_InitV8VocBridge(isolate, context, queryRegistry, server, vocbase,
i);
TRI_InitV8Queries(isolate, context);
TRI_InitV8Cluster(isolate, context);
},
vocbase);
V8DealerFeature::DEALER->loadJavascript(_vocbase);
}
void DatabaseFeature::shutdownCompactor() {
auto unuser = _server->_databasesProtector.use();
auto theLists = _server->_databasesLists.load();
for (auto& p : theLists->_databases) {
TRI_vocbase_t* vocbase = p.second;
vocbase->_state = 2;
int res = TRI_ERROR_NO_ERROR;
res |= TRI_StopCompactorVocBase(vocbase);
vocbase->_state = 3;
res |= TRI_JoinThread(&vocbase->_cleanup);
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "unable to join database threads for database '"
<< vocbase->_name << "'";
}
}
}
void DatabaseFeature::checkVersion() {
// run version check
int result = 1;
LOG(TRACE) << "starting version check";
@ -234,33 +278,36 @@ void DatabaseFeature::checkVersion() {
auto localContext =
v8::Local<v8::Context>::New(context->_isolate, context->_context);
localContext->Enter();
v8::Context::Scope contextScope(localContext);
auto startupLoader = V8DealerFeature::DEALER->startupLoader();
// run upgrade script
LOG(DEBUG) << "running database version check";
{
v8::Context::Scope contextScope(localContext);
// can do this without a lock as this is the startup
auto unuser = _server->_databasesProtector.use();
auto theLists = _server->_databasesLists.load();
// run version-check script
LOG(DEBUG) << "running database version check";
for (auto& p : theLists->_databases) {
TRI_vocbase_t* vocbase = p.second;
// can do this without a lock as this is the startup
auto unuser = _server->_databasesProtector.use();
auto theLists = _server->_databasesLists.load();
// special check script to be run just once in first thread (not in all)
// but for all databases
for (auto& p : theLists->_databases) {
TRI_vocbase_t* vocbase = p.second;
int status =
TRI_CheckDatabaseVersion(vocbase, startupLoader, localContext);
// special check script to be run just once in first thread (not in all)
// but for all databases
if (status < 0) {
LOG(FATAL) << "Database version check failed for '" << vocbase->_name
<< "'. Please inspect the logs from any errors";
FATAL_ERROR_EXIT();
} else if (status == 3) {
result = 3;
} else if (status == 2 && result == 1) {
result = 2;
int status = TRI_CheckDatabaseVersion(vocbase, localContext);
LOG(DEBUG) << "version check return status " << status;
if (status < 0) {
LOG(FATAL) << "Database version check failed for '" << vocbase->_name
<< "'. Please inspect the logs from any errors";
FATAL_ERROR_EXIT();
} else if (status == 3) {
result = 3;
} else if (status == 2 && result == 1) {
result = 2;
}
}
}
@ -271,27 +318,7 @@ void DatabaseFeature::checkVersion() {
}
// regular shutdown... wait for all threads to finish
{
auto unuser = _server->_databasesProtector.use();
auto theLists = _server->_databasesLists.load();
for (auto& p : theLists->_databases) {
TRI_vocbase_t* vocbase = p.second;
vocbase->_state = 2;
int res = TRI_ERROR_NO_ERROR;
res |= TRI_StopCompactorVocBase(vocbase);
vocbase->_state = 3;
res |= TRI_JoinThread(&vocbase->_cleanup);
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "unable to join database threads for database '"
<< vocbase->_name << "'";
}
}
}
shutdownCompactor();
if (result == 1) {
TRI_EXIT_FUNCTION(EXIT_SUCCESS, nullptr);
@ -300,8 +327,90 @@ void DatabaseFeature::checkVersion() {
}
}
void DatabaseFeature::openDatabases(bool checkVersion, bool performUpgrade,
bool iterateMarkersOnOpen) {
void DatabaseFeature::upgradeDatabase() {
LOG(TRACE) << "starting database init/upgrade";
// enter context and isolate
{
V8Context* context =
V8DealerFeature::DEALER->enterContext(_vocbase, true, 0);
v8::HandleScope scope(context->_isolate);
auto localContext =
v8::Local<v8::Context>::New(context->_isolate, context->_context);
localContext->Enter();
{
v8::Context::Scope contextScope(localContext);
// run upgrade script
if (!_skipUpgrade) {
LOG(DEBUG) << "running database init/upgrade";
auto unuser(_server->_databasesProtector.use());
auto theLists = _server->_databasesLists.load();
for (auto& p : theLists->_databases) {
TRI_vocbase_t* vocbase = p.second;
// special check script to be run just once in first thread (not in
// all) but for all databases
v8::HandleScope scope(context->_isolate);
v8::Handle<v8::Object> args = v8::Object::New(context->_isolate);
args->Set(TRI_V8_ASCII_STRING2(context->_isolate, "upgrade"),
v8::Boolean::New(context->_isolate, _upgrade));
localContext->Global()->Set(
TRI_V8_ASCII_STRING2(context->_isolate, "UPGRADE_ARGS"), args);
bool ok = TRI_UpgradeDatabase(vocbase, localContext);
if (!ok) {
if (localContext->Global()->Has(TRI_V8_ASCII_STRING2(
context->_isolate, "UPGRADE_STARTED"))) {
localContext->Exit();
if (_upgrade) {
LOG(FATAL) << "Database '" << vocbase->_name
<< "' upgrade failed. Please inspect the logs from "
"the upgrade procedure";
FATAL_ERROR_EXIT();
} else {
LOG(FATAL)
<< "Database '" << vocbase->_name
<< "' needs upgrade. Please start the server with the "
"--upgrade option";
FATAL_ERROR_EXIT();
}
} else {
LOG(FATAL) << "JavaScript error during server start";
FATAL_ERROR_EXIT();
}
LOG(DEBUG) << "database '" << vocbase->_name
<< "' init/upgrade done";
}
}
}
}
// finally leave the context. otherwise v8 will crash with assertion failure
// when we delete
// the context locker below
localContext->Exit();
V8DealerFeature::DEALER->exitContext(context);
}
if (_upgrade) {
LOG(INFO) << "database upgrade passed";
shutdownCompactor();
TRI_EXIT_FUNCTION(EXIT_SUCCESS, nullptr);
}
// and return from the context
LOG(TRACE) << "finished database init/upgrade";
}
void DatabaseFeature::openDatabases() {
TRI_vocbase_defaults_t defaults;
// override with command-line options
@ -323,22 +432,24 @@ void DatabaseFeature::openDatabases(bool checkVersion, bool performUpgrade,
_indexPool.reset(new ThreadPool(_indexThreads, "IndexBuilder"));
}
#warning appPathm and _disableReplicationApplier
bool _disableReplicationApplier = false;
#warning appPathm
int res = TRI_InitServer(_server, _indexPool.get(), _databasePath.c_str(),
nullptr, &defaults, _disableReplicationApplier,
iterateMarkersOnOpen);
bool const iterateMarkersOnOpen =
!wal::LogfileManager::instance()->hasFoundLastTick();
int res =
TRI_InitServer(_server, _indexPool.get(), _databasePath.c_str(), nullptr,
&defaults, !_replicationApplier, iterateMarkersOnOpen);
if (res != TRI_ERROR_NO_ERROR) {
LOG(FATAL) << "cannot create server instance: out of memory";
FATAL_ERROR_EXIT();
}
res = TRI_StartServer(_server, checkVersion, performUpgrade);
res = TRI_StartServer(_server, _checkVersion, _upgrade);
if (res != TRI_ERROR_NO_ERROR) {
if (checkVersion && res == TRI_ERROR_ARANGO_EMPTY_DATADIR) {
if (_checkVersion && res == TRI_ERROR_ARANGO_EMPTY_DATADIR) {
TRI_EXIT_FUNCTION(EXIT_SUCCESS, nullptr);
}
@ -367,11 +478,6 @@ void DatabaseFeature::openDatabases(bool checkVersion, bool performUpgrade,
}
// skip an upgrade even if VERSION is missing
bool skipUpgrade = false;
if (_applicationServer->programOptions().has("no-upgrade")) {
skipUpgrade = true;
}
// .............................................................................
// prepare the various parts of the Arango server
@ -383,7 +489,7 @@ void DatabaseFeature::openDatabases(bool checkVersion, bool performUpgrade,
bool const iterateMarkersOnOpen =
!wal::LogfileManager::instance()->hasFoundLastTick();
openDatabases(checkVersion, performUpgrade, iterateMarkersOnOpen);
openDatabases(checkVersion, performUpgraden, iterateMarkersOnOpen);
if (!checkVersion) {
if (!wal::LogfileManager::instance()->open()) {

View File

@ -33,6 +33,10 @@ namespace basics {
class ThreadPool;
}
namespace aql {
class QueryRegistry;
}
class DatabaseFeature final : public application_features::ApplicationFeature {
public:
explicit DatabaseFeature(application_features::ApplicationServer* server);
@ -52,19 +56,26 @@ class DatabaseFeature final : public application_features::ApplicationFeature {
std::string _queryCacheMode;
uint64_t _queryCacheEntries;
bool _checkVersion;
bool _upgrade;
bool _skipUpgrade;
uint64_t _indexThreads;
bool _defaultWaitForSync;
bool _forceSyncProperties;
private:
void checkVersion();
void openDatabases(bool, bool, bool);
void openDatabases();
void upgradeDatabase();
void updateContexts();
void shutdownCompactor();
private:
TRI_vocbase_t* _vocbase;
TRI_server_t* _server;
aql::QueryRegistry* _queryRegistry;
std::string _databasePath;
std::unique_ptr<basics::ThreadPool> _indexPool;
bool _replicationApplier;
};
}

View File

@ -82,8 +82,6 @@ CollectionKeys::~CollectionKeys() {
////////////////////////////////////////////////////////////////////////////////
void CollectionKeys::create(TRI_voc_tick_t maxTick) {
#warning TODO
#if 0
arangodb::wal::LogfileManager::instance()->waitForCollectorQueue(
_document->_info.id(), 30.0);
@ -159,7 +157,6 @@ void CollectionKeys::create(TRI_voc_tick_t maxTick) {
return res < 0;
});
#endif
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -123,118 +123,6 @@ void ApplicationV8::disableActions() { _useActions = false; }
/// @brief upgrades the database
////////////////////////////////////////////////////////////////////////////////
void ApplicationV8::upgradeDatabase(bool skip, bool perform) {
LOG(TRACE) << "starting database init/upgrade";
// enter context and isolate
V8Context* context = _contexts[0];
TRI_ASSERT(context->_locker == nullptr);
context->_locker = new v8::Locker(context->isolate);
auto isolate = context->isolate;
isolate->Enter();
{
v8::HandleScope scope(isolate);
auto localContext = v8::Local<v8::Context>::New(isolate, context->_context);
localContext->Enter();
{
v8::Context::Scope contextScope(localContext);
// run upgrade script
if (!skip) {
LOG(DEBUG) << "running database init/upgrade";
auto unuser(_server->_databasesProtector.use());
auto theLists = _server->_databasesLists.load();
for (auto& p : theLists->_databases) {
TRI_vocbase_t* vocbase = p.second;
// special check script to be run just once in first thread (not in
// all)
// but for all databases
v8::HandleScope scope(isolate);
v8::Handle<v8::Object> args = v8::Object::New(isolate);
args->Set(TRI_V8_ASCII_STRING("upgrade"),
v8::Boolean::New(isolate, perform));
localContext->Global()->Set(TRI_V8_ASCII_STRING("UPGRADE_ARGS"),
args);
bool ok = TRI_UpgradeDatabase(vocbase, &_startupLoader, localContext);
if (!ok) {
if (localContext->Global()->Has(
TRI_V8_ASCII_STRING("UPGRADE_STARTED"))) {
localContext->Exit();
if (perform) {
LOG(FATAL) << "Database '" << vocbase->_name
<< "' upgrade failed. Please inspect the logs from "
"the upgrade procedure";
FATAL_ERROR_EXIT();
} else {
LOG(FATAL)
<< "Database '" << vocbase->_name
<< "' needs upgrade. Please start the server with the "
"--upgrade option";
FATAL_ERROR_EXIT();
}
} else {
LOG(FATAL) << "JavaScript error during server start";
FATAL_ERROR_EXIT();
}
LOG(DEBUG) << "database '" << vocbase->_name
<< "' init/upgrade done";
}
}
}
}
// finally leave the context. otherwise v8 will crash with assertion failure
// when we delete
// the context locker below
localContext->Exit();
}
isolate->Exit();
delete context->_locker;
context->_locker = nullptr;
if (perform) {
// issue #391: when invoked with --upgrade, the server will not always shut
// down
LOG(INFO) << "database upgrade passed";
// regular shutdown... wait for all threads to finish
auto unuser(_server->_databasesProtector.use());
auto theLists = _server->_databasesLists.load();
for (auto& p : theLists->_databases) {
TRI_vocbase_t* vocbase = p.second;
vocbase->_state = 2;
int res = TRI_ERROR_NO_ERROR;
res |= TRI_StopCompactorVocBase(vocbase);
vocbase->_state = 3;
res |= TRI_JoinThread(&vocbase->_cleanup);
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "unable to join database threads for database '"
<< vocbase->_name << "'";
}
}
LOG(INFO) << "finished";
TRI_EXIT_FUNCTION(EXIT_SUCCESS, nullptr);
} else {
// and return from the context
LOG(TRACE) << "finished database init/upgrade";
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief prepares the V8 server
////////////////////////////////////////////////////////////////////////////////

View File

@ -28,7 +28,6 @@
#include "Basics/RandomGenerator.h"
#include "Basics/StringUtils.h"
#include "Basics/WorkMonitor.h"
#include "Cluster/v8-cluster.h"
#include "Dispatcher/DispatcherThread.h"
#include "ProgramOptions/ProgramOptions.h"
#include "ProgramOptions/Section.h"
@ -40,7 +39,6 @@
#include "V8/v8-utils.h"
#include "V8Server/V8Context.h"
#include "V8Server/v8-actions.h"
#include "V8Server/v8-query.h"
#include "V8Server/v8-user-structures.h"
#include "VocBase/server.h"
#include "VocBase/vocbase.h"
@ -551,7 +549,7 @@ V8Context* V8DealerFeature::enterContext(TRI_vocbase_t* vocbase,
// when we get here, we should have a context and an isolate
TRI_ASSERT(context != nullptr);
TRI_ASSERT(context->isolate != nullptr);
TRI_ASSERT(context->_isolate != nullptr);
auto isolate = context->_isolate;
TRI_ASSERT(context->_locker == nullptr);
@ -830,14 +828,8 @@ void V8DealerFeature::initializeContext(size_t i) {
globalObj->Set(TRI_V8_ASCII_STRING("global"), globalObj);
globalObj->Set(TRI_V8_ASCII_STRING("root"), globalObj);
#warning TODO
#if 0
TRI_InitV8Queries(isolate, localContext);
#endif
TRI_InitV8UserStructures(isolate, localContext);
TRI_InitV8Cluster(isolate, localContext);
#warning TODO
#if 0
if (_dispatcher->dispatcher() != nullptr) {

View File

@ -41,7 +41,8 @@
#include "V8/v8-buffer.h"
#include "V8/v8-conv.h"
#include "V8/v8-utils.h"
// #include "V8Server/ApplicationV8.h"
#include "V8Server/V8Context.h"
#include "V8Server/V8DealerFeature.h"
#include "V8Server/v8-vocbase.h"
#include "VocBase/server.h"
#include "VocBase/vocbase.h"
@ -54,12 +55,6 @@ static TRI_action_result_t ExecuteActionVocbase(
TRI_vocbase_t* vocbase, v8::Isolate* isolate, TRI_action_t const* action,
v8::Handle<v8::Function> callback, HttpRequest* request);
////////////////////////////////////////////////////////////////////////////////
/// @brief global V8 dealer
////////////////////////////////////////////////////////////////////////////////
static ApplicationV8* GlobalV8Dealer = nullptr;
////////////////////////////////////////////////////////////////////////////////
/// @brief action description for V8
////////////////////////////////////////////////////////////////////////////////
@ -89,8 +84,6 @@ class v8_action_t : public TRI_action_t {
TRI_action_result_t execute(TRI_vocbase_t* vocbase, HttpRequest* request,
Mutex* dataLock, void** data) override {
#warning TODO
#if 0
TRI_action_result_t result;
// allow use datase execution in rest calls
@ -112,7 +105,7 @@ class v8_action_t : public TRI_action_t {
}
// get a V8 context
ApplicationV8::V8Context* context = GlobalV8Dealer->enterContext(
V8Context* context = V8DealerFeature::DEALER->enterContext(
vocbase, allowUseDatabaseInRestActions, forceContext);
// note: the context might be 0 in case of shut-down
@ -125,12 +118,12 @@ class v8_action_t : public TRI_action_t {
{
std::map<v8::Isolate*, v8::Persistent<v8::Function>>::iterator i =
_callbacks.find(context->isolate);
_callbacks.find(context->_isolate);
if (i == _callbacks.end()) {
LOG(WARN) << "no callback function for JavaScript action '" << _url << "'";
GlobalV8Dealer->exitContext(context);
V8DealerFeature::DEALER->exitContext(context);
result.isValid = true;
result.response =
@ -146,19 +139,19 @@ class v8_action_t : public TRI_action_t {
if (*data != 0) {
result.canceled = true;
GlobalV8Dealer->exitContext(context);
V8DealerFeature::DEALER->exitContext(context);
return result;
}
*data = (void*)context->isolate;
*data = (void*)context->_isolate;
}
v8::HandleScope scope(context->isolate);
v8::HandleScope scope(context->_isolate);
auto localFunction =
v8::Local<v8::Function>::New(context->isolate, i->second);
v8::Local<v8::Function>::New(context->_isolate, i->second);
try {
result = ExecuteActionVocbase(vocbase, context->isolate, this,
result = ExecuteActionVocbase(vocbase, context->_isolate, this,
localFunction, request);
} catch (...) {
result.isValid = false;
@ -169,10 +162,9 @@ class v8_action_t : public TRI_action_t {
*data = 0;
}
}
GlobalV8Dealer->exitContext(context);
V8DealerFeature::DEALER->exitContext(context);
return result;
#endif
}
bool cancel(Mutex* dataLock, void** data) override {
@ -865,13 +857,10 @@ static void JS_ExecuteGlobalContextFunction(
std::string const def = *utf8def;
// and pass it to the V8 contexts
#warning TODO
#if 0
if (!GlobalV8Dealer->addGlobalContextMethod(def)) {
if (!V8DealerFeature::DEALER->addGlobalContextMethod(def)) {
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
"invalid action definition");
}
#endif
TRI_V8_RETURN_UNDEFINED();
TRI_V8_TRY_CATCH_END
@ -1232,11 +1221,9 @@ static void JS_AccessSid(v8::FunctionCallbackInfo<v8::Value> const& args) {
////////////////////////////////////////////////////////////////////////////////
void TRI_InitV8Actions(v8::Isolate* isolate, v8::Handle<v8::Context> context,
TRI_vocbase_t* vocbase, ApplicationV8* applicationV8) {
TRI_vocbase_t* vocbase) {
v8::HandleScope scope(isolate);
GlobalV8Dealer = applicationV8;
// .............................................................................
// create the global functions
// .............................................................................

View File

@ -37,7 +37,7 @@ class ApplicationV8;
////////////////////////////////////////////////////////////////////////////////
void TRI_InitV8Actions(v8::Isolate* isolate, v8::Handle<v8::Context> context,
TRI_vocbase_t* vocbase, arangodb::ApplicationV8*);
TRI_vocbase_t* vocbase);
void TRI_InitV8DebugUtils(v8::Isolate* isolate, v8::Handle<v8::Context> context,
std::string const& startupPath,

View File

@ -2178,7 +2178,9 @@ void TRI_InitV8Queries(v8::Isolate* isolate, v8::Handle<v8::Context> context) {
TRI_GET_GLOBALS();
TRI_ASSERT(v8g != nullptr);
TRI_GET_GLOBAL(VocbaseColTempl, v8::ObjectTemplate);
TRI_ASSERT(!VocbaseColTempl.IsEmpty());
// .............................................................................
// generate the TRI_vocbase_col_t template

View File

@ -394,8 +394,6 @@ static void JS_Transaction(v8::FunctionCallbackInfo<v8::Value> const& args) {
////////////////////////////////////////////////////////////////////////////////
static void JS_PropertiesWal(v8::FunctionCallbackInfo<v8::Value> const& args) {
#warning TODO
#if 0
TRI_V8_TRY_CATCH_BEGIN(isolate);
v8::HandleScope scope(isolate);
@ -463,7 +461,6 @@ static void JS_PropertiesWal(v8::FunctionCallbackInfo<v8::Value> const& args) {
TRI_V8_RETURN(result);
TRI_V8_TRY_CATCH_END
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -471,8 +468,6 @@ static void JS_PropertiesWal(v8::FunctionCallbackInfo<v8::Value> const& args) {
////////////////////////////////////////////////////////////////////////////////
static void JS_FlushWal(v8::FunctionCallbackInfo<v8::Value> const& args) {
#warning TODO
#if 0
TRI_V8_TRY_CATCH_BEGIN(isolate);
v8::HandleScope scope(isolate);
@ -528,7 +523,6 @@ static void JS_FlushWal(v8::FunctionCallbackInfo<v8::Value> const& args) {
TRI_V8_RETURN_TRUE();
TRI_V8_TRY_CATCH_END
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -570,15 +564,12 @@ static void JS_WaitCollectorWal(
timeout = TRI_ObjectToDouble(args[1]);
}
#warning TODO
#if 0
int res = arangodb::wal::LogfileManager::instance()->waitForCollectorQueue(
col->_cid, timeout);
if (res != TRI_ERROR_NO_ERROR) {
TRI_V8_THROW_EXCEPTION(res);
}
#endif
TRI_V8_RETURN_TRUE();
TRI_V8_TRY_CATCH_END
@ -590,8 +581,6 @@ static void JS_WaitCollectorWal(
static void JS_TransactionsWal(
v8::FunctionCallbackInfo<v8::Value> const& args) {
#warning TODO
#if 0
TRI_V8_TRY_CATCH_BEGIN(isolate);
v8::HandleScope scope(isolate);
@ -603,6 +592,7 @@ static void JS_TransactionsWal(
result->ForceSet(
TRI_V8_ASCII_STRING("runningTransactions"),
v8::Number::New(isolate, static_cast<double>(std::get<0>(info))));
// lastCollectedId
{
auto value = std::get<1>(info);
@ -614,6 +604,7 @@ static void JS_TransactionsWal(
V8TickId(isolate, static_cast<TRI_voc_tick_t>(value)));
}
}
// lastSealedId
{
auto value = std::get<2>(info);
@ -627,7 +618,6 @@ static void JS_TransactionsWal(
TRI_V8_RETURN(result);
TRI_V8_TRY_CATCH_END
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -3636,9 +3626,8 @@ int32_t TRI_GetVocBaseColType() { return WRP_VOCBASE_COL_TYPE; }
/// @brief run version check
////////////////////////////////////////////////////////////////////////////////
bool TRI_UpgradeDatabase(TRI_vocbase_t* vocbase, JSLoader* startupLoader,
bool TRI_UpgradeDatabase(TRI_vocbase_t* vocbase,
v8::Handle<v8::Context> context) {
TRI_ASSERT(startupLoader != nullptr);
auto isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
@ -3646,6 +3635,7 @@ bool TRI_UpgradeDatabase(TRI_vocbase_t* vocbase, JSLoader* startupLoader,
TRI_vocbase_t* orig = v8g->_vocbase;
v8g->_vocbase = vocbase;
auto startupLoader = V8DealerFeature::DEALER->startupLoader();
v8::Handle<v8::Value> result = startupLoader->executeGlobalScript(
isolate, isolate->GetCurrentContext(), "server/upgrade-database.js");
bool ok = TRI_ObjectToBoolean(result);
@ -3663,16 +3653,15 @@ bool TRI_UpgradeDatabase(TRI_vocbase_t* vocbase, JSLoader* startupLoader,
/// @brief run upgrade check
////////////////////////////////////////////////////////////////////////////////
int TRI_CheckDatabaseVersion(TRI_vocbase_t* vocbase, JSLoader* startupLoader,
int TRI_CheckDatabaseVersion(TRI_vocbase_t* vocbase,
v8::Handle<v8::Context> context) {
TRI_ASSERT(startupLoader != nullptr);
auto isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
TRI_GET_GLOBALS();
TRI_vocbase_t* orig = v8g->_vocbase;
v8g->_vocbase = vocbase;
auto startupLoader = V8DealerFeature::DEALER->startupLoader();
v8::Handle<v8::Value> result = startupLoader->executeGlobalScript(
isolate, isolate->GetCurrentContext(), "server/check-version.js");
int code = (int)TRI_ObjectToInt64(result);

View File

@ -60,15 +60,13 @@ int32_t TRI_GetVocBaseColType();
/// @brief run version check
////////////////////////////////////////////////////////////////////////////////
bool TRI_UpgradeDatabase(TRI_vocbase_t*, arangodb::JSLoader*,
v8::Handle<v8::Context>);
bool TRI_UpgradeDatabase(TRI_vocbase_t*, v8::Handle<v8::Context>);
////////////////////////////////////////////////////////////////////////////////
/// @brief run upgrade check
////////////////////////////////////////////////////////////////////////////////
int TRI_CheckDatabaseVersion(TRI_vocbase_t* vocbase,
arangodb::JSLoader* startupLoader,
v8::Handle<v8::Context> context);
////////////////////////////////////////////////////////////////////////////////

View File

@ -486,8 +486,6 @@ TRI_shape_aid_t VocShaper::lookupAttributeByName(char const* name) {
////////////////////////////////////////////////////////////////////////////////
TRI_shape_aid_t VocShaper::findOrCreateAttributeByName(char const* name) {
#warning TODO
#if 0
// check if the attribute exists
TRI_shape_aid_t aid = lookupAttributeByName(name);
@ -579,7 +577,6 @@ TRI_shape_aid_t VocShaper::findOrCreateAttributeByName(char const* name) {
<< TRI_errno_string(res);
return 0;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -591,8 +588,6 @@ TRI_shape_aid_t VocShaper::findOrCreateAttributeByName(char const* name) {
////////////////////////////////////////////////////////////////////////////////
TRI_shape_t const* VocShaper::findShape(TRI_shape_t* shape, bool create) {
#warning TODO
#if 0
TRI_shape_t const* found = Shaper::lookupBasicShape(shape);
if (found == nullptr) {
@ -712,7 +707,6 @@ TRI_shape_t const* VocShaper::findShape(TRI_shape_t* shape, bool create) {
// must not free the shape here, as the caller is going to free it...
return nullptr;
#endif
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -55,8 +55,6 @@ static int const CLEANUP_INDEX_ITERATIONS = 5;
static void CleanupDocumentCollection(TRI_vocbase_col_t* collection,
TRI_document_collection_t* document) {
#warning TODO
#if 0
// unload operations can normally only be executed when a collection is fully
// garbage collected
bool unloadChecked = false;
@ -207,7 +205,6 @@ static void CleanupDocumentCollection(TRI_vocbase_col_t* collection,
// next iteration
}
#endif
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -154,11 +154,10 @@ int TRI_document_collection_t::beginRead() {
// LOCKING-DEBUG
// std::cout << "BeginRead: " << document->_info._name << std::endl;
TRI_READ_LOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(this);
try {
try {
_vocbase->_deadlockDetector.addReader(this, false);
}
catch (...) {
} catch (...) {
TRI_READ_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(this);
return TRI_ERROR_OUT_OF_MEMORY;
}
@ -181,13 +180,12 @@ int TRI_document_collection_t::endRead() {
return TRI_ERROR_NO_ERROR;
}
}
try {
try {
_vocbase->_deadlockDetector.unsetReader(this);
} catch (...) {
}
catch (...) {
}
// LOCKING-DEBUG
// std::cout << "EndRead: " << document->_info._name << std::endl;
TRI_READ_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(this);
@ -214,12 +212,11 @@ int TRI_document_collection_t::beginWrite() {
// LOCKING_DEBUG
// std::cout << "BeginWrite: " << document->_info._name << std::endl;
TRI_WRITE_LOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(this);
// register writer
try {
try {
_vocbase->_deadlockDetector.addWriter(this, false);
}
catch (...) {
} catch (...) {
TRI_WRITE_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(this);
return TRI_ERROR_OUT_OF_MEMORY;
}
@ -243,12 +240,11 @@ int TRI_document_collection_t::endWrite() {
return TRI_ERROR_NO_ERROR;
}
}
// unregister writer
try {
_vocbase->_deadlockDetector.unsetWriter(this);
}
catch (...) {
} catch (...) {
// must go on here to unlock the lock
}
@ -292,20 +288,27 @@ int TRI_document_collection_t::beginReadTimed(uint64_t timeout,
if (!wasBlocked) {
// insert reader
wasBlocked = true;
if (_vocbase->_deadlockDetector.setReaderBlocked(this) == TRI_ERROR_DEADLOCK) {
if (_vocbase->_deadlockDetector.setReaderBlocked(this) ==
TRI_ERROR_DEADLOCK) {
// deadlock
LOG(TRACE) << "deadlock detected while trying to acquire read-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "deadlock detected while trying to acquire read-lock "
"on collection '"
<< _info.namec_str() << "'";
return TRI_ERROR_DEADLOCK;
}
LOG(TRACE) << "waiting for read-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "waiting for read-lock on collection '"
<< _info.namec_str() << "'";
} else if (++iterations >= 5) {
// periodically check for deadlocks
TRI_ASSERT(wasBlocked);
iterations = 0;
if (_vocbase->_deadlockDetector.detectDeadlock(this, false) == TRI_ERROR_DEADLOCK) {
if (_vocbase->_deadlockDetector.detectDeadlock(this, false) ==
TRI_ERROR_DEADLOCK) {
// deadlock
_vocbase->_deadlockDetector.unsetReaderBlocked(this);
LOG(TRACE) << "deadlock detected while trying to acquire read-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "deadlock detected while trying to acquire read-lock "
"on collection '"
<< _info.namec_str() << "'";
return TRI_ERROR_DEADLOCK;
}
}
@ -328,16 +331,16 @@ int TRI_document_collection_t::beginReadTimed(uint64_t timeout,
if (waited > timeout) {
_vocbase->_deadlockDetector.unsetReaderBlocked(this);
LOG(TRACE) << "timed out waiting for read-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "timed out waiting for read-lock on collection '"
<< _info.namec_str() << "'";
return TRI_ERROR_LOCK_TIMEOUT;
}
}
try {
try {
// when we are here, we've got the read lock
_vocbase->_deadlockDetector.addReader(this, wasBlocked);
}
catch (...) {
} catch (...) {
TRI_READ_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(this);
return TRI_ERROR_OUT_OF_MEMORY;
}
@ -378,20 +381,27 @@ int TRI_document_collection_t::beginWriteTimed(uint64_t timeout,
if (!wasBlocked) {
// insert writer
wasBlocked = true;
if (_vocbase->_deadlockDetector.setWriterBlocked(this) == TRI_ERROR_DEADLOCK) {
if (_vocbase->_deadlockDetector.setWriterBlocked(this) ==
TRI_ERROR_DEADLOCK) {
// deadlock
LOG(TRACE) << "deadlock detected while trying to acquire write-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "deadlock detected while trying to acquire write-lock "
"on collection '"
<< _info.namec_str() << "'";
return TRI_ERROR_DEADLOCK;
}
LOG(TRACE) << "waiting for write-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "waiting for write-lock on collection '"
<< _info.namec_str() << "'";
} else if (++iterations >= 5) {
// periodically check for deadlocks
TRI_ASSERT(wasBlocked);
iterations = 0;
if (_vocbase->_deadlockDetector.detectDeadlock(this, true) == TRI_ERROR_DEADLOCK) {
if (_vocbase->_deadlockDetector.detectDeadlock(this, true) ==
TRI_ERROR_DEADLOCK) {
// deadlock
_vocbase->_deadlockDetector.unsetWriterBlocked(this);
LOG(TRACE) << "deadlock detected while trying to acquire write-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "deadlock detected while trying to acquire write-lock "
"on collection '"
<< _info.namec_str() << "'";
return TRI_ERROR_DEADLOCK;
}
}
@ -414,16 +424,16 @@ int TRI_document_collection_t::beginWriteTimed(uint64_t timeout,
if (waited > timeout) {
_vocbase->_deadlockDetector.unsetWriterBlocked(this);
LOG(TRACE) << "timed out waiting for write-lock on collection '" << _info.namec_str() << "'";
LOG(TRACE) << "timed out waiting for write-lock on collection '"
<< _info.namec_str() << "'";
return TRI_ERROR_LOCK_TIMEOUT;
}
}
try {
// register writer
try {
// register writer
_vocbase->_deadlockDetector.addWriter(this, wasBlocked);
}
catch (...) {
} catch (...) {
TRI_WRITE_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(this);
return TRI_ERROR_OUT_OF_MEMORY;
}
@ -733,7 +743,10 @@ static int InsertPrimaryIndex(arangodb::Transaction* trx,
// we found a previous revision in the index
// the found revision is still alive
LOG(TRACE) << "document '" << TRI_EXTRACT_MARKER_KEY(header) << "' already existed with revision " << // ONLY IN INDEX << " while creating revision " << PROTECTED by RUNTIME
LOG(TRACE) << "document '" << TRI_EXTRACT_MARKER_KEY(header)
<< "' already existed with revision "
<< // ONLY IN INDEX << " while creating revision " << PROTECTED by
// RUNTIME
(unsigned long long)found->_rid;
return TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED;
@ -1419,7 +1432,8 @@ static int OpenIteratorApplyInsert(open_iterator_state_t* state,
}
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "inserting document into indexes failed with error: " << TRI_errno_string(res);
LOG(ERR) << "inserting document into indexes failed with error: "
<< TRI_errno_string(res);
return res;
}
@ -1511,7 +1525,8 @@ static int OpenIteratorApplyRemove(open_iterator_state_t* state,
TRI_voc_key_t key = ((char*)d) + d->_offsetKey;
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
LOG(TRACE) << "deletion: fid " << operation->_fid << ", key " << (char*)key << ", rid " << d->_rid << ", deletion " << marker->_tick;
LOG(TRACE) << "deletion: fid " << operation->_fid << ", key " << (char*)key
<< ", rid " << d->_rid << ", deletion " << marker->_tick;
#endif
document->_keyGenerator->track(key);
@ -1705,7 +1720,10 @@ static int OpenIteratorHandleDocumentMarker(TRI_df_marker_t const* marker,
// marker has a transaction id
if (d->_tid != state->_tid) {
// we have a different transaction ongoing
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid << ". found tid: " << d->_tid << ", expected tid: " << state->_tid << ". this may also be the result of an aborted transaction";
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid "
<< datafile->_fid << ". found tid: " << d->_tid
<< ", expected tid: " << state->_tid
<< ". this may also be the result of an aborted transaction";
OpenIteratorAbortTransaction(state);
@ -1731,7 +1749,10 @@ static int OpenIteratorHandleDeletionMarker(TRI_df_marker_t const* marker,
// marker has a transaction id
if (d->_tid != state->_tid) {
// we have a different transaction ongoing
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid << ". found tid: " << d->_tid << ", expected tid: " << state->_tid << ". this may also be the result of an aborted transaction";
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid "
<< datafile->_fid << ". found tid: " << d->_tid
<< ", expected tid: " << state->_tid
<< ". this may also be the result of an aborted transaction";
OpenIteratorAbortTransaction(state);
@ -1807,7 +1828,9 @@ static int OpenIteratorHandleBeginMarker(TRI_df_marker_t const* marker,
if (m->_tid != state->_tid && state->_tid != 0) {
// some incomplete transaction was going on before us...
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid << ". found tid: " << m->_tid << ", expected tid: " << state->_tid << ". this may also be the result of an aborted transaction";
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid
<< ". found tid: " << m->_tid << ", expected tid: " << state->_tid
<< ". this may also be the result of an aborted transaction";
OpenIteratorAbortTransaction(state);
}
@ -1830,7 +1853,9 @@ static int OpenIteratorHandleCommitMarker(TRI_df_marker_t const* marker,
if (m->_tid != state->_tid) {
// we found a commit marker, but we did not find any begin marker
// beforehand. strange
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid << ". found tid: " << m->_tid << ", expected tid: " << state->_tid;
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid
<< ". found tid: " << m->_tid
<< ", expected tid: " << state->_tid;
OpenIteratorAbortTransaction(state);
} else {
@ -1856,7 +1881,9 @@ static int OpenIteratorHandlePrepareMarker(TRI_df_marker_t const* marker,
if (m->_tid != state->_tid) {
// we found a commit marker, but we did not find any begin marker
// beforehand. strange
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid << ". found tid: " << m->_tid << ", expected tid: " << state->_tid;
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid
<< ". found tid: " << m->_tid
<< ", expected tid: " << state->_tid;
OpenIteratorAbortTransaction(state);
} else {
@ -1879,7 +1906,9 @@ static int OpenIteratorHandleAbortMarker(TRI_df_marker_t const* marker,
if (m->_tid != state->_tid) {
// we found an abort marker, but we did not find any begin marker
// beforehand. strange
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid << ". found tid: " << m->_tid << ", expected tid: " << state->_tid;
LOG(WARN) << "logic error in " << __FUNCTION__ << ", fid " << datafile->_fid
<< ". found tid: " << m->_tid
<< ", expected tid: " << state->_tid;
}
OpenIteratorAbortTransaction(state);
@ -2157,7 +2186,9 @@ static int IterateMarkersCollection(arangodb::Transaction* trx,
// read all documents and fill primary index
TRI_IterateCollection(collection, OpenIterator, &openState);
LOG(TRACE) << "found " << openState._documents << " document markers, " << openState._deletions << " deletion markers for collection '" << collection->_info.namec_str() << "'";
LOG(TRACE) << "found " << openState._documents << " document markers, "
<< openState._deletions << " deletion markers for collection '"
<< collection->_info.namec_str() << "'";
// abort any transaction that's unfinished after iterating over all markers
OpenIteratorAbortTransaction(&openState);
@ -2261,7 +2292,8 @@ TRI_document_collection_t* TRI_CreateDocumentCollection(
if (res != TRI_ERROR_NO_ERROR) {
// TODO: shouldn't we free document->_headersPtr etc.?
// Yes, do this in the context of the TRI_document_collection_t cleanup.
LOG(ERR) << "cannot save collection parameters in directory '" << collection->_directory << "': '" << TRI_last_error() << "'";
LOG(ERR) << "cannot save collection parameters in directory '"
<< collection->_directory << "': '" << TRI_last_error() << "'";
TRI_CloseCollection(collection);
TRI_DestroyCollection(collection);
@ -2402,7 +2434,8 @@ TRI_datafile_t* TRI_CreateDatafileDocumentCollection(
if (res != TRI_ERROR_NO_ERROR) {
document->_lastError = journal->_lastError;
LOG(ERR) << "cannot create collection header in file '" << journal->getName(journal) << "': " << TRI_errno_string(res);
LOG(ERR) << "cannot create collection header in file '"
<< journal->getName(journal) << "': " << TRI_errno_string(res);
// close the journal and remove it
TRI_CloseDatafile(journal);
@ -2429,7 +2462,8 @@ TRI_datafile_t* TRI_CreateDatafileDocumentCollection(
if (res != TRI_ERROR_NO_ERROR) {
document->_lastError = journal->_lastError;
LOG(ERR) << "cannot create collection header in file '" << journal->getName(journal) << "': " << TRI_last_error();
LOG(ERR) << "cannot create collection header in file '"
<< journal->getName(journal) << "': " << TRI_last_error();
// close the journal and remove it
TRI_CloseDatafile(journal);
@ -2458,7 +2492,8 @@ TRI_datafile_t* TRI_CreateDatafileDocumentCollection(
bool ok = TRI_RenameDatafile(journal, filename);
if (!ok) {
LOG(ERR) << "failed to rename journal '" << journal->getName(journal) << "' to '" << filename << "': " << TRI_last_error();
LOG(ERR) << "failed to rename journal '" << journal->getName(journal)
<< "' to '" << filename << "': " << TRI_last_error();
TRI_CloseDatafile(journal);
TRI_UnlinkFile(journal->getName(journal));
@ -2469,7 +2504,8 @@ TRI_datafile_t* TRI_CreateDatafileDocumentCollection(
return nullptr;
} else {
LOG(TRACE) << "renamed journal from '" << journal->getName(journal) << "' to '" << filename << "'";
LOG(TRACE) << "renamed journal from '" << journal->getName(journal)
<< "' to '" << filename << "'";
}
TRI_FreeString(TRI_CORE_MEM_ZONE, filename);
@ -2598,12 +2634,14 @@ int TRI_FromVelocyPackIndexDocumentCollection(
// ...........................................................................
if (typeStr == "edge") {
// we should never get here, as users cannot create their own edge indexes
LOG(ERR) << "logic error. there should never be a JSON file describing an edges index";
LOG(ERR) << "logic error. there should never be a JSON file describing an "
"edges index";
return TRI_ERROR_INTERNAL;
}
// default:
LOG(WARN) << "index type '" << typeStr << "' is not supported in this version of ArangoDB and is ignored";
LOG(WARN) << "index type '" << typeStr
<< "' is not supported in this version of ArangoDB and is ignored";
return TRI_ERROR_NO_ERROR;
}
@ -2684,7 +2722,8 @@ bool TRI_CloseDatafileDocumentCollection(TRI_document_collection_t* document,
int res = TRI_SealDatafile(journal);
if (res != TRI_ERROR_NO_ERROR) {
LOG(ERR) << "failed to seal datafile '" << journal->getName(journal) << "': " << TRI_last_error();
LOG(ERR) << "failed to seal datafile '" << journal->getName(journal)
<< "': " << TRI_last_error();
if (!isCompactor) {
TRI_RemoveVectorPointer(vector, position);
@ -2706,7 +2745,8 @@ bool TRI_CloseDatafileDocumentCollection(TRI_document_collection_t* document,
bool ok = TRI_RenameDatafile(journal, filename);
if (!ok) {
LOG(ERR) << "failed to rename datafile '" << journal->getName(journal) << "' to '" << filename << "': " << TRI_last_error();
LOG(ERR) << "failed to rename datafile '" << journal->getName(journal)
<< "' to '" << filename << "': " << TRI_last_error();
TRI_RemoveVectorPointer(vector, position);
TRI_PushBackVectorPointer(&document->_datafiles, journal);
@ -2798,8 +2838,10 @@ int TRI_FillIndexesDocumentCollection(arangodb::Transaction* trx,
auto primaryIndex = document->primaryIndex();
if (primaryIndex->size() > NotificationSizeThreshold) {
LOG_TOPIC(TRACE, Logger::PERFORMANCE) <<
"fill-indexes-document-collection { collection: " << document->_vocbase->_name << "/" << document->_info.name() << " }, indexes: " << (n - 1);
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "fill-indexes-document-collection { collection: "
<< document->_vocbase->_name << "/" << document->_info.name()
<< " }, indexes: " << (n - 1);
}
TRI_ASSERT(n > 1);
@ -2867,7 +2909,11 @@ int TRI_FillIndexesDocumentCollection(arangodb::Transaction* trx,
// barrier waits here until all threads have joined
}
LOG_TOPIC(TRACE, Logger::PERFORMANCE) << "[timer] " << Logger::DURATION(TRI_microtime() - start) << " s, fill-indexes-document-collection { collection: " << document->_vocbase->_name << "/" << document->_info.name() << " }, indexes: " << (n - 1);
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "[timer] " << Logger::DURATION(TRI_microtime() - start)
<< " s, fill-indexes-document-collection { collection: "
<< document->_vocbase->_name << "/" << document->_info.name()
<< " }, indexes: " << (n - 1);
return result.load();
}
@ -2879,8 +2925,6 @@ int TRI_FillIndexesDocumentCollection(arangodb::Transaction* trx,
TRI_document_collection_t* TRI_OpenDocumentCollection(TRI_vocbase_t* vocbase,
TRI_vocbase_col_t* col,
bool ignoreErrors) {
#warning TODO
#if 0
char const* path = col->pathc_str();
// first open the document collection
@ -2897,8 +2941,9 @@ TRI_document_collection_t* TRI_OpenDocumentCollection(TRI_vocbase_t* vocbase,
TRI_ASSERT(document != nullptr);
double start = TRI_microtime();
LOG_TOPIC(TRACE, Logger::PERFORMANCE) <<
"open-document-collection { collection: " << vocbase->_name << "/" << col->name() << " }";
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "open-document-collection { collection: " << vocbase->_name << "/"
<< col->name() << " }";
TRI_collection_t* collection =
TRI_OpenCollection(vocbase, document, path, ignoreErrors);
@ -2950,13 +2995,17 @@ TRI_document_collection_t* TRI_OpenDocumentCollection(TRI_vocbase_t* vocbase,
{
double start = TRI_microtime();
LOG_TOPIC(TRACE, Logger::PERFORMANCE) <<
"iterate-markers { collection: " << vocbase->_name << "/" << document->_info.name() << " }";
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "iterate-markers { collection: " << vocbase->_name << "/"
<< document->_info.name() << " }";
// iterate over all markers of the collection
int res = IterateMarkersCollection(&trx, collection);
LOG_TOPIC(TRACE, Logger::PERFORMANCE) << "[timer] " << Logger::DURATION(TRI_microtime() - start) << " s, iterate-markers { collection: " << vocbase->_name << "/" << document->_info.name() << " }";
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "[timer] " << Logger::DURATION(TRI_microtime() - start)
<< " s, iterate-markers { collection: " << vocbase->_name << "/"
<< document->_info.name() << " }";
if (res != TRI_ERROR_NO_ERROR) {
if (document->_failedTransactions != nullptr) {
@ -2979,10 +3028,12 @@ TRI_document_collection_t* TRI_OpenDocumentCollection(TRI_vocbase_t* vocbase,
TRI_FillIndexesDocumentCollection(&trx, col, document);
}
LOG_TOPIC(TRACE, Logger::PERFORMANCE) << "[timer] " << Logger::DURATION(TRI_microtime() - start) << " s, open-document-collection { collection: " << vocbase->_name << "/" << document->_info.name() << " }";
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "[timer] " << Logger::DURATION(TRI_microtime() - start)
<< " s, open-document-collection { collection: " << vocbase->_name << "/"
<< document->_info.name() << " }";
return document;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -3037,7 +3088,8 @@ static VPackSlice ExtractFields(VPackSlice const& slice, TRI_idx_iid_t iid) {
for (auto const& sub : VPackArrayIterator(fld)) {
if (!sub.isString()) {
LOG(ERR) << "ignoring index " << iid << ", 'fields' must be an array of attribute paths";
LOG(ERR) << "ignoring index " << iid
<< ", 'fields' must be an array of attribute paths";
THROW_ARANGO_EXCEPTION(TRI_ERROR_BAD_PARAMETER);
}
}
@ -3056,9 +3108,11 @@ static int FillIndexBatch(arangodb::Transaction* trx,
double start = TRI_microtime();
LOG_TOPIC(TRACE, Logger::PERFORMANCE) <<
"fill-index-batch { collection: " << document->_vocbase->_name << "/" << document->_info.name() << " }, " <<
idx->context() << ", threads: " << indexPool->numThreads() << ", buckets: " << document->_info.indexBuckets();
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "fill-index-batch { collection: " << document->_vocbase->_name << "/"
<< document->_info.name() << " }, " << idx->context()
<< ", threads: " << indexPool->numThreads()
<< ", buckets: " << document->_info.indexBuckets();
// give the index a size hint
auto primaryIndex = document->primaryIndex();
@ -3112,7 +3166,12 @@ static int FillIndexBatch(arangodb::Transaction* trx,
res = idx->batchInsert(trx, &documents, indexPool->numThreads());
}
LOG_TOPIC(TRACE, Logger::PERFORMANCE) << "[timer] " << Logger::DURATION(TRI_microtime() - start) << " s, fill-index-batch { collection: " << document->_vocbase->_name << "/" << document->_info.name() << " }, " << idx->context() << ", threads: " << indexPool->numThreads() << ", buckets: " << document->_info.indexBuckets();
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "[timer] " << Logger::DURATION(TRI_microtime() - start)
<< " s, fill-index-batch { collection: " << document->_vocbase->_name
<< "/" << document->_info.name() << " }, " << idx->context()
<< ", threads: " << indexPool->numThreads()
<< ", buckets: " << document->_info.indexBuckets();
return res;
}
@ -3126,9 +3185,10 @@ static int FillIndexSequential(arangodb::Transaction* trx,
arangodb::Index* idx) {
double start = TRI_microtime();
LOG_TOPIC(TRACE, Logger::PERFORMANCE) <<
"fill-index-sequential { collection: " << document->_vocbase->_name << "/" << document->_info.name() << " }, " <<
idx->context() << ", buckets: " << document->_info.indexBuckets();
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "fill-index-sequential { collection: " << document->_vocbase->_name
<< "/" << document->_info.name() << " }, " << idx->context()
<< ", buckets: " << document->_info.indexBuckets();
// give the index a size hint
auto primaryIndex = document->primaryIndex();
@ -3163,13 +3223,18 @@ static int FillIndexSequential(arangodb::Transaction* trx,
if (++counter == LoopSize) {
counter = 0;
++loops;
LOG(TRACE) << "indexed " << (LoopSize * loops) << " documents of collection " << document->_info.id();
LOG(TRACE) << "indexed " << (LoopSize * loops)
<< " documents of collection " << document->_info.id();
}
#endif
}
}
LOG_TOPIC(TRACE, Logger::PERFORMANCE) << "[timer] " << Logger::DURATION(TRI_microtime() - start) << " s, fill-index-sequential { collection: " << document->_vocbase->_name << "/" << document->_info.name() << " }, " << idx->context() << ", buckets: " << document->_info.indexBuckets();
LOG_TOPIC(TRACE, Logger::PERFORMANCE)
<< "[timer] " << Logger::DURATION(TRI_microtime() - start)
<< " s, fill-index-sequential { collection: " << document->_vocbase->_name
<< "/" << document->_info.name() << " }, " << idx->context()
<< ", buckets: " << document->_info.indexBuckets();
return TRI_ERROR_NO_ERROR;
}
@ -3354,7 +3419,8 @@ static int PathBasedIndexFromVelocyPack(
// extract the list of fields
if (fieldCount < 1) {
LOG(ERR) << "ignoring index " << iid << ", need at least one attribute path";
LOG(ERR) << "ignoring index " << iid
<< ", need at least one attribute path";
return TRI_set_errno(TRI_ERROR_BAD_PARAMETER);
}
@ -3363,7 +3429,8 @@ static int PathBasedIndexFromVelocyPack(
VPackSlice bv = definition.get("unique");
if (!bv.isBoolean()) {
LOG(ERR) << "ignoring index " << iid << ", could not determine if unique or non-unique";
LOG(ERR) << "ignoring index " << iid
<< ", could not determine if unique or non-unique";
return TRI_set_errno(TRI_ERROR_BAD_PARAMETER);
}
@ -3410,7 +3477,8 @@ static int PathBasedIndexFromVelocyPack(
}
if (idx == nullptr) {
LOG(ERR) << "cannot create index " << iid << " in collection '" << document->_info.namec_str() << "'";
LOG(ERR) << "cannot create index " << iid << " in collection '"
<< document->_info.namec_str() << "'";
return TRI_errno();
}
@ -3448,8 +3516,6 @@ bool TRI_IsFullyCollectedDocumentCollection(
int TRI_SaveIndex(TRI_document_collection_t* document, arangodb::Index* idx,
bool writeMarker) {
#warning TODO
#if 0
// convert into JSON
std::shared_ptr<VPackBuilder> builder;
try {
@ -3512,7 +3578,6 @@ int TRI_SaveIndex(TRI_document_collection_t* document, arangodb::Index* idx,
// TODO: what to do here?
return res;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -3544,8 +3609,6 @@ std::vector<std::shared_ptr<VPackBuilder>> TRI_IndexesDocumentCollection(
bool TRI_DropIndexDocumentCollection(TRI_document_collection_t* document,
TRI_idx_iid_t iid, bool writeMarker) {
#warning TODO
#if 0
if (iid == 0) {
// invalid index id or primary index
return true;
@ -3598,7 +3661,6 @@ bool TRI_DropIndexDocumentCollection(TRI_document_collection_t* document,
}
return false;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -3653,8 +3715,9 @@ static int PidNamesByAttributeNames(
// sort according to pid
std::sort(pidNames.begin(), pidNames.end(),
[](PidNameType const& l, PidNameType const& r)
-> bool { return l.second < r.second; });
[](PidNameType const& l, PidNameType const& r) -> bool {
return l.second < r.second;
});
for (auto const& it : pidNames) {
pids.emplace_back(it.second);
@ -3770,7 +3833,8 @@ static int CapConstraintFromVelocyPack(arangodb::Transaction* trx,
VPackSlice val2 = definition.get("byteSize");
if (!val1.isNumber() && !val2.isNumber()) {
LOG(ERR) << "ignoring cap constraint " << iid << ", 'size' and 'byteSize' missing";
LOG(ERR) << "ignoring cap constraint " << iid
<< ", 'size' and 'byteSize' missing";
return TRI_set_errno(TRI_ERROR_BAD_PARAMETER);
}
@ -3803,7 +3867,9 @@ static int CapConstraintFromVelocyPack(arangodb::Transaction* trx,
}
if (count == 0 && size == 0) {
LOG(ERR) << "ignoring cap constraint " << iid << ", 'size' must be at least 1, or 'byteSize' must be at least " << arangodb::CapConstraint::MinSize;
LOG(ERR) << "ignoring cap constraint " << iid
<< ", 'size' must be at least 1, or 'byteSize' must be at least "
<< arangodb::CapConstraint::MinSize;
return TRI_set_errno(TRI_ERROR_BAD_PARAMETER);
}
@ -3936,7 +4002,8 @@ static arangodb::Index* CreateGeoIndexDocumentCollection(
{{location, false}}},
std::vector<TRI_shape_pid_t>{loc}, geoJson));
LOG(TRACE) << "created geo-index for location '" << location << "': " << loc;
LOG(TRACE) << "created geo-index for location '" << location
<< "': " << loc;
} else if (!longitude.empty() && !latitude.empty()) {
geoIndex.reset(new arangodb::GeoIndex2(
iid, document,
@ -3944,7 +4011,8 @@ static arangodb::Index* CreateGeoIndexDocumentCollection(
{{latitude, false}}, {{longitude, false}}},
std::vector<TRI_shape_pid_t>{lat, lon}));
LOG(TRACE) << "created geo-index for location '" << location << "': " << lat << ", " << lon;
LOG(TRACE) << "created geo-index for location '" << location << "': " << lat
<< ", " << lon;
}
idx = static_cast<arangodb::GeoIndex2*>(geoIndex.get());
@ -4030,7 +4098,8 @@ static int GeoIndexFromVelocyPack(arangodb::Transaction* trx,
return idx == nullptr ? TRI_errno() : TRI_ERROR_NO_ERROR;
} else {
LOG(ERR) << "ignoring " << typeStr << "-index " << iid << ", 'fields' must be a list with 1 entries";
LOG(ERR) << "ignoring " << typeStr << "-index " << iid
<< ", 'fields' must be a list with 1 entries";
return TRI_set_errno(TRI_ERROR_BAD_PARAMETER);
}
@ -4054,7 +4123,8 @@ static int GeoIndexFromVelocyPack(arangodb::Transaction* trx,
return idx == nullptr ? TRI_errno() : TRI_ERROR_NO_ERROR;
} else {
LOG(ERR) << "ignoring " << typeStr << "-index " << iid << ", 'fields' must be a list with 2 entries";
LOG(ERR) << "ignoring " << typeStr << "-index " << iid
<< ", 'fields' must be a list with 2 entries";
return TRI_set_errno(TRI_ERROR_BAD_PARAMETER);
}
@ -4564,7 +4634,8 @@ static int FulltextIndexFromVelocyPack(arangodb::Transaction* trx,
// extract the list of fields
if (fieldCount != 1) {
LOG(ERR) << "ignoring index " << iid << ", has an invalid number of attributes";
LOG(ERR) << "ignoring index " << iid
<< ", has an invalid number of attributes";
return TRI_set_errno(TRI_ERROR_BAD_PARAMETER);
}
@ -4796,14 +4867,16 @@ int TRI_RemoveShapedJsonDocumentCollection(
}
// create a temporary deleter object for the marker
// this will destroy the marker in case the write-locker throws an exception on creation
// this will destroy the marker in case the write-locker throws an exception
// on creation
std::unique_ptr<arangodb::wal::Marker> deleter;
if (marker != nullptr && freeMarker) {
deleter.reset(marker);
}
arangodb::CollectionWriteLocker collectionLocker(document, lock);
// if we got here, the marker must not be deleted by the deleter, but will be handed to
// if we got here, the marker must not be deleted by the deleter, but will
// be handed to
// the document operation, which will take over
deleter.release();
@ -4858,13 +4931,10 @@ int TRI_RemoveShapedJsonDocumentCollection(
}
}
#warning TODO
#if 0
if (markerTick > 0) {
// need to wait for tick, outside the lock
arangodb::wal::LogfileManager::instance()->slots()->waitForTick(markerTick);
}
#endif
return res;
}
@ -4948,7 +5018,8 @@ int TRI_InsertShapedJsonDocumentCollection(
}
// create a temporary deleter object for the marker
// this will destroy the marker in case the write-locker throws an exception on creation
// this will destroy the marker in case the write-locker throws an exception
// on creation
std::unique_ptr<arangodb::wal::Marker> deleter;
if (marker != nullptr && freeMarker) {
deleter.reset(marker);
@ -4956,7 +5027,8 @@ int TRI_InsertShapedJsonDocumentCollection(
arangodb::CollectionWriteLocker collectionLocker(document, lock);
// if we got here, the marker must not be deleted by the deleter, but will be handed to
// if we got here, the marker must not be deleted by the deleter, but will
// be handed to
// the document operation, which will take over
deleter.release();
@ -5005,13 +5077,10 @@ int TRI_InsertShapedJsonDocumentCollection(
}
}
#warning TODO
#if 0
if (markerTick > 0) {
// need to wait for tick, outside the lock
arangodb::wal::LogfileManager::instance()->slots()->waitForTick(markerTick);
}
#endif
return res;
}
@ -5116,13 +5185,10 @@ int TRI_UpdateShapedJsonDocumentCollection(
TRI_ASSERT(mptr->_rid > 0);
}
#warning TODO
#if 0
if (markerTick > 0) {
// need to wait for tick, outside the lock
arangodb::wal::LogfileManager::instance()->slots()->waitForTick(markerTick);
}
#endif
return res;
}
@ -5200,13 +5266,10 @@ int TRI_document_collection_t::insert(Transaction* trx, VPackSlice const* slice,
}
}
#warning TODO
#if 0
if (markerTick > 0) {
// need to wait for tick, outside the lock
arangodb::wal::LogfileManager::instance()->slots()->waitForTick(markerTick);
}
#endif
return res;
}
@ -5294,13 +5357,10 @@ int TRI_document_collection_t::remove(arangodb::Transaction* trx,
}
}
#warning TODO
#if 0
if (markerTick > 0) {
// need to wait for tick, outside the lock
arangodb::wal::LogfileManager::instance()->slots()->waitForTick(markerTick);
}
#endif
return res;
}
@ -5446,7 +5506,10 @@ int TRI_document_collection_t::insertPrimaryIndex(arangodb::Transaction* trx,
// we found a previous revision in the index
// the found revision is still alive
LOG(TRACE) << "document '" << TRI_EXTRACT_MARKER_KEY(header) << "' already existed with revision " << // ONLY IN INDEX << " while creating revision " << PROTECTED by RUNTIME
LOG(TRACE) << "document '" << TRI_EXTRACT_MARKER_KEY(header)
<< "' already existed with revision "
<< // ONLY IN INDEX << " while creating revision " << PROTECTED by
// RUNTIME
(unsigned long long)found->_rid;
return TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED;

View File

@ -1394,8 +1394,6 @@ int TRI_DumpLogReplication(
std::unordered_set<TRI_voc_tid_t> const& transactionIds,
TRI_voc_tick_t firstRegularTick, TRI_voc_tick_t tickMin,
TRI_voc_tick_t tickMax, bool outputAsArray) {
#warning TODO
#if 0
LOG(TRACE) << "dumping log, tick range " << tickMin << " - " << tickMax;
// ask the logfile manager which datafiles qualify
@ -1520,7 +1518,6 @@ int TRI_DumpLogReplication(
}
return res;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -1530,8 +1527,6 @@ int TRI_DumpLogReplication(
int TRI_DetermineOpenTransactionsReplication(TRI_replication_dump_t* dump,
TRI_voc_tick_t tickMin,
TRI_voc_tick_t tickMax) {
#warning TODO
#if 0
LOG(TRACE) << "determining transactions, tick range " << tickMin << " - " << tickMax;
std::unordered_map<TRI_voc_tid_t, TRI_voc_tick_t> transactions;
@ -1654,5 +1649,4 @@ int TRI_DetermineOpenTransactionsReplication(TRI_replication_dump_t* dump,
arangodb::wal::LogfileManager::instance()->returnLogfiles(logfiles);
return res;
#endif
}

View File

@ -623,8 +623,6 @@ static int ReleaseCollections(TRI_transaction_t* trx, int nestingLevel) {
////////////////////////////////////////////////////////////////////////////////
static int WriteBeginMarker(TRI_transaction_t* trx) {
#warning TODO
#if 0
if (!NeedWriteMarker(trx, true)) {
return TRI_ERROR_NO_ERROR;
}
@ -657,7 +655,6 @@ static int WriteBeginMarker(TRI_transaction_t* trx) {
}
return res;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -665,8 +662,6 @@ static int WriteBeginMarker(TRI_transaction_t* trx) {
////////////////////////////////////////////////////////////////////////////////
static int WriteAbortMarker(TRI_transaction_t* trx) {
#warning TODO
#if 0
if (!NeedWriteMarker(trx, false)) {
return TRI_ERROR_NO_ERROR;
}
@ -695,7 +690,6 @@ static int WriteAbortMarker(TRI_transaction_t* trx) {
}
return res;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -703,8 +697,6 @@ static int WriteAbortMarker(TRI_transaction_t* trx) {
////////////////////////////////////////////////////////////////////////////////
static int WriteCommitMarker(TRI_transaction_t* trx) {
#warning TODO
#if 0
if (!NeedWriteMarker(trx, false)) {
return TRI_ERROR_NO_ERROR;
}
@ -729,7 +721,6 @@ static int WriteCommitMarker(TRI_transaction_t* trx) {
}
return res;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -796,8 +787,6 @@ TRI_transaction_t* TRI_CreateTransaction(TRI_vocbase_t* vocbase,
////////////////////////////////////////////////////////////////////////////////
void TRI_FreeTransaction(TRI_transaction_t* trx) {
#warning TODO
#if 0
TRI_ASSERT(trx != nullptr);
if (trx->_status == TRI_TRANSACTION_RUNNING) {
@ -825,7 +814,6 @@ void TRI_FreeTransaction(TRI_transaction_t* trx) {
TRI_DestroyVectorPointer(&trx->_collections);
TRI_Free(TRI_UNKNOWN_MEM_ZONE, trx);
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -1081,8 +1069,6 @@ bool TRI_IsContainedCollectionTransaction(TRI_transaction_t* trx,
int TRI_AddOperationTransaction(TRI_transaction_t* trx,
arangodb::wal::DocumentOperation& operation,
bool& waitForSync) {
#warning TODO
#if 0
TRI_ASSERT(operation.header != nullptr);
bool const isSingleOperationTransaction = IsSingleOperationTransaction(trx);
@ -1271,7 +1257,6 @@ int TRI_AddOperationTransaction(TRI_transaction_t* trx,
TRI_IF_FAILURE("TransactionOperationAtEnd") { return TRI_ERROR_DEBUG; }
return TRI_ERROR_NO_ERROR;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -1280,8 +1265,6 @@ int TRI_AddOperationTransaction(TRI_transaction_t* trx,
int TRI_BeginTransaction(TRI_transaction_t* trx, TRI_transaction_hint_t hints,
int nestingLevel) {
#warning TODO
#if 0
LOG_TRX(trx, nestingLevel) << "beginning " << (trx->_type == TRI_TRANSACTION_READ ? "read" : "write") << " transaction";
if (nestingLevel == 0) {
@ -1343,7 +1326,6 @@ int TRI_BeginTransaction(TRI_transaction_t* trx, TRI_transaction_hint_t hints,
}
return res;
#endif
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -197,8 +197,6 @@ static bool EqualKeyCollectionName(TRI_associative_pointer_t* array,
static int WriteDropCollectionMarker(TRI_vocbase_t* vocbase,
TRI_voc_cid_t collectionId) {
#warning TODO
#if 0
int res = TRI_ERROR_NO_ERROR;
try {
@ -222,7 +220,6 @@ static int WriteDropCollectionMarker(TRI_vocbase_t* vocbase,
}
return res;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -1744,8 +1741,6 @@ TRI_vocbase_col_t* TRI_FindCollectionByNameOrCreateVocBase(
TRI_vocbase_col_t* TRI_CreateCollectionVocBase(
TRI_vocbase_t* vocbase, arangodb::VocbaseCollectionInfo& parameters,
TRI_voc_cid_t cid, bool writeMarker) {
#warning TODO
#if 0
// check that the name does not contain any strange characters
if (!TRI_IsAllowedNameCollection(parameters.isSystem(),
parameters.namec_str())) {
@ -1802,7 +1797,6 @@ TRI_vocbase_col_t* TRI_CreateCollectionVocBase(
// TODO: what to do here?
return collection;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -1890,8 +1884,6 @@ int TRI_UnloadCollectionVocBase(TRI_vocbase_t* vocbase,
int TRI_DropCollectionVocBase(TRI_vocbase_t* vocbase,
TRI_vocbase_col_t* collection, bool writeMarker) {
#warning TODO
#if 0
TRI_ASSERT(collection != nullptr);
if (!collection->_canDrop &&
@ -1932,7 +1924,6 @@ int TRI_DropCollectionVocBase(TRI_vocbase_t* vocbase,
TRI_ASSERT(state == DROP_AGAIN);
usleep(COLLECTION_STATUS_POLL_INTERVAL);
}
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -1943,8 +1934,6 @@ int TRI_RenameCollectionVocBase(TRI_vocbase_t* vocbase,
TRI_vocbase_col_t* collection,
char const* newName, bool doOverride,
bool writeMarker) {
#warning TODO
#if 0
if (!collection->_canRename) {
return TRI_set_errno(TRI_ERROR_FORBIDDEN);
}
@ -2017,7 +2006,6 @@ int TRI_RenameCollectionVocBase(TRI_vocbase_t* vocbase,
}
return res;
#endif
}
////////////////////////////////////////////////////////////////////////////////