Save a memcpy in the tlog peek path (#7328)

This commit is contained in:
Andrew Noyes 2022-06-07 13:22:56 -07:00 committed by GitHub
parent 5a4082bfe8
commit 1f8fc32f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -573,7 +573,9 @@ Future<Void> logRouterPeekMessages(PromiseType replyPromise,
TLogPeekReply reply;
reply.maxKnownVersion = self->version.get();
reply.minKnownCommittedVersion = self->poppedVersion;
reply.messages = StringRef(reply.arena, messages.toValue());
auto messagesValue = messages.toValue();
reply.arena.dependsOn(messagesValue.arena());
reply.messages = messagesValue;
reply.popped = self->minPopped.get() >= self->startVersion ? self->minPopped.get() : 0;
reply.end = endVersion;
reply.onlySpilled = false;

View File

@ -2020,7 +2020,9 @@ Future<Void> tLogPeekMessages(PromiseType replyPromise,
TLogPeekReply reply;
reply.maxKnownVersion = logData->version.get();
reply.minKnownCommittedVersion = logData->minKnownCommittedVersion;
reply.messages = StringRef(reply.arena, messages.toValue());
auto messagesValue = messages.toValue();
reply.arena.dependsOn(messagesValue.arena());
reply.messages = messagesValue;
reply.end = endVersion;
reply.onlySpilled = onlySpilled;