summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Broadstone <mbroadst@mongodb.com>2022-11-14 19:48:57 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-14 20:24:38 +0000
commit32ced838bccafe3a8274c7eb732af4ce337a7cc4 (patch)
tree7a12e142cb20e02dd86706c118e81a77416ac09e
parentb53b6e747708a2f3dec0a064e4574d2bcfedfdc3 (diff)
downloadmongo-32ced838bccafe3a8274c7eb732af4ce337a7cc4.tar.gz
SERVER-71293 Don't close shared logger after retiring donor
-rw-r--r--buildscripts/resmokelib/testing/fixtures/replicaset.py2
-rw-r--r--buildscripts/resmokelib/testing/fixtures/shard_split.py17
2 files changed, 12 insertions, 7 deletions
diff --git a/buildscripts/resmokelib/testing/fixtures/replicaset.py b/buildscripts/resmokelib/testing/fixtures/replicaset.py
index d9c463e29c9..e8f681c8f62 100644
--- a/buildscripts/resmokelib/testing/fixtures/replicaset.py
+++ b/buildscripts/resmokelib/testing/fixtures/replicaset.py
@@ -447,7 +447,7 @@ class ReplicaSetFixture(interface.ReplFixture):
primary.mongo_client().admin.command(cmd)
def _do_teardown(self, mode=None):
- self.logger.info("Stopping all members of the replica set...")
+ self.logger.info("Stopping all members of the replica set '%s'...", self.replset_name)
running_at_start = self.is_running()
if not running_at_start:
diff --git a/buildscripts/resmokelib/testing/fixtures/shard_split.py b/buildscripts/resmokelib/testing/fixtures/shard_split.py
index ce80daf270c..18fba2304a9 100644
--- a/buildscripts/resmokelib/testing/fixtures/shard_split.py
+++ b/buildscripts/resmokelib/testing/fixtures/shard_split.py
@@ -16,11 +16,16 @@ def _is_replica_set_fixture(fixture):
return hasattr(fixture, 'replset_name')
-def _teardown_and_clean_node(node):
- """Teardown the provided node and remove its data directory."""
- node.teardown(finished=True)
+def _teardown_and_clean_fixture(fixture):
+ """Teardown the provided fixture, and remove its data directory."""
+ # ReplicaSetFixtures in the shard split fixture share the same logger as the parent
+ # ShardSplitFixture instance. We only want to explicitly close the loggers if we are tearing
+ # down single recipient nodes (before they become a replica set).
+ should_close_logger = not _is_replica_set_fixture(fixture)
+ fixture.teardown(finished=should_close_logger)
+
# Remove the data directory for the node to prevent unbounded disk space utilization.
- shutil.rmtree(node.get_dbpath_prefix(), ignore_errors=False)
+ shutil.rmtree(fixture.get_dbpath_prefix(), ignore_errors=False)
class ShardSplitFixture(interface.MultiClusterFixture):
@@ -358,7 +363,7 @@ class ShardSplitFixture(interface.MultiClusterFixture):
self.logger.info("Tearing down recipient nodes and removing data directories.")
for recipient_node in reversed(recipient_nodes):
- _teardown_and_clean_node(recipient_node)
+ _teardown_and_clean_fixture(recipient_node)
def replace_donor_with_recipient(self, recipient_set_name):
"""Replace the current donor with the newly initiated recipient."""
@@ -384,7 +389,7 @@ class ShardSplitFixture(interface.MultiClusterFixture):
self._can_teardown_retired_donor_rs.wait()
self.logger.info(f"Retiring old donor replica set '{retired_donor_rs.replset_name}'.")
- _teardown_and_clean_node(retired_donor_rs)
+ _teardown_and_clean_fixture(retired_donor_rs)
def enter_step_down(self):
"""Called by the ContinuousStepDown hook to indicate that we are stepping down."""