From 9667185c116d5154201a819bfb7fbff6fc0bbabf Mon Sep 17 00:00:00 2001 From: hkernbach Date: Tue, 18 Feb 2020 17:14:45 +0100 Subject: [PATCH] fix shrink method in aqlitemblock --- arangod/Aql/AqlItemBlock.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arangod/Aql/AqlItemBlock.cpp b/arangod/Aql/AqlItemBlock.cpp index b7119bd35223..382208dd3c96 100644 --- a/arangod/Aql/AqlItemBlock.cpp +++ b/arangod/Aql/AqlItemBlock.cpp @@ -346,6 +346,13 @@ void AqlItemBlock::shrink(size_t nrItems) { decreaseMemoryUsage(sizeof(AqlValue) * (_nrItems - nrItems) * _nrRegs); + // remove the shadow row indices pointing to now invalid rows. + _shadowRowIndexes.erase(_shadowRowIndexes.lower_bound(nrItems), + _shadowRowIndexes.end()); + + // adjust the size of the block + _nrItems = nrItems; + for (size_t i = numEntries(); i < _data.size(); ++i) { AqlValue& a = _data[i]; if (a.requiresDestruction()) { @@ -367,13 +374,6 @@ void AqlItemBlock::shrink(size_t nrItems) { } a.erase(); } - - // remove the shadow row indices pointing to now invalid rows. - _shadowRowIndexes.erase(_shadowRowIndexes.lower_bound(nrItems), - _shadowRowIndexes.end()); - - // adjust the size of the block - _nrItems = nrItems; } void AqlItemBlock::rescale(size_t nrItems, RegisterId nrRegs) {