diff options
author | Dwight <dmerriman@gmail.com> | 2008-12-02 15:51:00 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-12-02 15:51:00 -0500 |
commit | eff1694cd74dc31b6754c5f3a13f228f7b2a7d03 (patch) | |
tree | 44fbe520195d8966a0d360344110cebeb546e2ed /db/database.h | |
parent | 1c2e0672dde11f8171326b2db2848e7d8124814e (diff) | |
download | mongo-eff1694cd74dc31b6754c5f3a13f228f7b2a7d03.tar.gz |
repl tran log was smaller than it should be
Diffstat (limited to 'db/database.h')
-rw-r--r-- | db/database.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/db/database.h b/db/database.h index 0bf1e485bac..a8140089897 100644 --- a/db/database.h +++ b/db/database.h @@ -62,6 +62,18 @@ public: return getFile(n); } + PhysicalDataFile* suitableFile(int sizeNeeded) { + PhysicalDataFile* f = newestFile(); + for( int i = 0; i < 8; i++ ) { + if( f->getHeader()->unusedLength >= sizeNeeded ) + break; + f = addAFile(); + if( f->getHeader()->fileLength > 1500000000 ) // this is as big as they get so might as well stop + break; + } + return f; + } + PhysicalDataFile* newestFile() { int n = (int) files.size(); if( n > 0 ) n--; |