summaryrefslogtreecommitdiff
path: root/dbtests
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-12-30 14:12:26 -0500
committerEliot Horowitz <eliot@10gen.com>2010-12-30 14:12:26 -0500
commitc4c5d66d016f36b0c56021fd142c8a027c6b132d (patch)
tree622ff5480ab31a8c02b69fad05d6a482aaac9908 /dbtests
parent32f28606d7486af69f9eec630bfd822bb78aacec (diff)
downloadmongo-c4c5d66d016f36b0c56021fd142c8a027c6b132d.tar.gz
fix extent search in old files SERVER-2310
Diffstat (limited to 'dbtests')
-rw-r--r--dbtests/pdfiletests.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/dbtests/pdfiletests.cpp b/dbtests/pdfiletests.cpp
index e8cd3ba3ff5..1d02a1a175e 100644
--- a/dbtests/pdfiletests.cpp
+++ b/dbtests/pdfiletests.cpp
@@ -330,6 +330,51 @@ namespace PdfileTests {
}
};
+ class ExtentAllocOrder {
+ public:
+ void run(){
+ string dbname = "unittest_ex";
+
+ string c1 = dbname + ".x1";
+ string c2 = dbname + ".x2";
+
+ {
+ DBDirectClient db;
+ db.dropDatabase( dbname );
+ }
+
+ dblock mylock;
+ Client::Context cx( dbname );
+
+ bool isnew;
+ Database * d = dbHolder.getOrCreate( dbname , dbpath , isnew );
+ assert( d );
+
+ int big = 10 * 1024;
+ //int small = 1024;
+
+ unsigned long long l = 0;
+ while ( 1 ){
+ MongoDataFile * f = d->addAFile( big , false );
+ cout << f->length() << endl;
+ if ( f->length() == l )
+ break;
+ l = f->length();
+ }
+
+ int start = d->numFiles();
+ for ( int i=0; i<start; i++ )
+ d->allocExtent( c1.c_str() , d->getFile( i )->getHeader()->unusedLength , false );
+ ASSERT_EQUALS( start , d->numFiles() );
+
+ {
+ DBDirectClient db;
+ db.dropDatabase( dbname );
+ }
+ }
+ };
+
+
class All : public Suite {
public:
All() : Suite( "pdfile" ){}
@@ -350,6 +395,7 @@ namespace PdfileTests {
add< ScanCapped::LastInExtent >();
add< Insert::UpdateDate >();
add< ExtentSizing >();
+ add< ExtentAllocOrder >();
}
} myall;