diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-08-01 01:02:51 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-08-01 01:02:51 -0400 |
commit | 27e404fa08fcc86cd54f3e3e29ef2e34bf579b13 (patch) | |
tree | 167a0b1a5e71cee9c890ad2df20527c272ef5ad8 /client/parallel.cpp | |
parent | f05157439cd90b76f1ab840aac3478037e32bfe4 (diff) | |
download | mongo-27e404fa08fcc86cd54f3e3e29ef2e34bf579b13.tar.gz |
cleaning to make sure _init isn't being called twice
Diffstat (limited to 'client/parallel.cpp')
-rw-r--r-- | client/parallel.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/client/parallel.cpp b/client/parallel.cpp index 16fed16d08c..d605ebd857e 100644 --- a/client/parallel.cpp +++ b/client/parallel.cpp @@ -311,6 +311,7 @@ namespace mongo { : ClusteredCursor( q ) , _servers( servers ){ _sortKey = sortKey.getOwned(); _needToSkip = q.ntoskip; + _finishCons(); } ParallelSortClusteredCursor::ParallelSortClusteredCursor( const set<ServerAndQuery>& servers , const string& ns , @@ -319,15 +320,21 @@ namespace mongo { : ClusteredCursor( ns , q.obj , options , fields ) , _servers( servers ){ _sortKey = q.getSort().copy(); _needToSkip = 0; + _finishCons(); } - void ParallelSortClusteredCursor::_init(){ + void ParallelSortClusteredCursor::_finishCons(){ _numServers = _servers.size(); + _cursors = 0; + } + + void ParallelSortClusteredCursor::_init(){ + assert( ! _cursors ); _cursors = new FilteringClientCursor[_numServers]; // TODO: parellize int num = 0; - for ( set<ServerAndQuery>::iterator i = _servers.begin(); i!=_servers.end(); i++ ){ + for ( set<ServerAndQuery>::iterator i = _servers.begin(); i!=_servers.end(); ++i ){ const ServerAndQuery& sq = *i; _cursors[num++].reset( query( sq._server , 0 , sq._extra , _needToSkip ) ); } @@ -336,6 +343,7 @@ namespace mongo { ParallelSortClusteredCursor::~ParallelSortClusteredCursor(){ delete [] _cursors; + _cursors = 0; } bool ParallelSortClusteredCursor::more(){ |