1
0
Fork 0

fix various small annoyances (#9078)

This commit is contained in:
Jan 2019-05-23 17:37:34 +02:00 committed by GitHub
parent e721dd805d
commit e440a1c7d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 16 deletions

View File

@ -250,7 +250,7 @@ bool AgencyWriteTransaction::validate(AgencyCommResult const& result) const {
} }
std::string AgencyWriteTransaction::randomClientId() { std::string AgencyWriteTransaction::randomClientId() {
std::string uuid = to_string(boost::uuids::random_generator()()), id; std::string uuid = to_string(boost::uuids::random_generator()());
auto ss = ServerState::instance(); auto ss = ServerState::instance();
if (ss != nullptr && !ss->getId().empty()) { if (ss != nullptr && !ss->getId().empty()) {

View File

@ -963,7 +963,6 @@ trans_ret_t Agent::transact(query_t const& queries) {
// own conclusions. The map of ongoing trxs is only to cover the time // own conclusions. The map of ongoing trxs is only to cover the time
// from when we receive the request until we have appended the trxs // from when we receive the request until we have appended the trxs
// ourselves. // ourselves.
ret = std::make_shared<arangodb::velocypack::Builder>();
failed = 0; failed = 0;
ret->openArray(); ret->openArray();
// Only leader else redirect // Only leader else redirect

View File

@ -21,6 +21,8 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "ClusterCollectionCreationInfo.h" #include "ClusterCollectionCreationInfo.h"
#include "Basics/StaticStrings.h"
#include "Basics/VelocyPackHelper.h"
#include <velocypack/Builder.h> #include <velocypack/Builder.h>
#include <velocypack/Collection.h> #include <velocypack/Collection.h>

View File

@ -21,13 +21,11 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_CLUSTER_CLUSTER_COLLECTION_CREATION_INFO_H #ifndef ARANGOD_CLUSTER_CLUSTER_COLLECTION_CREATION_INFO_H
#define ARANGOD_CLUSTER_CLUSTER_COLLECTION_CREATION__INFO_H 1 #define ARANGOD_CLUSTER_CLUSTER_COLLECTION_CREATION_INFO_H 1
#include "Basics/Common.h" #include "Basics/Common.h"
#include "Basics/StaticStrings.h" #include <velocypack/Builder.h>
#include "Basics/VelocyPackHelper.h"
#include <velocypack/Slice.h> #include <velocypack/Slice.h>
namespace arangodb { namespace arangodb {
@ -45,14 +43,14 @@ struct ClusterCollectionCreationInfo {
std::string name; std::string name;
State state; State state;
public: public:
velocypack::Slice const isBuildingSlice() const; velocypack::Slice const isBuildingSlice() const;
private: private:
velocypack::Builder _isBuildingJson;
private:
bool needsBuildingFlag() const; bool needsBuildingFlag() const;
private:
velocypack::Builder _isBuildingJson;
}; };
} // namespace arangodb } // namespace arangodb

View File

@ -54,7 +54,7 @@ class DatabaseManagerThread final : public Thread {
private: private:
// how long will the thread pause between iterations // how long will the thread pause between iterations
static constexpr unsigned long waitTime() { return 500 * 1000; } static constexpr unsigned long waitTime() { return 500U * 1000U; }
}; };
class DatabaseFeature : public application_features::ApplicationFeature { class DatabaseFeature : public application_features::ApplicationFeature {

View File

@ -3400,7 +3400,7 @@ Result Methods::replicateOperations(LogicalCollection const& collection,
count++; count++;
} }
if (count <= 0) { if (count == 0) {
return Result{}; return Result{};
} }

View File

@ -263,7 +263,6 @@ Result Collections::create(TRI_vocbase_t* vocbase,
TRI_ASSERT(infoSlice.isArray()); TRI_ASSERT(infoSlice.isArray());
TRI_ASSERT(infoSlice.length() >= 1); TRI_ASSERT(infoSlice.length() >= 1);
TRI_ASSERT(infoSlice.length() == infos.size()); TRI_ASSERT(infoSlice.length() == infos.size());
collections.reserve(infoSlice.length() >= 1);
try { try {
if (ServerState::instance()->isCoordinator()) { if (ServerState::instance()->isCoordinator()) {
collections = collections =
@ -275,6 +274,7 @@ Result Collections::create(TRI_vocbase_t* vocbase,
return Result(TRI_ERROR_INTERNAL, "createCollectionsOnCoordinator"); return Result(TRI_ERROR_INTERNAL, "createCollectionsOnCoordinator");
} }
} else { } else {
collections.reserve(infoSlice.length());
for (auto slice : VPackArrayIterator(infoSlice)) { for (auto slice : VPackArrayIterator(infoSlice)) {
// Single server does not yet have a multi collection implementation // Single server does not yet have a multi collection implementation
auto col = vocbase->createCollection(slice); auto col = vocbase->createCollection(slice);

View File

@ -2291,7 +2291,7 @@ static void JS_CopyFile(v8::FunctionCallbackInfo<v8::Value> const& args) {
if (destinationIsDirectory) { if (destinationIsDirectory) {
char const* file = strrchr(source.c_str(), TRI_DIR_SEPARATOR_CHAR); char const* file = strrchr(source.c_str(), TRI_DIR_SEPARATOR_CHAR);
if (file == nullptr) { if (file == nullptr) {
if (destination[destination.length()] == TRI_DIR_SEPARATOR_CHAR) { if (!destination.empty() && destination.back() != TRI_DIR_SEPARATOR_CHAR) {
destination += TRI_DIR_SEPARATOR_CHAR; destination += TRI_DIR_SEPARATOR_CHAR;
} }
destination += source; destination += source;