Remove unnecessary copy of KVS entries into range read response
This commit is contained in:
parent
81fbe9ceaa
commit
aeb4938720
|
@ -1437,7 +1437,7 @@ ACTOR Future<Void> getShardStateQ(StorageServer* data, GetShardStateRequest req)
|
|||
void merge(Arena& arena,
|
||||
VectorRef<KeyValueRef, VecSerStrategy::String>& output,
|
||||
VectorRef<KeyValueRef> const& vm_output,
|
||||
VectorRef<KeyValueRef> const& base,
|
||||
Standalone<RangeResultRef> const& base,
|
||||
int& vCount,
|
||||
int limit,
|
||||
bool stopAtEndOfBase,
|
||||
|
@ -1448,6 +1448,9 @@ void merge(Arena& arena,
|
|||
// start is still inclusive and end is exclusive
|
||||
{
|
||||
ASSERT(limit != 0);
|
||||
// Add a dependency of the new arena on the result from the KVS so that we don't have to copy any of the KVS
|
||||
// results.
|
||||
arena.dependsOn(base.arena());
|
||||
|
||||
bool forward = limit > 0;
|
||||
if (!forward)
|
||||
|
@ -1458,7 +1461,7 @@ void merge(Arena& arena,
|
|||
KeyValueRef const* baseEnd = base.end();
|
||||
while (baseStart != baseEnd && vCount > 0 && output.size() < adjustedLimit && accumulatedBytes < limitBytes) {
|
||||
if (forward ? baseStart->key < vm_output[pos].key : baseStart->key > vm_output[pos].key) {
|
||||
output.push_back_deep(arena, *baseStart++);
|
||||
output.push_back(arena, *baseStart++);
|
||||
} else {
|
||||
output.push_back_deep(arena, vm_output[pos]);
|
||||
if (baseStart->key == vm_output[pos].key)
|
||||
|
@ -1469,7 +1472,7 @@ void merge(Arena& arena,
|
|||
accumulatedBytes += sizeof(KeyValueRef) + output.end()[-1].expectedSize();
|
||||
}
|
||||
while (baseStart != baseEnd && output.size() < adjustedLimit && accumulatedBytes < limitBytes) {
|
||||
output.push_back_deep(arena, *baseStart++);
|
||||
output.push_back(arena, *baseStart++);
|
||||
accumulatedBytes += sizeof(KeyValueRef) + output.end()[-1].expectedSize();
|
||||
}
|
||||
if (!stopAtEndOfBase) {
|
||||
|
|
Loading…
Reference in New Issue