summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zhang <jason.zhang@mongodb.com>2021-02-17 17:41:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-19 20:48:00 +0000
commit6d2adad86ca0ba48e5fa33d5ed43c0385a9e44f1 (patch)
tree49d139dbcaede7da5bf7145e008fa2d1e19f3e2c
parentd3681fd24e039baf75d946e01b5d485cefb956aa (diff)
downloadmongo-6d2adad86ca0ba48e5fa33d5ed43c0385a9e44f1.tar.gz
SERVER-54264 Exclude tenantMigrationAccessBlocker serverStatus section from FTDC
-rw-r--r--jstests/replsets/tenant_migration_metrics_output.js67
-rw-r--r--src/mongo/db/ftdc/ftdc_server.cpp3
2 files changed, 70 insertions, 0 deletions
diff --git a/jstests/replsets/tenant_migration_metrics_output.js b/jstests/replsets/tenant_migration_metrics_output.js
new file mode 100644
index 00000000000..e94ed91a537
--- /dev/null
+++ b/jstests/replsets/tenant_migration_metrics_output.js
@@ -0,0 +1,67 @@
+/**
+ * Verifies the serverStatus output and FTDC output for tenant migrations.
+ *
+ * @tags: [requires_fcv_47, requires_majority_read_concern, incompatible_with_eft,
+ * incompatible_with_windows_tls]
+ */
+
+(function() {
+"use strict";
+
+load("jstests/libs/ftdc.js");
+load("jstests/libs/uuid_util.js");
+load("jstests/replsets/libs/tenant_migration_test.js");
+load("jstests/replsets/libs/tenant_migration_util.js");
+
+const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest();
+
+// Verify that the server status response has the fields that we expect.
+function verifyServerStatus(conn) {
+ const res = assert.commandWorked(conn.adminCommand({serverStatus: 1}));
+ assert.hasFields(res, ["tenantMigrationAccessBlocker"]);
+}
+// Verify the periodic samples used for FTDC do not have the 'tenantMigrationAccessBlocker' section.
+function verifyFTDCOutput(conn) {
+ const latestPeriodicFTDC = verifyGetDiagnosticData(conn.getDB("admin"));
+ assert.hasFields(latestPeriodicFTDC, ["serverStatus"]);
+ assert.eq(undefined, latestPeriodicFTDC.serverStatus.tenantMigrationAccessBlocker);
+}
+
+jsTestLog("Verify serverStatus and FTDC output after a migration has committed.");
+
+const testPath = MongoRunner.toRealPath("ftdc_dir_repl_node");
+const donorRst = new ReplSetTest({
+ nodes: 1,
+ name: "donorRst",
+ nodeOptions: Object.assign(migrationX509Options.donor,
+ {setParameter: {diagnosticDataCollectionDirectoryPath: testPath}})
+});
+
+donorRst.startSet();
+donorRst.initiate();
+
+const tenantMigrationTest =
+ new TenantMigrationTest({name: jsTestName(), donorRst, enableRecipientTesting: false});
+if (!tenantMigrationTest.isFeatureFlagEnabled()) {
+ jsTestLog("Skipping test because the tenant migrations feature flag is disabled");
+ donorRst.stopSet();
+ return;
+}
+
+const tenantId = "testTenantId";
+const migrationId = extractUUIDFromObject(UUID());
+const migrationOpts = {
+ migrationIdString: migrationId,
+ tenantId: tenantId,
+ recipientConnString: tenantMigrationTest.getRecipientConnString()
+};
+
+const stateRes = assert.commandWorked(tenantMigrationTest.runMigration(migrationOpts));
+assert.eq(stateRes.state, TenantMigrationTest.State.kCommitted);
+
+verifyServerStatus(tenantMigrationTest.getDonorPrimary());
+verifyFTDCOutput(tenantMigrationTest.getDonorPrimary());
+
+tenantMigrationTest.stop();
+donorRst.stopSet();
+})();
diff --git a/src/mongo/db/ftdc/ftdc_server.cpp b/src/mongo/db/ftdc/ftdc_server.cpp
index 9068f480a8d..b683a69ea5a 100644
--- a/src/mongo/db/ftdc/ftdc_server.cpp
+++ b/src/mongo/db/ftdc/ftdc_server.cpp
@@ -210,6 +210,8 @@ public:
// "defaultRWConcern" is excluded because it changes rarely and instead included in rotation
// "mirroredReads" is included to append the number of mirror-able operations observed and
// mirrored by this process in FTDC collections.
+ // "tenantMigrationAccessBlocker" section is filtered out because its variability in
+ // document shape hurts FTDC compression.
BSONObjBuilder commandBuilder;
commandBuilder.append(kCommand, 1);
@@ -217,6 +219,7 @@ public:
commandBuilder.append("timing", false);
commandBuilder.append("defaultRWConcern", false);
commandBuilder.append(MirrorMaestro::kServerStatusSectionName, true);
+ commandBuilder.append("tenantMigrationAccessBlocker", false);
// Exclude 'serverStatus.transactions.lastCommittedTransactions' because it triggers
// frequent schema changes.