mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into engine-api
This commit is contained in:
commit
f37a2d8014
|
@ -242,6 +242,8 @@ bool AddFollower::start() {
|
|||
pending.openObject();
|
||||
pending.add(_agencyPrefix + curPath, VPackValue(VPackValueType::Object));
|
||||
pending.add("old", current);
|
||||
pending.close();
|
||||
// --- Check that Plan servers are as we expect
|
||||
pending.add(_agencyPrefix + planPath, VPackValue(VPackValueType::Object));
|
||||
pending.add("old", planned);
|
||||
pending.close();
|
||||
|
|
|
@ -112,6 +112,7 @@ bool FailedLeader::start() {
|
|||
curColPrefix + _database + "/" + _collection + "/" + _shard + "/servers";
|
||||
|
||||
Node const& current = _snapshot(curPath);
|
||||
Node const& planned = _snapshot(planPath);
|
||||
|
||||
if (current.slice().length() == 1) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY)
|
||||
|
@ -180,13 +181,19 @@ bool FailedLeader::start() {
|
|||
|
||||
pending.close();
|
||||
|
||||
// Precondition
|
||||
// Preconditions
|
||||
|
||||
// --- Check that Current servers are as we expect
|
||||
pending.openObject();
|
||||
pending.add(_agencyPrefix + curPath, VPackValue(VPackValueType::Object));
|
||||
pending.add("old", current.slice());
|
||||
pending.close();
|
||||
|
||||
// --- Check that Current servers are as we expect
|
||||
pending.add(_agencyPrefix + planPath, VPackValue(VPackValueType::Object));
|
||||
pending.add("old", planned.slice());
|
||||
pending.close();
|
||||
|
||||
// --- Check if shard is not blocked
|
||||
pending.add(_agencyPrefix + blockedShardsPrefix + _shard,
|
||||
VPackValue(VPackValueType::Object));
|
||||
|
|
|
@ -77,6 +77,8 @@ GeneralCommTask::~GeneralCommTask() {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
void GeneralCommTask::setStatistics(uint64_t id, RequestStatistics* stat) {
|
||||
MUTEX_LOCKER(locker, _statisticsMutex);
|
||||
|
||||
auto iter = _statisticsMap.find(id);
|
||||
|
||||
if (iter == _statisticsMap.end()) {
|
||||
|
@ -191,6 +193,8 @@ RequestStatistics* GeneralCommTask::acquireStatistics(uint64_t id) {
|
|||
}
|
||||
|
||||
RequestStatistics* GeneralCommTask::statistics(uint64_t id) {
|
||||
MUTEX_LOCKER(locker, _statisticsMutex);
|
||||
|
||||
auto iter = _statisticsMap.find(id);
|
||||
|
||||
if (iter == _statisticsMap.end()) {
|
||||
|
@ -201,6 +205,8 @@ RequestStatistics* GeneralCommTask::statistics(uint64_t id) {
|
|||
}
|
||||
|
||||
RequestStatistics* GeneralCommTask::stealStatistics(uint64_t id) {
|
||||
MUTEX_LOCKER(locker, _statisticsMutex);
|
||||
|
||||
auto iter = _statisticsMap.find(id);
|
||||
|
||||
if (iter == _statisticsMap.end()) {
|
||||
|
|
|
@ -264,7 +264,6 @@ bool HttpCommTask::processRead(double startTime) {
|
|||
_readBuffer.length() - 11);
|
||||
commTask->processRead(startTime);
|
||||
commTask->start();
|
||||
// statistics?!
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -364,10 +363,7 @@ bool HttpCommTask::processRead(double startTime) {
|
|||
// (original request object gets deleted before responding)
|
||||
_requestType = _incompleteRequest->requestType();
|
||||
|
||||
if (stat == nullptr) {
|
||||
stat = statistics(1UL);
|
||||
}
|
||||
|
||||
stat = statistics(1UL);
|
||||
RequestStatistics::SET_REQUEST_TYPE(stat, _requestType);
|
||||
|
||||
// handle different HTTP methods
|
||||
|
@ -494,12 +490,9 @@ bool HttpCommTask::processRead(double startTime) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (stat == nullptr) {
|
||||
stat = statistics(1UL);
|
||||
}
|
||||
|
||||
auto bytes = _bodyPosition - _startPosition + _bodyLength;
|
||||
|
||||
stat = statistics(1UL);
|
||||
RequestStatistics::SET_READ_END(stat);
|
||||
RequestStatistics::ADD_RECEIVED_BYTES(stat, bytes);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class RestHandler : public std::enable_shared_from_this<RestHandler> {
|
|||
|
||||
public:
|
||||
RestHandler(GeneralRequest*, GeneralResponse*);
|
||||
~RestHandler();
|
||||
virtual ~RestHandler();
|
||||
|
||||
public:
|
||||
uint64_t handlerId() const { return _handlerId; }
|
||||
|
|
|
@ -66,7 +66,7 @@ class ConnectionStatistics {
|
|||
_error = false;
|
||||
}
|
||||
|
||||
static size_t const QUEUE_SIZE = 1000;
|
||||
static size_t const QUEUE_SIZE = 5000;
|
||||
|
||||
static Mutex _dataLock;
|
||||
|
||||
|
|
|
@ -179,15 +179,14 @@ void RequestStatistics::process(RequestStatistics* statistics) {
|
|||
|
||||
void RequestStatistics::release() {
|
||||
TRI_ASSERT(!_released);
|
||||
TRI_ASSERT(!_inQueue);
|
||||
|
||||
if (!_ignore) {
|
||||
TRI_ASSERT(!_inQueue);
|
||||
_inQueue = true;
|
||||
bool ok = _finishedList.push(this);
|
||||
TRI_ASSERT(ok);
|
||||
} else {
|
||||
reset();
|
||||
_released = true;
|
||||
bool ok = _freeList.push(this);
|
||||
TRI_ASSERT(ok);
|
||||
}
|
||||
|
|
|
@ -59,31 +59,38 @@
|
|||
},
|
||||
|
||||
render: function () {
|
||||
var self = this;
|
||||
|
||||
var callback = function (error, db) {
|
||||
if (error) {
|
||||
arangoHelper.arangoError('DB', 'Could not get current db properties');
|
||||
} else {
|
||||
this.currentDB = db;
|
||||
// sorting
|
||||
this.collection.sort();
|
||||
self.currentDB = db;
|
||||
|
||||
$(this.el).html(this.template.render({
|
||||
collection: this.collection,
|
||||
searchString: '',
|
||||
currentDB: this.currentDB
|
||||
}));
|
||||
self.collection.fetch({
|
||||
success: function () {
|
||||
// sorting
|
||||
self.collection.sort();
|
||||
|
||||
if (this.dropdownVisible === true) {
|
||||
$('#dbSortDesc').attr('checked', this.collection.sortOptions.desc);
|
||||
$('#databaseToggle').toggleClass('activated');
|
||||
$('#databaseDropdown2').show();
|
||||
}
|
||||
$(self.el).html(self.template.render({
|
||||
collection: self.collection,
|
||||
searchString: '',
|
||||
currentDB: self.currentDB
|
||||
}));
|
||||
|
||||
arangoHelper.setCheckboxStatus('#databaseDropdown');
|
||||
if (self.dropdownVisible === true) {
|
||||
$('#dbSortDesc').attr('checked', self.collection.sortOptions.desc);
|
||||
$('#databaseToggle').toggleClass('activated');
|
||||
$('#databaseDropdown2').show();
|
||||
}
|
||||
|
||||
this.replaceSVGs();
|
||||
arangoHelper.setCheckboxStatus('#databaseDropdown');
|
||||
|
||||
self.replaceSVGs();
|
||||
}
|
||||
});
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
this.collection.getCurrentDatabase(callback);
|
||||
|
||||
|
|
|
@ -338,7 +338,11 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
|
|||
break;
|
||||
}
|
||||
|
||||
else if (_state == IN_READ_BODY && !_result->hasContentLength()) {
|
||||
if (_state == IN_READ_HEADER) {
|
||||
processHeader();
|
||||
}
|
||||
|
||||
if (_state == IN_READ_BODY && !_result->hasContentLength()) {
|
||||
// If we are reading the body and no content length was
|
||||
// found in the header, then we must read until no more
|
||||
// progress is made (but without an error), this then means
|
||||
|
@ -346,24 +350,18 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
|
|||
// process the body one more time:
|
||||
_result->setContentLength(_readBuffer.length() - _readBufferOffset);
|
||||
processBody();
|
||||
} else if (_state == IN_READ_BODY) {
|
||||
processBody();
|
||||
}
|
||||
|
||||
if (_state != FINISHED) {
|
||||
// If the body was not fully found we give up:
|
||||
this->close();
|
||||
_state = DEAD;
|
||||
setErrorMessage("Got unexpected response from remote");
|
||||
}
|
||||
|
||||
break;
|
||||
if (_state != FINISHED) {
|
||||
// If the body was not fully found we give up:
|
||||
this->close();
|
||||
_state = DEAD;
|
||||
setErrorMessage("Got unexpected response from remote");
|
||||
}
|
||||
|
||||
else {
|
||||
// In all other cases of closed connection, we are doomed:
|
||||
this->close();
|
||||
_state = DEAD;
|
||||
setErrorMessage("Got unexpected response from remote");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// the connection is still alive:
|
||||
|
|
Loading…
Reference in New Issue