diff --git a/arangod/VocBase/compactor.cpp b/arangod/VocBase/compactor.cpp index 0f44024a3f..45c3be07c1 100644 --- a/arangod/VocBase/compactor.cpp +++ b/arangod/VocBase/compactor.cpp @@ -440,8 +440,6 @@ static bool Compactifier (TRI_df_marker_t const* marker, if (marker->_type == TRI_DOC_MARKER_KEY_DOCUMENT || marker->_type == TRI_DOC_MARKER_KEY_EDGE) { - bool deleted; - TRI_doc_document_key_marker_t const* d = reinterpret_cast(marker); TRI_voc_key_t key = (char*) d + d->_offsetKey; @@ -449,7 +447,7 @@ static bool Compactifier (TRI_df_marker_t const* marker, auto primaryIndex = document->primaryIndex(); auto found = static_cast(primaryIndex->lookupKey(key)); - deleted = (found == nullptr || found->_rid > d->_rid); + bool deleted = (found == nullptr || found->_rid > d->_rid); if (deleted) { LOG_TRACE("found a stale document: %s", key); diff --git a/arangod/VocBase/replication-applier.cpp b/arangod/VocBase/replication-applier.cpp index 1f5a38b7da..d71f4549d0 100644 --- a/arangod/VocBase/replication-applier.cpp +++ b/arangod/VocBase/replication-applier.cpp @@ -1157,13 +1157,14 @@ int TRI_replication_applier_t::start (TRI_voc_tick_t initialTick, syncer.release(); if (useTick) { - LOG_INFO("started replication applier for database '%s' from tick %llu", + LOG_INFO("started replication applier for database '%s', endpoint '%s' from tick %llu", _databaseName.c_str(), + _configuration._endpoint, (unsigned long long) initialTick); } else { - LOG_INFO("re-started replication applier for database '%s'", - _databaseName.c_str()); + LOG_INFO("re-started replication applier for database '%s', endpoint '%s'", + _databaseName.c_str(), _configuration._endpoint); } return TRI_ERROR_NO_ERROR; diff --git a/arangosh/V8Client/arangodump.cpp b/arangosh/V8Client/arangodump.cpp index e25d780d42..b125266713 100644 --- a/arangosh/V8Client/arangodump.cpp +++ b/arangosh/V8Client/arangodump.cpp @@ -493,7 +493,7 @@ static int DumpCollection (int fd, uint64_t chunkSize = ChunkSize; std::string const baseUrl = "/_api/replication/dump?collection=" + cid + - "&ticks=false&translateIds=true&flush=false"; + "&ticks=false&translateIds=true&flush=false"; uint64_t fromTick = TickStart; @@ -1210,7 +1210,7 @@ int main (int argc, char* argv[]) { } if (TickStart < TickEnd) { - cerr << "invalid values for --tick-start or --tick-end" << endl; + cerr << "Error: invalid values for --tick-start or --tick-end" << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } @@ -1242,12 +1242,12 @@ int main (int argc, char* argv[]) { if (OutputDirectory.empty() || (TRI_ExistsFile(OutputDirectory.c_str()) && ! isDirectory)) { - cerr << "cannot write to output directory '" << OutputDirectory << "'" << endl; + cerr << "Error: cannot write to output directory '" << OutputDirectory << "'" << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } if (isDirectory && ! isEmptyDirectory && ! Overwrite) { - cerr << "output directory '" << OutputDirectory << "' already exists. use \"--overwrite true\" to overwrite data in it" << endl; + cerr << "Error: output directory '" << OutputDirectory << "' already exists. use \"--overwrite true\" to overwrite data in it" << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } @@ -1276,11 +1276,6 @@ int main (int argc, char* argv[]) { Client = new SimpleHttpClient(Connection, BaseClient.requestTimeout(), false); - if (Client == nullptr) { - cerr << "out of memory" << endl; - TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); - } - Client->setLocationRewriter(0, &rewriteLocation); Client->setUserNamePassword("/", BaseClient.username(), BaseClient.password()); @@ -1301,7 +1296,7 @@ int main (int argc, char* argv[]) { int minor = 0; if (sscanf(versionString.c_str(), "%d.%d", &major, &minor) != 2) { - cerr << "invalid server version '" << versionString << "'" << endl; + cerr << "Error: invalid server version '" << versionString << "'" << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } @@ -1309,7 +1304,7 @@ int main (int argc, char* argv[]) { major > 2 || (major == 1 && minor < 4)) { // we can connect to 1.4, 2.0 and higher only - cerr << "got incompatible server version '" << versionString << "'" << endl; + cerr << "Error: got incompatible server version '" << versionString << "'" << endl; if (! Force) { TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } @@ -1320,7 +1315,7 @@ int main (int argc, char* argv[]) { clusterMode = GetArangoIsCluster(); if (clusterMode) { if (TickStart != 0 || TickEnd != 0) { - cerr << "cannot use tick-start or tick-end on a cluster" << endl; + cerr << "Error: cannot use tick-start or tick-end on a cluster" << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } } @@ -1339,7 +1334,7 @@ int main (int argc, char* argv[]) { int res = TRI_CreateDirectory(OutputDirectory.c_str(),systemError, errorMessage); if (res != TRI_ERROR_NO_ERROR) { - cerr << "unable to create output directory '" << OutputDirectory << "': " << errorMessage << endl; + cerr << "Error: unable to create output directory '" << OutputDirectory << "': " << errorMessage << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } } @@ -1378,11 +1373,11 @@ int main (int argc, char* argv[]) { } } catch (std::exception const& ex) { - cerr << "caught exception " << ex.what() << endl; + cerr << "Error: caught exception " << ex.what() << endl; res = TRI_ERROR_INTERNAL; } catch (...) { - cerr << "caught unknown exception" << endl; + cerr << "Error: caught unknown exception" << endl; res = TRI_ERROR_INTERNAL; } @@ -1398,7 +1393,9 @@ int main (int argc, char* argv[]) { } if (res != TRI_ERROR_NO_ERROR) { - cerr << errorMsg << endl; + if (! errorMsg.empty()) { + cerr << "Error: " << errorMsg << endl; + } ret = EXIT_FAILURE; } diff --git a/arangosh/V8Client/arangorestore.cpp b/arangosh/V8Client/arangorestore.cpp index fc0769d5b7..1aeb511a4a 100644 --- a/arangosh/V8Client/arangorestore.cpp +++ b/arangosh/V8Client/arangorestore.cpp @@ -915,12 +915,12 @@ int main (int argc, char* argv[]) { // ............................................................................. if (InputDirectory == "" || ! TRI_IsDirectory(InputDirectory.c_str())) { - cerr << "input directory '" << InputDirectory << "' does not exist" << endl; + cerr << "Error: input directory '" << InputDirectory << "' does not exist" << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } if (! ImportStructure && ! ImportData) { - cerr << "must specify either --create-collection or --import-data" << endl; + cerr << "Error: must specify either --create-collection or --import-data" << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } @@ -931,7 +931,7 @@ int main (int argc, char* argv[]) { BaseClient.createEndpoint(); if (BaseClient.endpointServer() == nullptr) { - cerr << "invalid value for --server.endpoint ('" << BaseClient.endpointString() << "')" << endl; + cerr << "Error: invalid value for --server.endpoint ('" << BaseClient.endpointString() << "')" << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } @@ -941,18 +941,8 @@ int main (int argc, char* argv[]) { ArangoClient::DEFAULT_RETRIES, BaseClient.sslProtocol()); - if (Connection == nullptr) { - cerr << "out of memory" << endl; - TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); - } - Client = new SimpleHttpClient(Connection, BaseClient.requestTimeout(), false); - if (Client == nullptr) { - cerr << "out of memory" << endl; - TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); - } - Client->setLocationRewriter(nullptr, &rewriteLocation); Client->setUserNamePassword("/", BaseClient.username(), BaseClient.password()); @@ -995,7 +985,7 @@ int main (int argc, char* argv[]) { int minor = 0; if (sscanf(versionString.c_str(), "%d.%d", &major, &minor) != 2) { - cerr << "invalid server version '" << versionString << "'" << endl; + cerr << "Error: invalid server version '" << versionString << "'" << endl; TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } @@ -1003,7 +993,7 @@ int main (int argc, char* argv[]) { major > 2 || (major == 1 && minor < 4)) { // we can connect to 1.4, 2.0 and higher only - cerr << "got incompatible server version '" << versionString << "'" << endl; + cerr << "Error: got incompatible server version '" << versionString << "'" << endl; if (! Force) { TRI_EXIT_FUNCTION(EXIT_FAILURE, nullptr); } @@ -1027,11 +1017,11 @@ int main (int argc, char* argv[]) { res = ProcessInputDirectory(errorMsg); } catch (std::exception const& ex) { - cerr << "caught exception " << ex.what() << endl; + cerr << "Error: caught exception " << ex.what() << endl; res = TRI_ERROR_INTERNAL; } catch (...) { - cerr << "caught unknown exception" << endl; + cerr << "Error: caught unknown exception" << endl; res = TRI_ERROR_INTERNAL; } @@ -1049,7 +1039,9 @@ int main (int argc, char* argv[]) { if (res != TRI_ERROR_NO_ERROR) { - cerr << errorMsg << endl; + if (! errorMsg.empty()) { + cerr << "Error: " << errorMsg << endl; + } ret = EXIT_FAILURE; }