diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-09-10 10:36:11 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-09-10 10:36:11 -0400 |
commit | bbc07f85eca951f216ffba82cd15fa08f1d9e6e4 (patch) | |
tree | 7ae13ad3f31a3d975318a25523154d2fd74a3c2d /s | |
parent | b9d61d202c7acebac58ce55c1da89f8e67dd29a7 (diff) | |
download | mongo-bbc07f85eca951f216ffba82cd15fa08f1d9e6e4.tar.gz |
don't allow db.eval on sharded collections SHARDING-27
Diffstat (limited to 's')
-rw-r--r-- | s/d_logic.cpp | 16 | ||||
-rw-r--r-- | s/d_logic.h | 5 | ||||
-rw-r--r-- | s/server.cpp | 4 |
3 files changed, 25 insertions, 0 deletions
diff --git a/s/d_logic.cpp b/s/d_logic.cpp index 15c65ad154b..902df4f479c 100644 --- a/s/d_logic.cpp +++ b/s/d_logic.cpp @@ -390,6 +390,22 @@ namespace mongo { } moveShardFinishCmd; + bool haveLocalShardingInfo( const string& ns ){ + if ( shardConfigServer.empty() ) + return false; + + + unsigned long long version = myVersions[ns]; + if ( version == 0 ) + return false; + + NSVersions * versions = clientShardVersions.get(); + if ( ! versions ) + return false; + + return true; + } + /** * @ return true if not in sharded mode or if version for this client is ok diff --git a/s/d_logic.h b/s/d_logic.h index f3460f3f6ce..3e483c45396 100644 --- a/s/d_logic.h +++ b/s/d_logic.h @@ -7,6 +7,11 @@ namespace mongo { /** + * @return true if we have any shard info for the ns + */ + bool haveLocalShardingInfo( const string& ns ); + + /** * @return true if the current threads shard version is ok, or not in sharded version */ bool shardVersionOk( const string& ns , string& errmsg ); diff --git a/s/server.cpp b/s/server.cpp index f878c1372c8..d74e18aaa5e 100644 --- a/s/server.cpp +++ b/s/server.cpp @@ -44,6 +44,10 @@ namespace mongo { return "?"; } + bool haveLocalShardingInfo( const string& ns ){ + assert( 0 ); + } + void usage( char * argv[] ){ out() << argv[0] << " usage:\n\n"; out() << " -v+ verbose\n"; |