mirror of https://gitee.com/bigwinds/arangodb
cleanup
This commit is contained in:
parent
76129430b4
commit
4845b3fc93
|
@ -272,7 +272,7 @@ TraversalNode::TraversalNode(ExecutionPlan* plan, size_t id,
|
||||||
_graphJson = arangodb::basics::Json(arangodb::basics::Json::Array, edgeColls.size());
|
_graphJson = arangodb::basics::Json(arangodb::basics::Json::Array, edgeColls.size());
|
||||||
|
|
||||||
for (auto& it : edgeColls) {
|
for (auto& it : edgeColls) {
|
||||||
_edgeColls.push_back(it);
|
_edgeColls.emplace_back(it);
|
||||||
_graphJson.add(arangodb::basics::Json(it));
|
_graphJson.add(arangodb::basics::Json(it));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,14 +353,13 @@ void PathBasedIndex::fillPaths(std::vector<std::vector<std::string>>& paths,
|
||||||
std::vector<std::string>& interior(paths.back());
|
std::vector<std::string>& interior(paths.back());
|
||||||
int expands = -1;
|
int expands = -1;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
std::vector<std::string> joinedNames;
|
|
||||||
for (auto const& att : list) {
|
for (auto const& att : list) {
|
||||||
interior.push_back(att.name);
|
interior.emplace_back(att.name);
|
||||||
if (att.shouldExpand) {
|
if (att.shouldExpand) {
|
||||||
expands = count;
|
expands = count;
|
||||||
}
|
}
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
expanding.push_back(expands);
|
expanding.emplace_back(expands);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1305,7 +1305,7 @@ static bool OpenIterator(TRI_df_marker_t const* marker, void* data,
|
||||||
if (marker->_type == TRI_DOC_MARKER_KEY_EDGE ||
|
if (marker->_type == TRI_DOC_MARKER_KEY_EDGE ||
|
||||||
marker->_type == TRI_DOC_MARKER_KEY_DOCUMENT) {
|
marker->_type == TRI_DOC_MARKER_KEY_DOCUMENT) {
|
||||||
res = OpenIteratorHandleDocumentMarker(marker, datafile,
|
res = OpenIteratorHandleDocumentMarker(marker, datafile,
|
||||||
(open_iterator_state_t*)data);
|
static_cast<open_iterator_state_t*>(data));
|
||||||
|
|
||||||
if (datafile->_dataMin == 0) {
|
if (datafile->_dataMin == 0) {
|
||||||
datafile->_dataMin = tick;
|
datafile->_dataMin = tick;
|
||||||
|
@ -1316,12 +1316,12 @@ static bool OpenIterator(TRI_df_marker_t const* marker, void* data,
|
||||||
}
|
}
|
||||||
} else if (marker->_type == TRI_DOC_MARKER_KEY_DELETION) {
|
} else if (marker->_type == TRI_DOC_MARKER_KEY_DELETION) {
|
||||||
res = OpenIteratorHandleDeletionMarker(marker, datafile,
|
res = OpenIteratorHandleDeletionMarker(marker, datafile,
|
||||||
(open_iterator_state_t*)data);
|
static_cast<open_iterator_state_t*>(data));
|
||||||
} else {
|
} else {
|
||||||
if (marker->_type == TRI_DF_MARKER_HEADER) {
|
if (marker->_type == TRI_DF_MARKER_HEADER) {
|
||||||
// ensure there is a datafile info entry for each datafile of the
|
// ensure there is a datafile info entry for each datafile of the
|
||||||
// collection
|
// collection
|
||||||
FindDatafileStats((open_iterator_state_t*)data, datafile->_fid);
|
FindDatafileStats(static_cast<open_iterator_state_t*>(data), datafile->_fid);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(TRACE) << "skipping marker type " << marker->_type;
|
LOG(TRACE) << "skipping marker type " << marker->_type;
|
||||||
|
@ -4835,7 +4835,7 @@ int TRI_document_collection_t::updateDocument(arangodb::Transaction* trx,
|
||||||
|
|
||||||
if (res == TRI_ERROR_NO_ERROR) {
|
if (res == TRI_ERROR_NO_ERROR) {
|
||||||
// write new header into result
|
// write new header into result
|
||||||
*mptr = *((TRI_doc_mptr_t*)newHeader);
|
*mptr = *newHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -529,28 +529,31 @@ TRI_replication_applier_t* TRI_CreateReplicationApplier(
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TRI_replication_applier_configuration_t::
|
TRI_replication_applier_configuration_t::
|
||||||
TRI_replication_applier_configuration_t() {
|
TRI_replication_applier_configuration_t()
|
||||||
_requestTimeout = 600.0;
|
: _endpoint(),
|
||||||
_connectTimeout = 10.0;
|
_database(),
|
||||||
_ignoreErrors = 0;
|
_username(),
|
||||||
_maxConnectRetries = 100;
|
_password(),
|
||||||
_chunkSize = 0;
|
_requestTimeout(600.0),
|
||||||
_sslProtocol = 0;
|
_connectTimeout(10.0),
|
||||||
_autoStart = false;
|
_ignoreErrors(0),
|
||||||
_adaptivePolling = true;
|
_maxConnectRetries(100),
|
||||||
_autoResync = false;
|
_chunkSize(0),
|
||||||
_includeSystem = true;
|
_connectionRetryWaitTime(15 * 1000 * 1000),
|
||||||
_requireFromPresent = false;
|
_idleMinWaitTime(1000 * 1000),
|
||||||
_verbose = false;
|
_idleMaxWaitTime(5 * 500 * 1000),
|
||||||
_incremental = false;
|
_initialSyncMaxWaitTime(300 * 1000 * 1000),
|
||||||
_restrictType = "";
|
_autoResyncRetries(2),
|
||||||
_restrictCollections.clear();
|
_sslProtocol(0),
|
||||||
_connectionRetryWaitTime = 15 * 1000 * 1000;
|
_autoStart(false),
|
||||||
_initialSyncMaxWaitTime = 300 * 1000 * 1000;
|
_adaptivePolling(true),
|
||||||
_idleMinWaitTime = 1000 * 1000;
|
_autoResync(false),
|
||||||
_idleMaxWaitTime = 5 * 500 * 1000;
|
_includeSystem(true),
|
||||||
_autoResyncRetries = 2;
|
_requireFromPresent(false),
|
||||||
}
|
_incremental(false),
|
||||||
|
_verbose(false),
|
||||||
|
_restrictType(),
|
||||||
|
_restrictCollections() {}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief reset the configuration to defaults
|
/// @brief reset the configuration to defaults
|
||||||
|
@ -559,10 +562,6 @@ TRI_replication_applier_configuration_t::
|
||||||
void TRI_replication_applier_configuration_t::reset() {
|
void TRI_replication_applier_configuration_t::reset() {
|
||||||
TRI_replication_applier_configuration_t empty;
|
TRI_replication_applier_configuration_t empty;
|
||||||
update(&empty);
|
update(&empty);
|
||||||
_endpoint.clear();
|
|
||||||
_database.clear();
|
|
||||||
_username.clear();
|
|
||||||
_password.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "Basics/Logger.h"
|
#include "Basics/Logger.h"
|
||||||
#include "Basics/memory-map.h"
|
#include "Basics/memory-map.h"
|
||||||
#include "Basics/MutexLocker.h"
|
#include "Basics/MutexLocker.h"
|
||||||
|
#include "Basics/VelocyPackHelper.h"
|
||||||
#include "Indexes/PrimaryIndex.h"
|
#include "Indexes/PrimaryIndex.h"
|
||||||
#include "Utils/CollectionGuard.h"
|
#include "Utils/CollectionGuard.h"
|
||||||
#include "Utils/DatabaseGuard.h"
|
#include "Utils/DatabaseGuard.h"
|
||||||
|
@ -635,7 +636,7 @@ void CollectorThread::processCollectionMarker(
|
||||||
dfi.numberUncollected--;
|
dfi.numberUncollected--;
|
||||||
|
|
||||||
VPackSlice slice(reinterpret_cast<char const*>(walMarker) + VPackOffset(TRI_WAL_MARKER_VPACK_DOCUMENT));
|
VPackSlice slice(reinterpret_cast<char const*>(walMarker) + VPackOffset(TRI_WAL_MARKER_VPACK_DOCUMENT));
|
||||||
TRI_voc_rid_t revisionId = std::stoull(slice.get(TRI_VOC_ATTRIBUTE_REV).copyString());
|
TRI_voc_rid_t revisionId = arangodb::basics::VelocyPackHelper::stringUInt64(slice.get(TRI_VOC_ATTRIBUTE_REV));
|
||||||
|
|
||||||
auto found = document->primaryIndex()->lookupKey(&trx, slice.get(TRI_VOC_ATTRIBUTE_KEY));
|
auto found = document->primaryIndex()->lookupKey(&trx, slice.get(TRI_VOC_ATTRIBUTE_KEY));
|
||||||
|
|
||||||
|
@ -665,7 +666,7 @@ void CollectorThread::processCollectionMarker(
|
||||||
dfi.numberDeletions++;
|
dfi.numberDeletions++;
|
||||||
|
|
||||||
VPackSlice slice(reinterpret_cast<char const*>(walMarker) + VPackOffset(TRI_WAL_MARKER_VPACK_REMOVE));
|
VPackSlice slice(reinterpret_cast<char const*>(walMarker) + VPackOffset(TRI_WAL_MARKER_VPACK_REMOVE));
|
||||||
TRI_voc_rid_t revisionId = std::stoull(slice.get(TRI_VOC_ATTRIBUTE_REV).copyString());
|
TRI_voc_rid_t revisionId = arangodb::basics::VelocyPackHelper::stringUInt64(slice.get(TRI_VOC_ATTRIBUTE_REV));
|
||||||
|
|
||||||
auto found = document->primaryIndex()->lookupKey(&trx, slice.get(TRI_VOC_ATTRIBUTE_KEY));
|
auto found = document->primaryIndex()->lookupKey(&trx, slice.get(TRI_VOC_ATTRIBUTE_KEY));
|
||||||
|
|
||||||
|
|
|
@ -29,17 +29,6 @@
|
||||||
|
|
||||||
using namespace arangodb::basics;
|
using namespace arangodb::basics;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief convert a uint64 into a JSON string
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_json_t* JsonHelper::uint64String(TRI_memory_zone_t* zone, uint64_t value) {
|
|
||||||
char buffer[21];
|
|
||||||
size_t len = TRI_StringUInt64InPlace(value, (char*)&buffer);
|
|
||||||
|
|
||||||
return TRI_CreateStringCopyJson(zone, buffer, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief convert a JSON string or number into a uint64
|
/// @brief convert a JSON string or number into a uint64
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -70,62 +59,6 @@ uint64_t JsonHelper::stringUInt64(TRI_json_t const* json, char const* name) {
|
||||||
return stringUInt64(element);
|
return stringUInt64(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief creates a JSON key/value object from a key/value of strings
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_json_t* JsonHelper::stringObject(
|
|
||||||
TRI_memory_zone_t* zone, std::map<std::string, std::string> const& values) {
|
|
||||||
TRI_json_t* json = TRI_CreateObjectJson(zone, values.size());
|
|
||||||
|
|
||||||
if (json == nullptr) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<std::string, std::string>::const_iterator it;
|
|
||||||
for (it = values.begin(); it != values.end(); ++it) {
|
|
||||||
std::string const key = (*it).first;
|
|
||||||
std::string const value = (*it).second;
|
|
||||||
|
|
||||||
TRI_json_t* v = TRI_CreateStringCopyJson(zone, value.c_str(), value.size());
|
|
||||||
if (v != nullptr) {
|
|
||||||
TRI_Insert3ObjectJson(zone, json, key.c_str(), v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief creates a key/value object of strings from a JSON (sub-) object
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
std::map<std::string, std::string> JsonHelper::stringObject(
|
|
||||||
TRI_json_t const* json) {
|
|
||||||
std::map<std::string, std::string> result;
|
|
||||||
|
|
||||||
if (isObject(json)) {
|
|
||||||
size_t const n = TRI_LengthVectorJson(json);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < n; i += 2) {
|
|
||||||
auto k = static_cast<TRI_json_t const*>(
|
|
||||||
TRI_AtVector(&json->_value._objects, i));
|
|
||||||
auto v = static_cast<TRI_json_t const*>(
|
|
||||||
TRI_AtVector(&json->_value._objects, i + 1));
|
|
||||||
|
|
||||||
if (isString(k) && isString(v)) {
|
|
||||||
std::string const key =
|
|
||||||
std::string(k->_value._string.data, k->_value._string.length - 1);
|
|
||||||
std::string const value =
|
|
||||||
std::string(v->_value._string.data, v->_value._string.length - 1);
|
|
||||||
result.emplace(std::make_pair(key, value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief creates a JSON object from an array of strings
|
/// @brief creates a JSON object from an array of strings
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -42,11 +42,6 @@ class JsonHelper {
|
||||||
~JsonHelper() = delete;
|
~JsonHelper() = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief convert a uint64 into a JSON string
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
static TRI_json_t* uint64String(TRI_memory_zone_t*, uint64_t);
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief convert a uint64 into a JSON string
|
/// @brief convert a uint64 into a JSON string
|
||||||
|
@ -60,19 +55,6 @@ class JsonHelper {
|
||||||
|
|
||||||
static uint64_t stringUInt64(TRI_json_t const*, char const*);
|
static uint64_t stringUInt64(TRI_json_t const*, char const*);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief creates a JSON object from a key/value object of strings
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
static TRI_json_t* stringObject(TRI_memory_zone_t*,
|
|
||||||
std::map<std::string, std::string> const&);
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief creates a key/value object of strings from a JSON (sub-) object
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
static std::map<std::string, std::string> stringObject(TRI_json_t const*);
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief creates a JSON object from an array of strings
|
/// @brief creates a JSON object from an array of strings
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -403,8 +403,8 @@ static int AppendJsonEncodedValue(TRI_string_buffer_t* self, char const*& ptr,
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TRI_string_buffer_t* TRI_CreateStringBuffer(TRI_memory_zone_t* zone) {
|
TRI_string_buffer_t* TRI_CreateStringBuffer(TRI_memory_zone_t* zone) {
|
||||||
TRI_string_buffer_t* self = (TRI_string_buffer_t*)TRI_Allocate(
|
auto self = static_cast<TRI_string_buffer_t*>(TRI_Allocate(
|
||||||
zone, sizeof(TRI_string_buffer_t), false);
|
zone, sizeof(TRI_string_buffer_t), false));
|
||||||
|
|
||||||
if (self == nullptr) {
|
if (self == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -421,8 +421,8 @@ TRI_string_buffer_t* TRI_CreateStringBuffer(TRI_memory_zone_t* zone) {
|
||||||
|
|
||||||
TRI_string_buffer_t* TRI_CreateSizedStringBuffer(TRI_memory_zone_t* zone,
|
TRI_string_buffer_t* TRI_CreateSizedStringBuffer(TRI_memory_zone_t* zone,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
TRI_string_buffer_t* self = (TRI_string_buffer_t*)TRI_Allocate(
|
auto self = static_cast<TRI_string_buffer_t*>(TRI_Allocate(
|
||||||
zone, sizeof(TRI_string_buffer_t), false);
|
zone, sizeof(TRI_string_buffer_t), false));
|
||||||
|
|
||||||
if (self == nullptr) {
|
if (self == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Reference in New Issue