summaryrefslogtreecommitdiff
path: root/db/database.h
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-12-02 15:51:00 -0500
committerDwight <dmerriman@gmail.com>2008-12-02 15:51:00 -0500
commiteff1694cd74dc31b6754c5f3a13f228f7b2a7d03 (patch)
tree44fbe520195d8966a0d360344110cebeb546e2ed /db/database.h
parent1c2e0672dde11f8171326b2db2848e7d8124814e (diff)
downloadmongo-eff1694cd74dc31b6754c5f3a13f228f7b2a7d03.tar.gz
repl tran log was smaller than it should be
Diffstat (limited to 'db/database.h')
-rw-r--r--db/database.h12
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--;