diff options
author | Trevor Guidry <trevor.guidry@mongodb.com> | 2022-12-13 17:06:52 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-12-13 18:02:47 +0000 |
commit | b4a126b43a7ebc4263a9fa06c123ee22f8af64cc (patch) | |
tree | a2e8f52e20384b555d55318f5abfaf5ebbcaf0a8 /buildscripts/resmokelib/testing/hooks | |
parent | dd42ea7c86b637f683b058bdd4d52e17904a3502 (diff) | |
download | mongo-b4a126b43a7ebc4263a9fa06c123ee22f8af64cc.tar.gz |
SERVER-61794 update pymongo to 4.3.3
Diffstat (limited to 'buildscripts/resmokelib/testing/hooks')
6 files changed, 32 insertions, 32 deletions
diff --git a/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py b/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py index 2ad144e5ec8..e391f8e5664 100644 --- a/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py +++ b/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py @@ -59,7 +59,7 @@ class CleanupConcurrencyWorkloadsTestCase(interface.DynamicTestCase): """Execute drop databases hook.""" same_db_name = None client = self._hook.fixture.mongo_client() - db_names = client.database_names() + db_names = client.list_database_names() exclude_dbs = copy.copy(self._hook.exclude_dbs) if self._hook.same_db_name: @@ -84,7 +84,7 @@ class CleanupConcurrencyWorkloadsTestCase(interface.DynamicTestCase): if self._hook.same_collection_name and same_db_name: self.logger.info("Dropping all collections in db %s except for %s", same_db_name, self._hook.same_collection_name) - colls = client[same_db_name].collection_names() + colls = client[same_db_name].list_collection_names() for coll in [coll for coll in colls if coll != self._hook.same_collection_name]: self.logger.info("Dropping db %s collection %s", same_db_name, coll) try: diff --git a/buildscripts/resmokelib/testing/hooks/continuous_initial_sync.py b/buildscripts/resmokelib/testing/hooks/continuous_initial_sync.py index 09050c94929..91b0cdcd705 100644 --- a/buildscripts/resmokelib/testing/hooks/continuous_initial_sync.py +++ b/buildscripts/resmokelib/testing/hooks/continuous_initial_sync.py @@ -488,14 +488,14 @@ class _InitialSyncThread(threading.Thread): client = mongos_fixture.mongo_client() except pymongo.errors.AutoReconnect: pass - for db in client.database_names(): + for db in client.list_database_names(): self.logger.info("Waiting for mongos %s to retarget db: %s", mongos_conn_str, db) start_time = time.time() while True: try: - coll_names = client[db].collection_names() + coll_names = client[db].list_collection_names() break - except pymongo.errors.NotMasterError: + except pymongo.errors.NotPrimaryError: pass retarget_time = time.time() - start_time if retarget_time >= 60: @@ -508,7 +508,7 @@ class _InitialSyncThread(threading.Thread): try: client[db].command({"collStats": coll}) break - except pymongo.errors.NotMasterError: + except pymongo.errors.NotPrimaryError: pass retarget_time = time.time() - start_time if retarget_time >= 60: diff --git a/buildscripts/resmokelib/testing/hooks/shard_merge.py b/buildscripts/resmokelib/testing/hooks/shard_merge.py index 6518040e567..9b6216b2cdc 100644 --- a/buildscripts/resmokelib/testing/hooks/shard_merge.py +++ b/buildscripts/resmokelib/testing/hooks/shard_merge.py @@ -379,7 +379,7 @@ class _ShardMergeThread(threading.Thread): # pylint: disable=too-many-instance- self.logger, donor_rs_index, recipient_rs_index) def _create_client(self, node): - return fixture_interface.authenticate(node.mongo_client(), self._auth_options) + return fixture_interface.build_client(node, self._auth_options) def _check_tenant_migration_dbhash(self, migration_opts): # Set the donor connection string, recipient connection string, and migration uuid string @@ -461,7 +461,7 @@ class _ShardMergeThread(threading.Thread): # pylint: disable=too-many-instance- bson.SON([("configureFailPoint", "abortTenantMigrationBeforeLeavingBlockingState"), ("mode", "off")])) return - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): self.logger.info( "Retrying connection to donor primary in order to disable abort failpoint for shard merge." ) @@ -514,7 +514,7 @@ class _ShardMergeThread(threading.Thread): # pylint: disable=too-many-instance- res = donor_primary_client.admin.command( cmd_obj, bson.codec_options.CodecOptions(uuid_representation=bson.binary.UUID_SUBTYPE)) - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): donor_primary = migration_opts.get_donor_primary() self.logger.info( "Retrying shard merge '%s' against donor primary on port %d of" + @@ -562,7 +562,7 @@ class _ShardMergeThread(threading.Thread): # pylint: disable=too-many-instance- cmd_obj, bson.codec_options.CodecOptions(uuid_representation=bson.binary.UUID_SUBTYPE)) return - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): donor_primary = migration_opts.get_donor_primary() self.logger.info( "Retrying forgetting shard merge '%s' against donor primary on port %d of " + @@ -606,8 +606,8 @@ class _ShardMergeThread(threading.Thread): # pylint: disable=too-many-instance- }) if res["n"] == 0: break - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): - # Ignore NotMasterErrors because it's possible to fail with + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): + # Ignore NotPrimaryErrors because it's possible to fail with # InterruptedDueToReplStateChange if the donor primary steps down or shuts # down during the garbage collection check. self.logger.info( @@ -634,8 +634,8 @@ class _ShardMergeThread(threading.Thread): # pylint: disable=too-many-instance- }) if res["n"] == 0: break - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): - # Ignore NotMasterErrors because it's possible to fail with + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): + # Ignore NotPrimaryErrors because it's possible to fail with # InterruptedDueToReplStateChange if the recipient primary steps down or # shuts down during the garbage collection check. self.logger.info( @@ -669,7 +669,7 @@ class _ShardMergeThread(threading.Thread): # pylint: disable=too-many-instance- {"_id": bson.Binary(migration_opts.migration_id.bytes, 4)}) if doc is not None: return - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): donor_primary = migration_opts.get_donor_primary() self.logger.info( "Retrying waiting for donor primary on port '%d' of replica set '%s' for " + @@ -704,7 +704,7 @@ class _ShardMergeThread(threading.Thread): # pylint: disable=too-many-instance- return # We retry on all write concern errors because we assume the only reason waiting for # write concern should fail is because of a failover. - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError, + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError, pymongo.errors.WriteConcernError) as err: primary = get_primary(rs, self.logger) self.logger.info( @@ -731,7 +731,7 @@ class _ShardMergeThread(threading.Thread): # pylint: disable=too-many-instance- server_status = client.admin.command({"serverStatus": 1}) pending_drop_idents = server_status["storageEngine"]["dropPendingIdents"] break - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError, + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError, pymongo.errors.WriteConcernError) as err: self.logger.info( "Retrying getting dropPendingIdents against primary on port %d after error %s.", diff --git a/buildscripts/resmokelib/testing/hooks/simulate_crash.py b/buildscripts/resmokelib/testing/hooks/simulate_crash.py index a0b82a1e98c..c03db61bba4 100644 --- a/buildscripts/resmokelib/testing/hooks/simulate_crash.py +++ b/buildscripts/resmokelib/testing/hooks/simulate_crash.py @@ -21,7 +21,7 @@ from buildscripts.resmokelib.testing.hooks import bghook def validate(mdb, logger, acceptable_err_codes): """Return true if all collections are valid.""" - for db in mdb.database_names(): + for db in mdb.list_database_names(): for coll in mdb.get_database(db).list_collection_names(): res = mdb.get_database(db).command({"validate": coll}, check=False) diff --git a/buildscripts/resmokelib/testing/hooks/stepdown.py b/buildscripts/resmokelib/testing/hooks/stepdown.py index 04595e82a4f..e88b3048498 100644 --- a/buildscripts/resmokelib/testing/hooks/stepdown.py +++ b/buildscripts/resmokelib/testing/hooks/stepdown.py @@ -303,7 +303,7 @@ class _StepdownThread(threading.Thread): fixture.get_primary() def _create_client(self, node): - return fixture_interface.authenticate(node.mongo_client(), self._auth_options) + return fixture_interface.build_client(node, self._auth_options) def _step_down_all(self): for rs_fixture in self._rs_fixtures: @@ -414,14 +414,14 @@ class _StepdownThread(threading.Thread): client = self._create_client(mongos_fixture) except pymongo.errors.AutoReconnect: pass - for db in client.database_names(): + for db in client.list_database_names(): self.logger.info("Waiting for mongos %s to retarget db: %s", mongos_conn_str, db) start_time = time.time() while True: try: - coll_names = client[db].collection_names() + coll_names = client[db].list_collection_names() break - except pymongo.errors.NotMasterError: + except pymongo.errors.NotPrimaryError: pass retarget_time = time.time() - start_time if retarget_time >= 60: @@ -434,7 +434,7 @@ class _StepdownThread(threading.Thread): try: client[db].command({"collStats": coll}) break - except pymongo.errors.NotMasterError: + except pymongo.errors.NotPrimaryError: pass retarget_time = time.time() - start_time if retarget_time >= 60: diff --git a/buildscripts/resmokelib/testing/hooks/tenant_migration.py b/buildscripts/resmokelib/testing/hooks/tenant_migration.py index 0ec5d69897b..19d527418dc 100644 --- a/buildscripts/resmokelib/testing/hooks/tenant_migration.py +++ b/buildscripts/resmokelib/testing/hooks/tenant_migration.py @@ -372,7 +372,7 @@ class _TenantMigrationThread(threading.Thread): self.logger) def _create_client(self, node): - return fixture_interface.authenticate(node.mongo_client(), self._auth_options) + return fixture_interface.build_client(node, self._auth_options) def _check_tenant_migration_dbhash(self, migration_opts): # Set the donor connection string, recipient connection string, and migration uuid string @@ -474,7 +474,7 @@ class _TenantMigrationThread(threading.Thread): res = donor_primary_client.admin.command( cmd_obj, bson.codec_options.CodecOptions(uuid_representation=bson.binary.UUID_SUBTYPE)) - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): donor_primary = migration_opts.get_donor_primary() self.logger.info( "Retrying tenant migration '%s' against donor primary on port %d of replica " + @@ -522,7 +522,7 @@ class _TenantMigrationThread(threading.Thread): cmd_obj, bson.codec_options.CodecOptions(uuid_representation=bson.binary.UUID_SUBTYPE)) return - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): donor_primary = migration_opts.get_donor_primary() self.logger.info( "Retrying forgetting tenant migration '%s' against donor primary on port %d of " @@ -566,8 +566,8 @@ class _TenantMigrationThread(threading.Thread): }) if res["n"] == 0: break - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): - # Ignore NotMasterErrors because it's possible to fail with + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): + # Ignore NotPrimaryErrors because it's possible to fail with # InterruptedDueToReplStateChange if the donor primary steps down or shuts # down during the garbage collection check. self.logger.info( @@ -594,8 +594,8 @@ class _TenantMigrationThread(threading.Thread): }) if res["n"] == 0: break - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): - # Ignore NotMasterErrors because it's possible to fail with + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): + # Ignore NotPrimaryErrors because it's possible to fail with # InterruptedDueToReplStateChange if the recipient primary steps down or # shuts down during the garbage collection check. self.logger.info( @@ -629,7 +629,7 @@ class _TenantMigrationThread(threading.Thread): {"_id": bson.Binary(migration_opts.migration_id.bytes, 4)}) if doc is not None: return - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError): + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError): donor_primary = migration_opts.get_donor_primary() self.logger.info( "Retrying waiting for donor primary on port '%d' of replica set '%s' for " + @@ -664,7 +664,7 @@ class _TenantMigrationThread(threading.Thread): return # We retry on all write concern errors because we assume the only reason waiting for # write concern should fail is because of a failover. - except (pymongo.errors.AutoReconnect, pymongo.errors.NotMasterError, + except (pymongo.errors.AutoReconnect, pymongo.errors.NotPrimaryError, pymongo.errors.WriteConcernError) as err: primary = get_primary(rs, self.logger) self.logger.info( |