[SERVER-36066] "sleep" command not available with mongos with enableTestCommands=1 Created: 11/Jul/18  Updated: 06/Dec/22  Resolved: 01/Dec/21

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: features we're not sure of

Type: New Feature Priority: Major - P3
Reporter: Derick Rethans Assignee: [DO NOT USE] Backlog - Sharding NYC
Resolution: Won't Do Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding NYC
Participants:

 Description   

As part of out test suite, we use enableTestCommands to be able to use things like the sleep command. When running our tests, we verify for tests that make use of sleep that enableTestCommands is enabled by running getParameter against the (primary) server.

I've recently extended our test suite to also cover a sharded cluster, and now have run into the problem. Even though calling {{ getParameter : 1, parameter: "enableTestCommands" }} on mongos returns {{ ok: 1 }}, the sleep command is not available, and I get the following error when attempting to run it.

This is my full command transcript of what the test internally would run:

mongos> db.runCommand( { getParameter: 1, 'enableTestCommands' : 1 } );
{
	"enableTestCommands" : true,
	"ok" : 1,
	"operationTime" : Timestamp(1531318115, 1),
	"$clusterTime" : {
		"clusterTime" : Timestamp(1531318115, 1),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	}
}
mongos> db.runCommand( { sleep: 1 } );
{
	"ok" : 0,
	"errmsg" : "no such cmd: sleep",
	"code" : 59,
	"codeName" : "CommandNotFound",
	"operationTime" : Timestamp(1531318125, 1),
	"$clusterTime" : {
		"clusterTime" : Timestamp(1531318125, 1),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	}
}

When connecting to a standalone node, the following is returned (as expected):

> db.runCommand( { getParameter: 1, 'enableTestCommands' : 1 } );
{
	"enableTestCommands" : true,
	"ok" : 1,
	"$configServerState" : {
		"opTime" : {
			"ts" : Timestamp(1531318185, 1),
			"t" : NumberLong(1)
		}
	}
}
> db.runCommand( { sleep: 1 } );
{
	"ok" : 1,
	"$configServerState" : {
		"opTime" : {
			"ts" : Timestamp(1531318201, 1),
			"t" : NumberLong(1)
		}
	}
}



 Comments   
Comment by Jack Mulrow [ 01/Dec/21 ]

There hasn't been activity on this ticket for a couple years, so I'm closing it. Feel free to reopen if this is still an issue.

Comment by Kaloian Manassiev [ 24/May/19 ]

I went through the sleep command on MongoD and it looks like it supports taking locks, sleeping under locks, etc. Since MongoS doesn't support locking, this part cannot be duplicated there.

derick, what is the scenario where drivers need to wait on the server site?

Generated at Thu Feb 08 04:41:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.