Skip to content

Instantly share code, notes, and snippets.

View scotthernandez's full-sized avatar

Scott Hernandez scotthernandez

View GitHub Profile
thread #1: initAndListen
thread #2: signalProcessingThread
thread #3: BackgroundThreadClockSource::_startTimerThread
thread #4: mongod`__log_file_server
thread #5: mongod`__log_wrlsn_server
thread #6: mongod`__log_server
thread #7: mongod`__evict_thread
thread #8: mongod`__sweep_server
thread #9: mongod`__ckpt_server
thread #10: WiredTigerKVEngine::WiredTigerJournalFlusher
diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h
index a4e23c3..3e97358 100644
--- a/src/mongo/client/dbclientinterface.h
+++ b/src/mongo/client/dbclientinterface.h
@@ -1249,8 +1249,14 @@ protected:
// throws SocketException if in failed state and not reconnecting or if waiting to reconnect
void checkConnection() {
- if (_failed)
+ if (_failed) {
var st = new ShardingTest({nodes:2})
db = st.s0.getDB("test")
sh.enableSharding("test")
sh.shardCollection("test.Listings")
sh.shardCollection("test.Listings", {_id:"hashed"})
db.Listings.insert([
{ "_id" : 1, "location" : { "type" : "Point", "coordinates" : [ 0, 0 ] } },
{ "_id" : 2, "location" : { "type" : "Point", "coordinates" : [ 1, 1 ] } },
{ "_id" : 3, "location" : [ 0, 0 ] }
])
printShardingStatus = function( configDB , verbose ){
if (configDB === undefined)
configDB = db.getSisterDB('config')
var version = configDB.getCollection( "version" ).findOne();
if ( version == null ){
print( "printShardingStatus: this db does not have sharding enabled. be sure you are connecting to a mongos from the shell and not to a mongod." );
return;
}
> db.runCommand({$eval:function(){return db.currentOp();}, nolock:true})
{
"retval" : {
"inprog" : [
{
"opid" : 343703,
"active" : true,
"waitingForLock" : false,
"secs_running" : 0,
"op" : "query",
> db.killOp
function (op) {
if (!op) {
throw "no opNum to kill specified";
}
return db.$cmd.sys.killop.findOne({op:op});
}
> db["$cmd.sys.killop"].findOne({op:12121})
{ "info" : "attempting to kill op" }
> db.a.save({_id:1, vals: {first:[1,2,3,], second:[1,2,3]}})
> db.a.find()
{ "_id" : 1, "vals" : { "first" : [ 1, 2, 3 ], "second" : [ 1, 2, 3 ] } }
> db.a.find({},{"vals.first":{$slice:2}})
{ "_id" : 1, "vals" : { "first" : [ 1, 2 ], "second" : [ 1, 2, 3 ] } }
//I would have expected this to work... might call that a bug.
> db.a.find({},{"vals.first":1, "vals.first":{$slice:2}})
> db.bin.find()
> db.bin.save({_id:new BinData(1, "0x01")})
> db.bin.find()
{ "_id" : BinData(1,"0x01") }
> db.bin.save({_id:new BinData(1, "0x02")})
> db.bin.find()
{ "_id" : BinData(1,"0x01") }
{ "_id" : BinData(1,"0x02") }
> db.bin.find({_id:{$gt:new BinData(1, "0x01")}})
{ "_id" : BinData(1,"0x02") }
{
"version" : "1.6.3",
"uptime" : 1416076,
"uptimeEstimate" : 1275163,
"localTime" : "Sat Oct 16 2010 08:32:32 GMT-0700 (PDT)",
"globalLock" : {
"totalTime" : 1416076002159,
"lockTime" : 37218463,
"ratio" : 0.000026282814582872248,
"currentQueue" : {
> db.groups.findOne()
{
"_id" : 1,
"users" : [
{
"name" : "skot",
"age" : 1
},
{
"name" : "fred",