From ae65ecae5514adc99d60b7396137a1acf2b44335 Mon Sep 17 00:00:00 2001 From: Will Buerger Date: Wed, 17 May 2023 11:49:47 +0000 Subject: SERVER-76427 Rename $telemetry to $queryStats --- .../query_stats_configuration.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 jstests/noPassthroughWithMongod/query_stats_configuration.js (limited to 'jstests/noPassthroughWithMongod/query_stats_configuration.js') diff --git a/jstests/noPassthroughWithMongod/query_stats_configuration.js b/jstests/noPassthroughWithMongod/query_stats_configuration.js new file mode 100644 index 00000000000..544fa63bc6d --- /dev/null +++ b/jstests/noPassthroughWithMongod/query_stats_configuration.js @@ -0,0 +1,33 @@ +/** + * Tests that the telemetry store can be resized if it is configured, and cannot be resized if it is + * disabled. + */ +(function() { +"use strict"; + +load("jstests/libs/feature_flag_util.js"); + +if (FeatureFlagUtil.isEnabled(db, "QueryStats")) { + function testTelemetrySetting(paramName, paramValue) { + // The feature flag is enabled - make sure the telemetry store can be configured. + const original = assert.commandWorked(db.adminCommand({getParameter: 1, [paramName]: 1})); + assert(original.hasOwnProperty(paramName), original); + const originalValue = original[paramName]; + try { + assert.doesNotThrow(() => db.adminCommand({setParameter: 1, [paramName]: paramValue})); + // Other tests verify that changing the parameter actually affects the behavior. + } finally { + assert.doesNotThrow(() => + db.adminCommand({setParameter: 1, [paramName]: originalValue})); + } + } + testTelemetrySetting("internalQueryStatsCacheSize", "2MB"); + testTelemetrySetting("internalQueryStatsSamplingRate", 2147483647); +} else { + // The feature flag is disabled - make sure the telemetry store *cannot* be configured. + assert.commandFailedWithCode( + db.adminCommand({setParameter: 1, internalQueryStatsCacheSize: '2MB'}), 7373500); + assert.commandFailedWithCode( + db.adminCommand({setParameter: 1, internalQueryStatsSamplingRate: 2147483647}), 7506200); +} +}()); -- cgit v1.2.1