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

Tenant migration hook retryability fails to select new servers after election

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • ALL
    • Server Serverless 2023-01-23, Server Serverless 2023-02-06, Server Serverless 2023-02-20, Server Serverless 2023-03-06, Server Serverless 2023-03-20, Server Serverless 2023-04-03, Server Serverless 2023-04-17
    • 5

    Description

      The tenant migration hook and fixture implement retryability outside of the driver which is now subtly broken after the PyMongo 4 upgrade.

      def _wait_for_reroute_or_test_completion(self, migration_opts):
          start_time = time.time()
          donor_primary = migration_opts.get_donor_primary()
       
          while not self.__lifecycle.is_test_finished():
              try:
                  donor_primary_client = self._create_client(donor_primary)
                  ...
              except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError):
                  donor_primary = migration_opts.get_donor_primary()
                  continue
              except pymongo.errors.PyMongoError:
                  raise
              time.sleep(self.POLL_INTERVAL_SECS)
      

      The above code will select the MongoDFixture of the current primary at operation start, create a client to it, and then attempt to run find commands against it. The change after SERVER-61794 is that a connection to that fixture uses a connection string with directConnection=true in it, disabling any automatic discovery the driver might do. If the selected node fails with a non-retryable error, we will rethrow that error instead of trying to select the primary.

      We should remove the custom implementation of retryability, and instead depend on the driver's implementation (which we accidentally already depended on).

      Attachments

        Activity

          People

            matt.broadstone@mongodb.com Matt Broadstone
            matt.broadstone@mongodb.com Matt Broadstone
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: