From de724d3d8a82667ac9da97c39abf0b9d9728cba4 Mon Sep 17 00:00:00 2001 From: Maria van Keulen Date: Wed, 9 Oct 2019 20:25:44 +0000 Subject: SERVER-41622 Reduce noise in flow_control_replica_set.js (cherry picked from commit bcf90959f986b66689fe0b21a03572178eb2de15) --- jstests/noPassthrough/flow_control_replica_set.js | 66 ----------------------- jstests/serial_run/flow_control_replica_set.js | 66 +++++++++++++++++++++++ 2 files changed, 66 insertions(+), 66 deletions(-) delete mode 100644 jstests/noPassthrough/flow_control_replica_set.js create mode 100644 jstests/serial_run/flow_control_replica_set.js diff --git a/jstests/noPassthrough/flow_control_replica_set.js b/jstests/noPassthrough/flow_control_replica_set.js deleted file mode 100644 index 025c04e4e5b..00000000000 --- a/jstests/noPassthrough/flow_control_replica_set.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * This test artificially throttles a replica set by limiting the tickets handed out. It first - * performs a calibrating run that sees how many inserts per second a one node replica set can - * handle. Non-batch inserts should acquire one lock per insert. The test then sets the ticket - * generation to a fraction of this discovered calibration value. A following benchrun validates the - * new insert rate falls within some (generous) range. - * - * @tags: [ - * requires_replication, - * requires_flow_control, - * requires_majority_read_concern, - * ] - */ -(function() { -"use strict"; - -const replTest = new ReplSetTest({nodes: 1}); -replTest.startSet(); -replTest.initiate(); - -const primary = replTest.getPrimary(); - -assert.commandWorked(primary.adminCommand({ - configureFailPoint: "flowControlTicketOverride", - mode: "alwaysOn", - data: {"numTickets": 1000 * 1000 * 1000} -})); -// Sleep 2 seconds for the failpoint to take effect. -sleep(2000); - -let result = benchRun({ - host: primary.host, - seconds: 5, - parallel: 5, - ops: [{op: "insert", ns: "foo.bar", doc: {field: "value"}}] -}); -jsTestLog({CalibratingRun: result}); - -let insertRate = result["insert"]; -let throttledRate = insertRate / 2; -assert.commandWorked(primary.adminCommand({ - configureFailPoint: "flowControlTicketOverride", - mode: "alwaysOn", - data: {"numTickets": NumberInt(throttledRate)} -})); -// Sleep 2 seconds for the failpoint to take effect. -sleep(2000); - -result = benchRun({ - host: primary.host, - seconds: 5, - parallel: 5, - ops: [{op: "insert", ns: "foo.bar", doc: {field: "value"}}] -}); -jsTestLog({ThrottledRun: result, ThrottedRate: throttledRate}); -let maxAllowedRate = 1.5 * throttledRate; -let minAllowedRate = 0.5 * throttledRate; -assert.gt(result["insert"], minAllowedRate); -assert.lt(result["insert"], maxAllowedRate); - -// Cautiously unset to avoid any interaction with shutdown. -assert.commandWorked( - primary.adminCommand({configureFailPoint: "flowControlTicketOverride", mode: "off"})); - -replTest.stopSet(); -})(); diff --git a/jstests/serial_run/flow_control_replica_set.js b/jstests/serial_run/flow_control_replica_set.js new file mode 100644 index 00000000000..025c04e4e5b --- /dev/null +++ b/jstests/serial_run/flow_control_replica_set.js @@ -0,0 +1,66 @@ +/** + * This test artificially throttles a replica set by limiting the tickets handed out. It first + * performs a calibrating run that sees how many inserts per second a one node replica set can + * handle. Non-batch inserts should acquire one lock per insert. The test then sets the ticket + * generation to a fraction of this discovered calibration value. A following benchrun validates the + * new insert rate falls within some (generous) range. + * + * @tags: [ + * requires_replication, + * requires_flow_control, + * requires_majority_read_concern, + * ] + */ +(function() { +"use strict"; + +const replTest = new ReplSetTest({nodes: 1}); +replTest.startSet(); +replTest.initiate(); + +const primary = replTest.getPrimary(); + +assert.commandWorked(primary.adminCommand({ + configureFailPoint: "flowControlTicketOverride", + mode: "alwaysOn", + data: {"numTickets": 1000 * 1000 * 1000} +})); +// Sleep 2 seconds for the failpoint to take effect. +sleep(2000); + +let result = benchRun({ + host: primary.host, + seconds: 5, + parallel: 5, + ops: [{op: "insert", ns: "foo.bar", doc: {field: "value"}}] +}); +jsTestLog({CalibratingRun: result}); + +let insertRate = result["insert"]; +let throttledRate = insertRate / 2; +assert.commandWorked(primary.adminCommand({ + configureFailPoint: "flowControlTicketOverride", + mode: "alwaysOn", + data: {"numTickets": NumberInt(throttledRate)} +})); +// Sleep 2 seconds for the failpoint to take effect. +sleep(2000); + +result = benchRun({ + host: primary.host, + seconds: 5, + parallel: 5, + ops: [{op: "insert", ns: "foo.bar", doc: {field: "value"}}] +}); +jsTestLog({ThrottledRun: result, ThrottedRate: throttledRate}); +let maxAllowedRate = 1.5 * throttledRate; +let minAllowedRate = 0.5 * throttledRate; +assert.gt(result["insert"], minAllowedRate); +assert.lt(result["insert"], maxAllowedRate); + +// Cautiously unset to avoid any interaction with shutdown. +assert.commandWorked( + primary.adminCommand({configureFailPoint: "flowControlTicketOverride", mode: "off"})); + +replTest.stopSet(); +})(); -- cgit v1.2.1