Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2212

Server automatically abort queries/commands after user-specified time limit

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.4
    • Component/s: Querying
    • Labels:

      Description

      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-8579 is 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.
      • 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.

        Issue Links

          Activity

          Hide
          auto auto (Inactive) added a comment -

          Author:

          {u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

          Message: SERVER-2212 mongos tracks elapsed time for sharded cursors

          If a maxTimeMS sharded query exceeds its time limit, the next request
          for a batch will fail with an error.
          Branch: master
          https://github.com/mongodb/mongo/commit/195c99e44a1483816b3be2a1f6f42bffed7ec18e

          Show
          auto auto (Inactive) added a comment - Author: {u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'} Message: SERVER-2212 mongos tracks elapsed time for sharded cursors If a maxTimeMS sharded query exceeds its time limit, the next request for a batch will fail with an error. Branch: master https://github.com/mongodb/mongo/commit/195c99e44a1483816b3be2a1f6f42bffed7ec18e
          Hide
          auto auto (Inactive) added a comment -

          Author:

          {u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

          Message: SERVER-2212 mongos maxTimeMS support for moveChunk
          Branch: master
          https://github.com/mongodb/mongo/commit/323abaca6f8168b4ff42d3fe08931e7fed3d0fc1

          Show
          auto auto (Inactive) added a comment - Author: {u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'} Message: SERVER-2212 mongos maxTimeMS support for moveChunk Branch: master https://github.com/mongodb/mongo/commit/323abaca6f8168b4ff42d3fe08931e7fed3d0fc1
          Hide
          auto auto (Inactive) added a comment -

          Author:

          {u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

          Message: SERVER-2212 mongos maxTimeMS support for aggregate, count, mapReduce
          Branch: master
          https://github.com/mongodb/mongo/commit/59c349c00ecd5de1adb18f398a63917c36c8334b

          Show
          auto auto (Inactive) added a comment - Author: {u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'} Message: SERVER-2212 mongos maxTimeMS support for aggregate, count, mapReduce Branch: master https://github.com/mongodb/mongo/commit/59c349c00ecd5de1adb18f398a63917c36c8334b
          Hide
          auto auto (Inactive) added a comment -

          Author:

          {u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

          Message: SERVER-11496 SERVER-2212 Fix race condition in max_time_ms_sharded.js

          Wait for inserts to complete before expecting count to include them.
          Branch: master
          https://github.com/mongodb/mongo/commit/02d96b609930ce10ea82a4a317baf5731ed04989

          Show
          auto auto (Inactive) added a comment - Author: {u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'} Message: SERVER-11496 SERVER-2212 Fix race condition in max_time_ms_sharded.js Wait for inserts to complete before expecting count to include them. Branch: master https://github.com/mongodb/mongo/commit/02d96b609930ce10ea82a4a317baf5731ed04989
          Hide
          auto auto (Inactive) added a comment -

          Author:

          {u'username': u'jrassi', u'name': u'j. rassi', u'email': u'rassi@10gen.com'}

          Message: SERVER-11501 SERVER-2212 Fix deref. of invalidated iterator
          Branch: master
          https://github.com/mongodb/mongo/commit/a6678a47b6e2700a502984cc1b990ded37f61c7f

          Show
          auto auto (Inactive) added a comment - Author: {u'username': u'jrassi', u'name': u'j. rassi', u'email': u'rassi@10gen.com'} Message: SERVER-11501 SERVER-2212 Fix deref. of invalidated iterator Branch: master https://github.com/mongodb/mongo/commit/a6678a47b6e2700a502984cc1b990ded37f61c7f

            People

            • Votes:
              35 Vote for this issue
              Watchers:
              41 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                1 year, 29 weeks, 5 days ago
                Date of 1st Reply: