diff options
author | Louis Williams <louis.williams@mongodb.com> | 2022-06-07 12:21:37 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-07 12:48:59 +0000 |
commit | e77e6bd549a2564cbdba8498a8a9d8b28da955da (patch) | |
tree | 899004d5b5f8515d1595b9b5de69d3e8442eba63 /src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp | |
parent | bd4283b36378ea76e7ffe018fe61d488da73d238 (diff) | |
download | mongo-e77e6bd549a2564cbdba8498a8a9d8b28da955da.tar.gz |
SERVER-62552 Cluster internal oplog buffer collections
Diffstat (limited to 'src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp')
-rw-r--r-- | src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp b/src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp index ef0cb4a40f4..94071745f24 100644 --- a/src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp +++ b/src/mongo/db/s/resharding/resharding_oplog_fetcher.cpp @@ -39,6 +39,7 @@ #include "mongo/bson/bsonobj.h" #include "mongo/client/dbclient_connection.h" #include "mongo/client/remote_command_targeter.h" +#include "mongo/db/catalog/clustered_collection_util.h" #include "mongo/db/catalog_raii.h" #include "mongo/db/concurrency/exception_util.h" #include "mongo/db/pipeline/aggregate_command_gen.h" @@ -256,7 +257,12 @@ void ReshardingOplogFetcher::_ensureCollection(Client* client, AutoGetDb autoDb(opCtx, nss.db(), LockMode::MODE_IX); Lock::CollectionLock collLock(opCtx, nss, MODE_IX); auto db = autoDb.ensureDbExists(opCtx); - db->createCollection(opCtx, nss); + + // This oplog-like collection will benefit from clustering by _id to reduce storage overhead + // and improve _id query efficiency. + CollectionOptions options; + options.clusteredIndex = clustered_util::makeDefaultClusteredIdIndex(); + db->createCollection(opCtx, nss, options); wuow.commit(); }); } |