Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1236

The type of connection_id for killCursors events differs depending on server version

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 3.1, 3.2, 3.3, 3.4
    • 3.5
    • None
    • Minor Change

    Description

      killCursors events for MongoDB >= 3.2 publish connection_id as an instance of tuple. For MongoDB < 3.2 connection_id is published as an internal type, _CursorAddress, a subclass of tuple with an extra attribute.

      This was uncovered by a test failure under Jython, which appears to consider exact subclass in comparisons:

      ======================================================================
      FAIL: test_kill_cursors (test.test_monitoring.TestCommandMonitoring)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "test/test_monitoring.py", line 508, in test_kill_cursors
          self.assertEqual(cursor.address, started.connection_id)
      AssertionError: (u'localhost', 27017) != (u'localhost', 27017)
      

      We'll fix this by always publishing a tuple, rather than the subclass, to match the rest of the monitoring API. This change could be a backward breaking change for some application somewhere (though that's extremely unlikely).

      Attachments

        Activity

          People

            bernie@mongodb.com Bernie Hackett
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: