From 4ae174dd53adaea999715ffbe19c435d685bc412 Mon Sep 17 00:00:00 2001 From: Jason Carey Date: Wed, 7 Feb 2018 15:21:47 -0500 Subject: SERVER-33158 Shrink LogicalSession refresh batches The batches created by the LogicalSessionCache can exceed the 16mb bson size limit for bson on the wire. This will cause the refresh step to fail, preventing logical sessions from ever being synced to the global collection. This happens because we don't explicitly size our batches (we were relying on the write_cmd item batch limit, rather than a byte limit). Previously the write_cmd batch limit had been 1000 items, which allowed for 16k per record. The new limit is 100k, which gives a 160 byte budget we can exceed with very large user names (as we sync the lsid + the user@db name). By forcing a new 10k limit on username sizes used with logical sessions we can then ensure that a lower 1k limit will always be safe. --- src/mongo/db/logical_session_id_helpers.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mongo/db/logical_session_id_helpers.h') diff --git a/src/mongo/db/logical_session_id_helpers.h b/src/mongo/db/logical_session_id_helpers.h index 9735706330b..7e08503432b 100644 --- a/src/mongo/db/logical_session_id_helpers.h +++ b/src/mongo/db/logical_session_id_helpers.h @@ -36,6 +36,8 @@ namespace mongo { +constexpr size_t kMaximumUserNameLengthForLogicalSessions = 10000; + /** * Get the currently logged in user's UID digest. */ -- cgit v1.2.1