diff options
Diffstat (limited to 'src/mongo/db/namespace_details.cpp')
-rw-r--r-- | src/mongo/db/namespace_details.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mongo/db/namespace_details.cpp b/src/mongo/db/namespace_details.cpp index a830b1210e3..19f3eef4c49 100644 --- a/src/mongo/db/namespace_details.cpp +++ b/src/mongo/db/namespace_details.cpp @@ -753,9 +753,15 @@ namespace mongo { if ( isUserFlagSet( Flag_UsePowerOf2Sizes ) ) { - int x = bucket( minRecordSize ); - x = bucketSizes[x]; - return x; + int allocationSize = bucketSizes[ bucket( minRecordSize ) ]; + if ( allocationSize < minRecordSize ) { + // if we get here, it means we're allocating more than 8mb + // the highest bucket is 8mb, so the above code will never return more than 8mb for allocationSize + // if this happens, we are going to round up to the nearest megabyte + fassert( 16439, bucket( minRecordSize ) == MaxBucket ); + allocationSize = 1 + ( minRecordSize | ( ( 1 << 20 ) - 1 ) ); + } + return allocationSize; } return static_cast<int>(minRecordSize * _paddingFactor); |