summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbmessage.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2016-06-06 14:08:29 -0400
committerMathias Stearn <mathias@10gen.com>2016-06-22 16:04:36 -0400
commite508ddcb51eec941ae50d9c2efb06b601811dc19 (patch)
treecab51e8665c29d8220b64e7f69a8bbc592ca5339 /src/mongo/db/dbmessage.cpp
parent40f20eca105a5e06a72df583ac654f946e9b058e (diff)
downloadmongo-e508ddcb51eec941ae50d9c2efb06b601811dc19.tar.gz
SERVER-24418 Make Message and BufBuilder use SharedBuffer for memory management
This makes it possible to get owned BSONObj out of a Message without copying. Hooked up to the following places: - Anything using the Fetcher (including oplog fetching on secondaries) - Anything using DBClientInterface::findOne() - Anything using CursorResponse (including Sharded queries) As a simplification, Messages no longer support non-contiguous buffers, or non-owning buffers. The former wasn't used by anything, and the latter was only used by mongosniff only for messages that fit in a single packet.
Diffstat (limited to 'src/mongo/db/dbmessage.cpp')
-rw-r--r--src/mongo/db/dbmessage.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/mongo/db/dbmessage.cpp b/src/mongo/db/dbmessage.cpp
index 61a4d1509ac..67a5548dbfb 100644
--- a/src/mongo/db/dbmessage.cpp
+++ b/src/mongo/db/dbmessage.cpp
@@ -198,8 +198,7 @@ void OpQueryReplyBuilder::putInMessage(
qr.setCursorId(cursorId);
qr.setStartingFrom(startingFrom);
qr.setNReturned(nReturned);
- _buffer.decouple();
- out->setData(qr.view2ptr(), true); // transport will free
+ out->setData(_buffer.release()); // transport will free
}
void replyToQuery(int queryResultFlags,