diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2017-09-05 12:14:27 -0400 |
---|---|---|
committer | Gabriel Russell <gabriel.russell@mongodb.com> | 2017-09-21 15:29:58 -0400 |
commit | 8beb002326a5fdd82c694497b7ebcb52a593a3d3 (patch) | |
tree | 5fefa9a1b037dedab30a81abc6bfa3193b564df2 /src/mongo/db/sessions_collection.cpp | |
parent | daefad8112937c847282a661392179b9afab0b87 (diff) | |
download | mongo-8beb002326a5fdd82c694497b7ebcb52a593a3d3.tar.gz |
SERVER-28336 endSessions command
Diffstat (limited to 'src/mongo/db/sessions_collection.cpp')
-rw-r--r-- | src/mongo/db/sessions_collection.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mongo/db/sessions_collection.cpp b/src/mongo/db/sessions_collection.cpp index b6341eb0423..69e420f40b8 100644 --- a/src/mongo/db/sessions_collection.cpp +++ b/src/mongo/db/sessions_collection.cpp @@ -55,15 +55,15 @@ BSONObj lsidQuery(const LogicalSessionRecord& record) { return lsidQuery(record.getId()); } -BSONObj updateQuery(const LogicalSessionRecord& record, Date_t refreshTime) { +BSONObj updateQuery(const LogicalSessionRecord& record) { // { $max : { lastUse : <time> }, $setOnInsert : { user : <user> } } // Build our update doc. BSONObjBuilder updateBuilder; { - BSONObjBuilder maxBuilder(updateBuilder.subobjStart("$max")); - maxBuilder.append(LogicalSessionRecord::kLastUseFieldName, refreshTime); + BSONObjBuilder maxBuilder(updateBuilder.subobjStart("$currentDate")); + maxBuilder.append(LogicalSessionRecord::kLastUseFieldName, true); } if (record.getUser()) { @@ -200,17 +200,15 @@ SessionsCollection::FindBatchFn SessionsCollection::makeFindFnForCommand(const N Status SessionsCollection::doRefresh(const NamespaceString& ns, const LogicalSessionRecordSet& sessions, - Date_t refreshTime, SendBatchFn send) { auto init = [ns](BSONObjBuilder* batch) { batch->append("update", ns.coll()); batch->append("ordered", false); }; - auto add = [&refreshTime](BSONArrayBuilder* entries, const LogicalSessionRecord& record) { - entries->append(BSON("q" << lsidQuery(record) << "u" << updateQuery(record, refreshTime) - << "upsert" - << true)); + auto add = [](BSONArrayBuilder* entries, const LogicalSessionRecord& record) { + entries->append( + BSON("q" << lsidQuery(record) << "u" << updateQuery(record) << "upsert" << true)); }; return runBulkCmd("updates", init, add, send, sessions); @@ -218,12 +216,12 @@ Status SessionsCollection::doRefresh(const NamespaceString& ns, Status SessionsCollection::doRefreshExternal(const NamespaceString& ns, const LogicalSessionRecordSet& sessions, - Date_t refreshTime, SendBatchFn send) { auto makeT = [] { return std::vector<LogicalSessionRecord>{}; }; - auto add = [&refreshTime](std::vector<LogicalSessionRecord>& batch, - const LogicalSessionRecord& record) { batch.push_back(record); }; + auto add = [](std::vector<LogicalSessionRecord>& batch, const LogicalSessionRecord& record) { + batch.push_back(record); + }; auto sendLocal = [&](std::vector<LogicalSessionRecord>& batch) { RefreshSessionsCmdFromClusterMember idl; |