1
0
Fork 0

Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
Jan Steemann 2014-10-23 14:43:59 +02:00
commit 4dfb556016
2 changed files with 20 additions and 43 deletions

View File

@ -3393,15 +3393,18 @@ int GatherBlock::shutdown (int errorCode) {
return res;
}
}
for (std::deque<AqlItemBlock*>& x : _gatherBlockBuffer) {
for (AqlItemBlock* y: x) {
delete y;
}
x.clear();
}
_gatherBlockBuffer.clear();
if (! _isSimple) {
for (std::deque<AqlItemBlock*>& x : _gatherBlockBuffer) {
for (AqlItemBlock* y: x) {
delete y;
}
x.clear();
}
_gatherBlockBuffer.clear();
_gatherBlockPos.clear();
}
return TRI_ERROR_NO_ERROR;
LEAVE_BLOCK
}
@ -3726,6 +3729,7 @@ size_t GatherBlock::skipSome (size_t atLeast, size_t atMost) {
bool GatherBlock::getBlock (size_t i, size_t atLeast, size_t atMost) {
ENTER_BLOCK
TRI_ASSERT(0 <= i && i < _dependencies.size());
TRI_ASSERT(! _isSimple);
AqlItemBlock* docs = _dependencies.at(i)->getSome(atLeast, atMost);
if (docs != nullptr) {
try {
@ -4225,34 +4229,7 @@ int DistributeBlock::getOrSkipSomeForShard (size_t atLeast,
freeCollector();
// check if we can pop from the front of _buffer
size_t smallestIndex = 0;
for (size_t i = 0; i < _nrClients; i++) {
if (! _distBuffer.at(i).empty()) {
size_t index = _distBuffer.at(i).at(0).first;
if (index == 0) {
return TRI_ERROR_NO_ERROR; // don't have to do any clean-up
}
else {
smallestIndex = (std::min)(index, smallestIndex);
}
}
}
// pop from _buffer
for (size_t i = 0; i < smallestIndex; i++) {
AqlItemBlock* cur = _buffer.front();
delete cur;
_buffer.pop_front();
}
// reset first coord of pairs in _distBuffer
for (size_t i = 0; i < _nrClients; i++) {
for (size_t j = 0; j < _distBuffer.at(i).size(); j++) {
_distBuffer.at(i).at(j).first -= smallestIndex;
}
}
// _buffer is left intact, deleted and cleared at shutdown
return TRI_ERROR_NO_ERROR;
LEAVE_BLOCK

View File

@ -1432,13 +1432,6 @@ namespace triagens {
size_t skipSome (size_t, size_t) override final;
////////////////////////////////////////////////////////////////////////////////
/// @brief _gatherBlockPos: pairs (i, _pos in _buffer.at(i)), i.e. the same as
/// the usual _pos but one pair per dependency
////////////////////////////////////////////////////////////////////////////////
std::vector<std::pair<size_t, size_t>> _gatherBlockPos;
protected:
////////////////////////////////////////////////////////////////////////////////
@ -1457,6 +1450,13 @@ namespace triagens {
private:
////////////////////////////////////////////////////////////////////////////////
/// @brief _gatherBlockPos: pairs (i, _pos in _buffer.at(i)), i.e. the same as
/// the usual _pos but one pair per dependency
////////////////////////////////////////////////////////////////////////////////
std::vector<std::pair<size_t, size_t>> _gatherBlockPos;
////////////////////////////////////////////////////////////////////////////////
/// @brief _atDep: currently pulling blocks from _dependencies.at(_atDep),
/// simple case only