mirror of https://gitee.com/bigwinds/arangodb
Fixed OperationCursor and SkiplistIndex. The builder in OperationCursor did not retain the _buffer.
This commit is contained in:
parent
a4edc8dd49
commit
5d61b709bb
|
@ -294,6 +294,7 @@ bool IndexBlock::initIndexes() {
|
|||
THROW_ARANGO_EXCEPTION(_cursor->code);
|
||||
}
|
||||
} else {
|
||||
_cursor = nullptr;
|
||||
// We were not able to initialize any index with this condition
|
||||
return false;
|
||||
}
|
||||
|
@ -341,6 +342,8 @@ void IndexBlock::startNextCursor() {
|
|||
if (_currentIndex < _indexes.size()) {
|
||||
// This check will work as long as _indexes.size() < MAX_SIZE_T
|
||||
_cursor = createCursor();
|
||||
} else {
|
||||
_cursor = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -913,6 +913,7 @@ IndexIterator* SkiplistIndex::iteratorForCondition(
|
|||
}
|
||||
// We have to add the value always, the key was added before
|
||||
value->toVelocyPackValue(searchValues);
|
||||
searchValues.close();
|
||||
}
|
||||
|
||||
// Now handle the next element, which might be a range
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
using namespace arangodb;
|
||||
|
||||
void OperationCursor::reset() {
|
||||
_builder.clear();
|
||||
|
||||
if (_indexIterator != nullptr) {
|
||||
_indexIterator->reset();
|
||||
_hasMore = true;
|
||||
|
@ -62,11 +60,10 @@ int OperationCursor::getMore(uint64_t batchSize, bool useExternals) {
|
|||
// You requested more even if you should have checked it before.
|
||||
return TRI_ERROR_FORBIDDEN;
|
||||
}
|
||||
// We restart the builder
|
||||
_builder.clear();
|
||||
VPackBuilder builder(buffer);
|
||||
|
||||
|
||||
VPackArrayBuilder guard(&_builder);
|
||||
VPackArrayBuilder guard(&builder);
|
||||
TRI_doc_mptr_t* mptr = nullptr;
|
||||
// TODO: Improve this for baby awareness
|
||||
while (batchSize > 0 && _limit > 0 && (mptr = _indexIterator->next()) != nullptr) {
|
||||
|
@ -74,10 +71,10 @@ int OperationCursor::getMore(uint64_t batchSize, bool useExternals) {
|
|||
--_limit;
|
||||
#if 0
|
||||
if (useExternals) {
|
||||
_builder.add(VPackValue(mptr->vpack(), VPackValueType::External));
|
||||
builder.add(VPackValue(mptr->vpack(), VPackValueType::External));
|
||||
} else {
|
||||
#endif
|
||||
_builder.add(VPackSlice(mptr->vpack()));
|
||||
builder.add(VPackSlice(mptr->vpack()));
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -44,7 +44,6 @@ struct OperationCursor : public OperationResult {
|
|||
private:
|
||||
|
||||
std::shared_ptr<IndexIterator> _indexIterator;
|
||||
arangodb::velocypack::Builder _builder;
|
||||
bool _hasMore;
|
||||
uint64_t _limit;
|
||||
uint64_t const _originalLimit;
|
||||
|
@ -53,11 +52,11 @@ struct OperationCursor : public OperationResult {
|
|||
public:
|
||||
|
||||
explicit OperationCursor(int code)
|
||||
: OperationResult(code), _builder(buffer), _hasMore(false), _limit(0), _originalLimit(0), _batchSize(1000) {
|
||||
: OperationResult(code), _hasMore(false), _limit(0), _originalLimit(0), _batchSize(1000) {
|
||||
}
|
||||
|
||||
OperationCursor(int code, std::string const& message)
|
||||
: OperationResult(code, message), _builder(buffer), _hasMore(false), _limit(0), _originalLimit(0), _batchSize(1000) {
|
||||
: OperationResult(code, message), _hasMore(false), _limit(0), _originalLimit(0), _batchSize(1000) {
|
||||
}
|
||||
|
||||
OperationCursor(std::shared_ptr<VPackBuffer<uint8_t>> buffer,
|
||||
|
@ -66,7 +65,6 @@ struct OperationCursor : public OperationResult {
|
|||
int code,
|
||||
bool wasSynchronous)
|
||||
: OperationResult(buffer, handler, message, code, wasSynchronous),
|
||||
_builder(buffer),
|
||||
_hasMore(false),
|
||||
_limit(0),
|
||||
_originalLimit(0),
|
||||
|
@ -78,7 +76,6 @@ struct OperationCursor : public OperationResult {
|
|||
: OperationResult(std::make_shared<VPackBuffer<uint8_t>>(), handler, "",
|
||||
TRI_ERROR_NO_ERROR, false),
|
||||
_indexIterator(iterator),
|
||||
_builder(buffer),
|
||||
_hasMore(true),
|
||||
_limit(limit), // _limit is modified later on
|
||||
_originalLimit(limit),
|
||||
|
|
|
@ -40,6 +40,7 @@ struct OperationResult {
|
|||
|
||||
explicit OperationResult(int code)
|
||||
: customTypeHandler(), code(code), wasSynchronous(false) {
|
||||
buffer = std::make_shared<VPackBuffer<uint8_t>>();
|
||||
if (code != TRI_ERROR_NO_ERROR) {
|
||||
errorMessage = TRI_errno_string(code);
|
||||
}
|
||||
|
@ -48,6 +49,7 @@ struct OperationResult {
|
|||
OperationResult(int code, std::string const& message)
|
||||
: customTypeHandler(), errorMessage(message), code(code),
|
||||
wasSynchronous(false) {
|
||||
buffer = std::make_shared<VPackBuffer<uint8_t>>();
|
||||
TRI_ASSERT(code != TRI_ERROR_NO_ERROR);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue