diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-02-20 12:47:59 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-02-20 12:47:59 -0500 |
commit | 206b92fce3033c17d1f8ae0ae8ebfb520454e07a (patch) | |
tree | 88b508eab7b74f5dae3bb643ace5c025d5f05690 /db | |
parent | f786707c5505713e54704e752e4cb87d77f2ec45 (diff) | |
download | mongo-206b92fce3033c17d1f8ae0ae8ebfb520454e07a.tar.gz |
merge conflict checkpoint
some cloneCollection fixes
some moveShard work
Diffstat (limited to 'db')
-rw-r--r-- | db/cloner.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/db/cloner.cpp b/db/cloner.cpp index 5c6fc215730..9da51b5f3e7 100644 --- a/db/cloner.cpp +++ b/db/cloner.cpp @@ -285,16 +285,18 @@ namespace mongo { } CmdCloneCollection() : Command("cloneCollection") { } virtual void help( stringstream &help ) const { - help << " example: { cloneCollection: 1, fromhost: <hostname>, collection: <collectionname>, query: <query> }"; + help << " example: { cloneCollection: <collection ns>, from: <hostname>, query: <query> }"; } virtual bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) { - string fromhost = cmdObj.getStringField("fromhost"); + string fromhost = cmdObj.getStringField("from"); if ( fromhost.empty() ) return false; - string collection = cmdObj.getStringField("collection"); + string collection = cmdObj.getStringField("cloneCollection"); if ( collection.empty() ) return false; BSONObj query = cmdObj.getObjectField("query"); + if ( query.isEmpty() ) + query = emptyObj; BSONElement copyIndexesSpec = cmdObj.getField("copyindexes"); bool copyIndexes = copyIndexesSpec.isBoolean() ? copyIndexesSpec.boolean() : true; @@ -302,6 +304,9 @@ namespace mongo { were to clone it would get a different point-in-time and not match. */ setClient( collection.c_str() ); + + log() << "cloneCollection. db:" << ns << " collection:" << collection << " from: " << fromhost << " query: " << query << endl; + Cloner c; return c.cloneCollection( fromhost.c_str(), collection.c_str(), query, errmsg, !fromRepl, copyIndexes ); } |