From 724228684e1bd1b9c476f662f4a259dbb7f1d5d0 Mon Sep 17 00:00:00 2001 From: Mathias Stearn Date: Wed, 7 Jul 2010 21:07:54 -0400 Subject: [PATCH] Add --indexesLast option since it's not always faster SERVER-1377 --- tools/restore.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/restore.cpp b/tools/restore.cpp index ebbf127b1f3..115297b72a4 100644 --- a/tools/restore.cpp +++ b/tools/restore.cpp @@ -33,11 +33,13 @@ class Restore : public BSONTool { public: bool _drop; + bool _indexesLast; const char * _curns; Restore() : BSONTool( "restore" ) , _drop(false){ add_options() ("drop" , "drop each collection before import" ) + ("indexesLast" , "wait to add indexes (faster if data isn't inserted in index order)" ) ; add_hidden_options() ("dir", po::value()->default_value("dump"), "directory to restore from") @@ -53,6 +55,7 @@ public: auth(); path root = getParam("dir"); _drop = hasParam( "drop" ); + _indexesLast = hasParam("indexesLast"); /* If _db is not "" then the user specified a db name to restore as. * @@ -97,7 +100,7 @@ public: } } - if ( p.leaf() == "system.indexes.bson" ) + if ( _indexesLast && p.leaf() == "system.indexes.bson" ) indexes = p; else drillDown(p, use_db, use_coll);