diff --git a/libs/change_streams.js b/libs/change_streams.js index 64003dc..3ae1acd 100644 --- a/libs/change_streams.js +++ b/libs/change_streams.js @@ -388,7 +388,7 @@ function useBinDataResumeToken() { * @param {Boolean} preImageEnabled - Whether recording of the pre-images is enabled. * @return {String} The test base name. */ -function getTestBaseName(nListeners, fullDocumentBeforeChange, fullDocument, selectiveChange, nCollections, docSize, preImageEnabled = false) { +function getTestBaseName(nListeners, fullDocumentBeforeChange, fullDocument, selectiveChange, nCollections, docSize, preImageEnabled = false, legacyPreImagesEnabled = false) { var baseName = `${nListeners}`; if (fullDocumentBeforeChange) { baseName += `_${fullDocumentBeforeChange}fdbc`; @@ -409,6 +409,9 @@ function getTestBaseName(nListeners, fullDocumentBeforeChange, fullDocument, sel if (preImageEnabled) { baseName += "_preImage"; } + if (legacyPreImagesEnabled) { + baseName += "_legacyPreImage"; + } baseName += `_${nCollections}c`; // Previously, change stream tests were only executed with document size of 100 bytes. The newly @@ -460,8 +463,7 @@ function isChangeStreamPreAndPostImagesTimeBasedRetentionPolicyFeatureAvailable( } function testChangeStreamsCRUDWorkload(db, - testName, - { dbName, collNames, docSize, nCollections, nThreads, nListeners, nDocs, retryableWrites, mongosHosts, shardCollections, preImagesEnabled, changeStreamOptions, fullDocumentBeforeChange, fullDocument, selectiveChange, changeHandlerOptions }, + { dbName, collNames, docSize, nCollections, nThreads, nListeners, nDocs, retryableWrites, mongosHosts, shardCollections, preImagesEnabled, legacyPreImagesEnabled, changeStreamOptions, fullDocumentBeforeChange, fullDocument, selectiveChange, changeHandlerOptions }, changeHandler, onStopCallback) { // Set the number of documents to be inserted before running the workload. @@ -482,12 +484,12 @@ function testChangeStreamsCRUDWorkload(db, return; } for (var i = 0; i < collNames.length; i++) { - db.getSiblingDB(dbName).runCommand({collMod: collNames[i], changeStreamPreAndPostImages: {enabled: preImagesEnabled}}); + db.getSiblingDB(dbName).runCommand({collMod: collNames[i], changeStreamPreAndPostImages: {enabled: preImagesEnabled}, recordPreImages: legacyPreImagesEnabled}); } var changeStreamOptions = changeStreamOptions ? changeStreamOptions : {preAndPostImages: {expireAfterSeconds: "off"}}; db.getSiblingDB("admin").runCommand(Object.merge({setChangeStreamOptions: 1}, changeStreamOptions)); - jsTest.log("Change streams CRUD " + testName + ": nThreads=" + nThreads + " nListeners=" + nListeners + " preImagesEnabled=" + preImagesEnabled + " docSize=" + docSize + " nCollections=" + nCollections + " shardCollections=" + shardCollections + " " + new Date()); + jsTest.log("Change streams CRUD " + testName + ": nThreads=" + nThreads + " nListeners=" + nListeners + " preImagesEnabled=" + preImagesEnabled + " legacyPreImagesEnabled=" + legacyPreImagesEnabled + " docSize=" + docSize + " nCollections=" + nCollections + " shardCollections=" + shardCollections + " " + new Date()); var changeStreamOptions = getChangeStreamOptions(fullDocumentBeforeChange, fullDocument); var listeners = startAndWaitForListeners(dbName, collNames, nListeners, changeStreamOptions, @@ -500,5 +502,5 @@ function testChangeStreamsCRUDWorkload(db, print("Finishing the workload"); var throughput = workload.stop(); - onStopCallback(throughput, listeners, getTestBaseName(nListeners, full_document_before_change, full_document, selective_change, nCollections, docSize, pre_images_enabled)); + onStopCallback(throughput, listeners, getTestBaseName(nListeners, full_document_before_change, full_document, selective_change, nCollections, docSize, pre_images_enabled, legacy_pre_images_enabled)); } diff --git a/workloads/change_streams_crud_throughput.js b/workloads/change_streams_crud_throughput.js index 7986c15..0dcdf40 100644 --- a/workloads/change_streams_crud_throughput.js +++ b/workloads/change_streams_crud_throughput.js @@ -39,7 +39,7 @@ load("libs/mixed_workload.js"); * see {@link https://github.com/10gen/dsi/blob/138bbc5a39ca779e5b49d8d9242515329ba9d978/configurations/test_control/test_control.core.yml#L29-L31|this hello world example}. * * Parameters: thread_levels, listener_levels, selective_change, nb_collections, mongos_hosts, shard_collections, - * doc_size, nb_docs, pre_images_enabled, full_document_before_change, full_document, change_stream_options, test_duration_secs. + * doc_size, nb_docs, pre_images_enabled, legacy_pre_images_enabled, full_document_before_change, full_document, change_stream_options, test_duration_secs. */ /** @@ -90,11 +90,17 @@ var doc_sizes = doc_sizes || [100]; var nb_docs = nb_docs || undefined; /** - * Represents the collection option of pre-image recording being enabled for all collections. + * Represents the pre-image recording capability via 'changeStreamPreAndPostImages' collection option being enabled for all collections. * Defaults to false. */ var pre_images_enabled = pre_images_enabled || false; +/** + * Represents the pre-image recording capability via 'recordPreImages' collection option being enabled for all collections. + * Defaults to false. + */ +var legacy_pre_images_enabled = legacy_pre_images_enabled || false; + /** * Possible modes for the 'fullDocumentBeforeChange' parameter of the $changeStream stage. * Defaults to undefined. @@ -186,6 +192,7 @@ var test_duration_secs = test_duration_secs || 5*60; mongosHosts: mongosHosts, shardCollections: shard_collections, preImagesEnabled: pre_images_enabled, + legacyPreImagesEnabled: legacy_pre_images_enabled, changeStreamOptions: change_stream_options, fullDocumentBeforeChange: full_document_before_change, fullDocument: full_document, diff --git a/workloads/change_streams_latency.js b/workloads/change_streams_latency.js index b2c7f9e..48c7afa 100644 --- a/workloads/change_streams_latency.js +++ b/workloads/change_streams_latency.js @@ -40,7 +40,7 @@ load("libs/mixed_workload.js"); * see {@link https://github.com/10gen/dsi/blob/138bbc5a39ca779e5b49d8d9242515329ba9d978/configurations/test_control/test_control.core.yml#L29-L31|this hello world example}. * * Parameters: thread_levels, listener_levels, selective_change, nb_collections, mongos_hosts, shard_collections, - * nb_docs, doc_size, pre_images_enabled, full_document_before_change, full_document, change_stream_options, test_duration_secs. + * nb_docs, doc_size, pre_images_enabled, legacy_pre_images_enabled, full_document_before_change, full_document, change_stream_options, test_duration_secs. */ /** @@ -91,11 +91,17 @@ var doc_sizes = doc_sizes || [100]; var nb_docs = nb_docs || undefined; /** - * Represents the collection option of pre-image recording being enabled for all collections. + * Represents the pre-image recording capability via 'changeStreamPreAndPostImages' collection option being enabled for all collections. * Defaults to false. */ var pre_images_enabled = pre_images_enabled || false; +/** + * Represents the pre-image recording capability via 'recordPreImages' collection option being enabled for all collections. + * Defaults to false. + */ +var legacy_pre_images_enabled = legacy_pre_images_enabled || false; + /** * Possible modes for the 'fullDocumentBeforeChange' parameter of the $changeStream stage. * Defaults to undefined. @@ -220,6 +226,7 @@ var test_duration_secs = test_duration_secs || 5*60; mongosHosts: mongosHosts, shardCollections: shard_collections, preImagesEnabled: pre_images_enabled, + legacyPreImagesEnabled: legacy_pre_images_enabled, changeStreamOptions: change_stream_options, fullDocumentBeforeChange: full_document_before_change, fullDocument: full_document,