mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
db6b089c5f
|
@ -133,11 +133,13 @@ class Buffer {
|
||||||
inline ValueLength length() const { return _pos; }
|
inline ValueLength length() const { return _pos; }
|
||||||
inline ValueLength byteSize() const { return _pos; }
|
inline ValueLength byteSize() const { return _pos; }
|
||||||
|
|
||||||
|
inline ValueLength capacity() const noexcept { return _alloc; }
|
||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
return std::string(reinterpret_cast<char const*>(_buffer), _pos);
|
return std::string(reinterpret_cast<char const*>(_buffer), _pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() noexcept {
|
||||||
_pos = 0;
|
_pos = 0;
|
||||||
initWithNone();
|
initWithNone();
|
||||||
}
|
}
|
||||||
|
@ -243,15 +245,16 @@ class Buffer {
|
||||||
// reserve and zero fill
|
// reserve and zero fill
|
||||||
void prealloc(ValueLength len) {
|
void prealloc(ValueLength len) {
|
||||||
reserve(len);
|
reserve(len);
|
||||||
// memset(_buffer + _pos, 0, len);
|
#ifdef VELOCYPACK_DEBUG
|
||||||
|
// poison memory
|
||||||
|
memset(_buffer + _pos, 0xa5, len);
|
||||||
|
#endif
|
||||||
_pos += len;
|
_pos += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// initialize Buffer with a None value
|
// initialize Buffer with a None value
|
||||||
inline void initWithNone() { _buffer[0] = '\x00'; }
|
inline void initWithNone() noexcept { _buffer[0] = '\x00'; }
|
||||||
|
|
||||||
inline ValueLength capacity() const { return _alloc; }
|
|
||||||
|
|
||||||
T* _buffer;
|
T* _buffer;
|
||||||
ValueLength _alloc;
|
ValueLength _alloc;
|
||||||
|
|
|
@ -98,7 +98,7 @@ class Builder {
|
||||||
void reserveSpace(ValueLength len) {
|
void reserveSpace(ValueLength len) {
|
||||||
// Reserves len bytes at pos of the current state (top of stack)
|
// Reserves len bytes at pos of the current state (top of stack)
|
||||||
// or throws an exception
|
// or throws an exception
|
||||||
if (_pos + len <= _size) {
|
if (_pos + len < _size) {
|
||||||
return; // All OK, we can just increase tos->pos by len
|
return; // All OK, we can just increase tos->pos by len
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,8 +496,8 @@ class Builder {
|
||||||
|
|
||||||
void addDouble(double v) {
|
void addDouble(double v) {
|
||||||
uint64_t dv;
|
uint64_t dv;
|
||||||
memcpy(&dv, &v, sizeof(double));
|
|
||||||
ValueLength vSize = sizeof(double);
|
ValueLength vSize = sizeof(double);
|
||||||
|
memcpy(&dv, &v, vSize);
|
||||||
reserveSpace(1 + vSize);
|
reserveSpace(1 + vSize);
|
||||||
_start[_pos++] = 0x1b;
|
_start[_pos++] = 0x1b;
|
||||||
for (uint64_t x = dv; vSize > 0; vSize--) {
|
for (uint64_t x = dv; vSize > 0; vSize--) {
|
||||||
|
@ -528,11 +528,10 @@ class Builder {
|
||||||
}
|
}
|
||||||
|
|
||||||
void addUTCDate(int64_t v) {
|
void addUTCDate(int64_t v) {
|
||||||
uint8_t const vSize = sizeof(int64_t); // is always 8
|
constexpr uint8_t vSize = sizeof(int64_t); // is always 8
|
||||||
uint64_t x = toUInt64(v);
|
|
||||||
reserveSpace(1 + vSize);
|
reserveSpace(1 + vSize);
|
||||||
_start[_pos++] = 0x1c;
|
_start[_pos++] = 0x1c;
|
||||||
appendLength<8>(x);
|
appendLength<vSize>(toUInt64(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* addString(uint64_t strLen) {
|
uint8_t* addString(uint64_t strLen) {
|
||||||
|
|
|
@ -41,6 +41,9 @@
|
||||||
#include "velocypack/Sink.h"
|
#include "velocypack/Sink.h"
|
||||||
#include "velocypack/Slice.h"
|
#include "velocypack/Slice.h"
|
||||||
#include "velocypack/SliceContainer.h"
|
#include "velocypack/SliceContainer.h"
|
||||||
|
#include "velocypack/StringRef.h"
|
||||||
|
#include "velocypack/Utf8Helper.h"
|
||||||
|
#include "velocypack/Validator.h"
|
||||||
#include "velocypack/Value.h"
|
#include "velocypack/Value.h"
|
||||||
#include "velocypack/ValueType.h"
|
#include "velocypack/ValueType.h"
|
||||||
#include "velocypack/Version.h"
|
#include "velocypack/Version.h"
|
||||||
|
|
|
@ -360,7 +360,8 @@ Builder& Builder::close() {
|
||||||
std::vector<ValueLength>& index = _index[_stack.size() - 1];
|
std::vector<ValueLength>& index = _index[_stack.size() - 1];
|
||||||
|
|
||||||
if (index.empty()) {
|
if (index.empty()) {
|
||||||
return closeEmptyArrayOrObject(tos, isArray);
|
closeEmptyArrayOrObject(tos, isArray);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// From now on index.size() > 0
|
// From now on index.size() > 0
|
||||||
|
@ -377,7 +378,8 @@ Builder& Builder::close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isArray) {
|
if (isArray) {
|
||||||
return closeArray(tos, index);
|
closeArray(tos, index);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix head byte in case a compact Array / Object was originally requested
|
// fix head byte in case a compact Array / Object was originally requested
|
||||||
|
@ -569,7 +571,7 @@ uint8_t* Builder::set(Value const& item) {
|
||||||
reserveSpace(1 + sizeof(double));
|
reserveSpace(1 + sizeof(double));
|
||||||
_start[_pos++] = 0x1b;
|
_start[_pos++] = 0x1b;
|
||||||
memcpy(&x, &v, sizeof(double));
|
memcpy(&x, &v, sizeof(double));
|
||||||
appendLength<8>(x);
|
appendLength<sizeof(double)>(x);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ValueType::External: {
|
case ValueType::External: {
|
||||||
|
|
|
@ -1336,9 +1336,10 @@ function startInstanceCluster (instanceInfo, protocol, options,
|
||||||
};
|
};
|
||||||
|
|
||||||
options.agencyWaitForSync = false;
|
options.agencyWaitForSync = false;
|
||||||
|
let usedPorts = [];
|
||||||
|
options.usedPorts = usedPorts;
|
||||||
startInstanceAgency(instanceInfo, protocol, options, ...makeArgs('agency', 'agency', {}));
|
startInstanceAgency(instanceInfo, protocol, options, ...makeArgs('agency', 'agency', {}));
|
||||||
|
|
||||||
let usedPorts = [];
|
|
||||||
let agencyEndpoint = instanceInfo.endpoint;
|
let agencyEndpoint = instanceInfo.endpoint;
|
||||||
let i;
|
let i;
|
||||||
for (i = 0; i < options.dbServers; i++) {
|
for (i = 0; i < options.dbServers; i++) {
|
||||||
|
@ -1474,7 +1475,7 @@ function startInstanceAgency (instanceInfo, protocol, options, addArgs, rootDir)
|
||||||
}
|
}
|
||||||
const wfs = options.agencyWaitForSync;
|
const wfs = options.agencyWaitForSync;
|
||||||
|
|
||||||
let usedPorts = [];
|
let usedPorts = options.usedPorts || [];
|
||||||
for (let i = 0; i < N; i++) {
|
for (let i = 0; i < N; i++) {
|
||||||
let instanceArgs = _.clone(addArgs);
|
let instanceArgs = _.clone(addArgs);
|
||||||
instanceArgs['log.file'] = fs.join(rootDir, 'log' + String(i));
|
instanceArgs['log.file'] = fs.join(rootDir, 'log' + String(i));
|
||||||
|
|
|
@ -49,7 +49,6 @@ function runSetup () {
|
||||||
if (db._collection('UnitTestsRecovery').status() === ArangoCollection.STATUS_UNLOADED) {
|
if (db._collection('UnitTestsRecovery').status() === ArangoCollection.STATUS_UNLOADED) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
internal.print(db._collection('UnitTestsRecovery').status());
|
|
||||||
internal.wait(0.5, true);
|
internal.wait(0.5, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,15 +64,6 @@ function recoverySuite () {
|
||||||
|
|
||||||
testIndexesAfterFlush: function () {
|
testIndexesAfterFlush: function () {
|
||||||
var c = db._collection('UnitTestsRecovery'), idx;
|
var c = db._collection('UnitTestsRecovery'), idx;
|
||||||
// debugging information - to be removed
|
|
||||||
var fs = require("fs");
|
|
||||||
var print = require("internal").print;
|
|
||||||
var f = fs.listTree(c.path());
|
|
||||||
print(f);
|
|
||||||
for (var i = 1; i < f.length; ++i) {
|
|
||||||
print(f[i], fs.readFileSync(fs.join(c.path(), "parameter.json")));
|
|
||||||
}
|
|
||||||
print(fs.readFileSync(fs.join(c.path(), "parameter.json")));
|
|
||||||
|
|
||||||
assertEqual(3, c.getIndexes().length);
|
assertEqual(3, c.getIndexes().length);
|
||||||
idx = c.getIndexes()[0];
|
idx = c.getIndexes()[0];
|
||||||
|
|
|
@ -153,8 +153,7 @@ function ReplicationSuite() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compareTicks(slaveState.state.lastAppliedContinuousTick, syncResult.lastLogTick) >= 0 ||
|
if (compareTicks(slaveState.state.lastAppliedContinuousTick, syncResult.lastLogTick) >= 0 ||
|
||||||
compareTicks(slaveState.state.lastProcessedContinuousTick, syncResult.lastLogTick) >= 0) { //||
|
compareTicks(slaveState.state.lastProcessedContinuousTick, syncResult.lastLogTick) >= 0) {
|
||||||
// compareTicks(slaveState.state.lastAvailableContinuousTick, syncResult.lastLogTick) > 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +161,7 @@ function ReplicationSuite() {
|
||||||
console.log("waiting for slave to catch up");
|
console.log("waiting for slave to catch up");
|
||||||
printed = true;
|
printed = true;
|
||||||
}
|
}
|
||||||
internal.wait(5.0, false);
|
internal.wait(1.0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
db._flushCache();
|
db._flushCache();
|
||||||
|
|
Loading…
Reference in New Issue