-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Querying
Add { $maxTimeMS: <integer> } as a query option, and add { maxTimeMS: <integer> } as a command option to all commands. Operations that exceed their time limit will be aborted, and an error will be returned to the client. A cursor.maxTimeMS() shell helper will be provided for queries.
Details:
- An operation's "elapsed time" for the purpose of this feature will be the same as the operation's "elapsed time" as reported by the logging / profiling subsystems.
- The abort semantics provided will be very similar to that of db.killOp():
- Operations cannot currently be interrupted while waiting to acquire a lock (but this will be supported when
SERVER-8579is resolved). - Write operations are generally not interruptible once the first write occurs.
- As a corollary, it is expected that operations which do not reach an interrupt point after exceeding the time limit will have an elapsed time longer than the time limit, and will be logged/profiled as such.
- Operations cannot currently be interrupted while waiting to acquire a lock (but this will be supported when
- A query that completes in under its time limit will "roll over" its remaining time to the first getmore op (which will then "roll over" its remaining time to the second getmore op and so on, until the time limit is hit).
- Cursors returned by successful time-limited queries will still obey the default cursor idle timeout (unless the "no cursor idle timeout" flag has been set).
- For now, insert/update/delete will not support time-limited operations.
- depends on
-
SERVER-10550 CurOp::_killPending not always cleared between client operations
- Closed
- is depended on by
-
CSHARP-790 Server automatically abort queries/commands after user-specified time limit
- Closed
-
DRIVERS-99 Add support for server automatically aborting queries/commands after user-specified time limit
- Closed
-
JAVA-910 Support new $maxTimeMS field for all commands and queries
- Closed
-
PYTHON-550 Support $maxTimeMS for commands and queries (MongoDB 2.6)
- Closed
- is duplicated by
-
SERVER-6761 db.coll.find(...).timeout(3000) should force the query to abort after 3000 ms
- Closed
-
SERVER-3379 Query Timeout
- Closed
- is related to
-
SERVER-10382 Interrupted count commands don't return an error code
- Closed
-
SERVER-10995 Elapsed time for $maxTimeMS queries includes time to acquire db lock
- Closed
-
SERVER-11216 Interrupted geoNear commands on mongos don't return an error code
- Closed
-
SERVER-11221 maxTimeMS(0.1) should return error
- Closed
-
SERVER-11488 Supported mongos commands should propagate maxTimeMS option to shards
- Closed
-
SERVER-11243 Add server status counter "time limit exceptions"
- Closed
-
SERVER-6113 Uneven distribution of yields are unfair
- Backlog
-
SERVER-8499 Server Side setting for Max query execution time
- Backlog
-
SERVER-11094 Javascript interruption should use semantic "operation interrupted" error codes
- Closed
-
SERVER-11185 Time-interrupted operations should not generate a log message by default
- Closed
-
SERVER-11361 RunOnAllShardsCommand::run() should set "code" on error, if appropriate
- Closed
-
SERVER-4477 Interrupting compact can cause drop of collection indexes
- Closed
- related to
-
SERVER-3960 High CPU usage no IO Wait
- Closed