Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-430

Test that killCursors really succeeds

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      PYTHON-1433 Works as Designed
      CDRIVER-2417 Fixed 1.10.0
      JAVA-2691 Fixed 3.6.1
      NODE-1214 Fixed 3.0.0
      SCALA-362 Won't Fix
      CSHARP-2119 Fixed 2.9.0
      PERL-833 Fixed 2.1.0
      RUBY-1265 Fixed 2.7.0.rc0
      CXX-1479 Backlog
      PHPC-1056 Works as Designed
      GODRIVER-144 Done
      RUST-167 Backlog
      SWIFT-482 Won't Do
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion PYTHON-1433 Works as Designed CDRIVER-2417 Fixed 1.10.0 JAVA-2691 Fixed 3.6.1 NODE-1214 Fixed 3.0.0 SCALA-362 Won't Fix CSHARP-2119 Fixed 2.9.0 PERL-833 Fixed 2.1.0 RUBY-1265 Fixed 2.7.0.rc0 CXX-1479 Backlog PHPC-1056 Works as Designed GODRIVER-144 Done RUST-167 Backlog SWIFT-482 Won't Do

    Description

      In SERVER-32169 we noticed that it's easy to miss bugs in drivers' killCursors implementations. The killCursors command can fail but still report "ok: 1", listing the cursor ids it failed to kill in the "cursorsAlive" array:

      > db.runCommand({killCursors: "collection", cursors: [NumberLong(0)]})
      {
        ok: 1,
        cursorsNotFound: [NumberLong(0)],
        cursorsKilled: [],
        cursorsAlive: []
      }
      

      If your driver already includes tests that prove it really can kill a cursor, then you don't need to do anything. For example, PyMongo can't always kill a cursor with MongoDB 3.7.x due to SERVER-32169, and this was discovered because three of PyMongo's tests fail with MongoDB 3.7.x. If you driver has tests which fail due to SERVER-32169 then you may be able to validate this ticket already. Otherwise, here's a suggested test.

      Write a test in each driver that checks we really kill a cursor:

      • insert 1000 documents into a collection
      • do a "find" on the collection and iterate the cursor past the first document
      • store the cursor id in a variable
      • assert the cursor id is nonzero
      • kill the cursor (explicitly, or by letting it go out of scope, depending on the driver)
      • assert that the driver receives a server reply to "killCursors" with "ok: 1", an empty "cursorsNotFound" array, an empty "cursorsAlive" array, an empty "cursorsUnknown" array, and a "cursorsKilled" array with one element equal to the cursor id

      Drivers can use Command Monitoring, if they've implemented it, to check the server reply.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: