summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2014-05-22 17:05:43 -0400
committerMathias Stearn <mathias@10gen.com>2014-05-22 18:15:41 -0400
commita0d921a14d099242cc0587d177dddf6fd0749cc1 (patch)
tree9580f582888fac7b2da109b61e9247d122e5640b /src
parent7dcbdc440a56fef19a561f513d8eddd1c2a2b27f (diff)
downloadmongo-a0d921a14d099242cc0587d177dddf6fd0749cc1.tar.gz
SERVER-13912 Capped collections with size=0 are promoted to the minimum Extent size
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp
index c5ad42daa13..f246405d64d 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp
@@ -180,12 +180,14 @@ namespace mongo {
}
else if ( options.capped ) {
// normal
- while ( rs->storageSize() < options.cappedSize ) {
+ do {
+ // Must do this at least once, otherwise we leave the collection with no
+ // extents, which is invalid.
int sz = _massageExtentSize( &_extentManager,
options.cappedSize - rs->storageSize() );
sz &= 0xffffff00;
rs->increaseStorageSize( txn, sz, -1 );
- }
+ } while( rs->storageSize() < options.cappedSize );
}
else {
rs->increaseStorageSize( txn, _extentManager.initialSize( 128 ), -1 );