Skip to content

Commit eb47871

Browse files
Daniel Gottliebevergreen
authored andcommitted
SERVER-43074: Make appendMultikeyPathsAsBytes threadsafe.
The method previously relied on catalog level serialization for guaranteeing serialized access to a global variable.
1 parent c27c4a8 commit eb47871

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mongo/db/storage/bson_collection_catalog_entry.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ namespace {
4242
// We use that value to represent the largest number of path components we could ever possibly
4343
// expect to see in an indexed field.
4444
const size_t kMaxKeyPatternPathLength = 2048;
45-
char multikeyPathsEncodedAsBytes[kMaxKeyPatternPathLength];
4645

4746
/**
4847
* Encodes 'multikeyPaths' as binary data and appends it to 'bob'.
@@ -54,6 +53,8 @@ char multikeyPathsEncodedAsBytes[kMaxKeyPatternPathLength];
5453
void appendMultikeyPathsAsBytes(BSONObj keyPattern,
5554
const MultikeyPaths& multikeyPaths,
5655
BSONObjBuilder* bob) {
56+
char multikeyPathsEncodedAsBytes[kMaxKeyPatternPathLength];
57+
5758
size_t i = 0;
5859
for (const auto keyElem : keyPattern) {
5960
StringData keyName = keyElem.fieldNameStringData();

0 commit comments

Comments
 (0)