0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-15318 copydb should not use exhaust flag when used against mongos

This commit is contained in:
Randolph Tan 2014-11-21 16:35:21 -05:00
parent 4429df3a6c
commit 8deddb065c
6 changed files with 84 additions and 15 deletions

View File

@ -468,6 +468,7 @@ def skipTest(path):
("sharding", "sync3.js"), # SERVER-6388 for this and those below
("sharding", "sync6.js"),
("sharding", "parallel.js"),
("sharding", "copydb_from_mongos.js"), # SERVER-13080
("jstests", "bench_test1.js"),
("jstests", "bench_test2.js"),
("jstests", "bench_test3.js"),

View File

@ -0,0 +1,16 @@
var st = new ShardingTest({ shards: 2, other: { shardOptions: { verbose: 1 }}});
var testDB = st.s.getDB('test');
assert.writeOK(testDB.foo.insert({ a: 1 }));
var res = testDB.adminCommand({ copydb: 1,
fromhost: st.s.host,
fromdb: 'test',
todb: 'test_copy' });
assert.commandWorked(res);
var copy = st.s.getDB('test_copy');
assert.eq(1, copy.foo.count());
assert.eq(1, copy.foo.findOne().a);
st.stop();

View File

@ -96,8 +96,20 @@ namespace mongo {
*/
QueryOption_PartialResults = 1 << 7 ,
QueryOption_AllSupported = QueryOption_CursorTailable | QueryOption_SlaveOk | QueryOption_OplogReplay | QueryOption_NoCursorTimeout | QueryOption_AwaitData | QueryOption_Exhaust | QueryOption_PartialResults
QueryOption_AllSupported = QueryOption_CursorTailable |
QueryOption_SlaveOk |
QueryOption_OplogReplay |
QueryOption_NoCursorTimeout |
QueryOption_AwaitData |
QueryOption_Exhaust |
QueryOption_PartialResults,
QueryOption_AllSupportedForSharding = QueryOption_CursorTailable |
QueryOption_SlaveOk |
QueryOption_OplogReplay |
QueryOption_NoCursorTimeout |
QueryOption_AwaitData |
QueryOption_PartialResults,
};
enum MONGO_CLIENT_API UpdateOptions {

View File

@ -1202,6 +1202,32 @@ namespace mongo {
}
} cmdWhatsMyUri;
class AvailableQueryOptions: public Command {
public:
AvailableQueryOptions(): Command("availableQueryOptions",
false,
"availablequeryoptions") {
}
virtual bool slaveOk() const { return true; }
virtual bool isWriteCommandForConfigServer() const { return false; }
virtual Status checkAuthForCommand(ClientBasic* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return Status::OK();
}
virtual bool run(OperationContext* txn,
const string& dbname,
BSONObj& cmdObj,
int,
string& errmsg,
BSONObjBuilder& result,
bool) {
result << "options" << QueryOption_AllSupported;
return true;
}
} availableQueryOptionsCmd;
bool _execCommand(OperationContext* txn,
Command *c,

View File

@ -343,20 +343,6 @@ namespace mongo {
}
} cmdForceError;
class AvailableQueryOptions : public Command {
public:
AvailableQueryOptions() : Command( "availableQueryOptions" , false , "availablequeryoptions" ) {}
virtual bool slaveOk() const { return true; }
virtual bool isWriteCommandForConfigServer() const { return false; }
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) {} // No auth required
virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
result << "options" << QueryOption_AllSupported;
return true;
}
} availableQueryOptionsCmd;
class GetLogCmd : public Command {
public:
GetLogCmd() : Command( "getLog" ){}

View File

@ -2669,6 +2669,34 @@ namespace mongo {
}
} cmdListIndexes;
class AvailableQueryOptions : public Command {
public:
AvailableQueryOptions(): Command("availableQueryOptions",
false ,
"availablequeryoptions") {
}
virtual bool slaveOk() const { return true; }
virtual bool isWriteCommandForConfigServer() const { return false; }
virtual Status checkAuthForCommand(ClientBasic* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return Status::OK();
}
virtual bool run(OperationContext* txn,
const string& dbname,
BSONObj& cmdObj,
int,
string& errmsg,
BSONObjBuilder& result,
bool) {
result << "options" << QueryOption_AllSupportedForSharding;
return true;
}
} availableQueryOptionsCmd;
} // namespace pub_grid_cmds
void Command::runAgainstRegistered(const char *ns, BSONObj& jsobj, BSONObjBuilder& anObjBuilder,