Methods
doRsync(syncSource, syncTarget, port, dbPath) → {Date}
Copies data directory from syncSource to syncTarget via rsync.
Parameters:
Name | Type | Description |
---|---|---|
syncSource |
String | Host from which date has to copied. |
syncTarget |
String | Host that has to be synced. |
port |
Number | Port on which mongod instance runs. |
dbPath |
String | Mongod data directory path. |
Returns:
Post rsync start time.
- Type
- Date
ElectionTimingTest()
ElectionTimingTest - set up a ReplSetTest and use default or provided functions to trigger an election. The time it takes to discover a new primary is recorded.
- Source:
generateCollectionNames(baseName, nCollections) → {Array}
Generates and returns a list of collection names.
Parameters:
Name | Type | Description |
---|---|---|
baseName |
String | The collections base name. |
nCollections |
Number | The number of collection names to generate. |
- Source:
Returns:
An array of collection names.
- Type
- Array
getChangeStreamOptions(fullDocumentBeforeChange, fullDocument)
Returns the change stream options object for the specified configuration.
Parameters:
Name | Type | Description |
---|---|---|
fullDocumentBeforeChange |
String | The 'fullDocumentBeforeChange' parameter of the $changeStream stage. |
fullDocument |
String | The 'fullDocument' parameter of the $changeStream stage. |
- Source:
getDbPathBkp()
Returns the temporary data path used during rsync.
getFilterPipeline(selectiveChange) → {Array}
Gets the filter pipeline that should follow the '$changeStream' aggregation stage.
Parameters:
Name | Type | Description |
---|---|---|
selectiveChange |
bool | The value of the 'selective_change' option for the test. |
- Source:
Returns:
The filter pipeline to add to the change stream pipeline.
- Type
- Array
getMongosHosts()
Transforms a mongos host list as found infrastructure.out.yml into a list of host strings that can be used to create a new Mongo connection.
- Source:
getTestBaseName(nListeners, fullDocumentBeforeChange, fullDocument, selectiveChange, nCollections, docSize, preImageEnabled, readPreferenceMode) → {String}
Gets the base name for a test given its configuration options.
Parameters:
Name | Type | Description |
---|---|---|
nListeners |
Number | The number of change stream listeners. |
fullDocumentBeforeChange |
String | The "fullDocumentBeforeChange" change stream option. |
fullDocument |
String | The "fullDocument" change stream option. |
selectiveChange |
Boolean | Whether the 'selective_change' option is set. |
nCollections |
Number | The number of collections used by the test. |
docSize |
Number | The size of the documents inserted into the collection. |
preImageEnabled |
Boolean | Whether recording of the pre-images is enabled. |
readPreferenceMode |
String | The read preference of the change stream aggregation pipeline. |
- Source:
Returns:
The test base name.
- Type
- String
isClusterWideConfigFeatureAvailable()
Returns true if the FCV is 6.1 or above (when the feature flag is removed) or if feature flag 'featureFlagClusterWideConfig' is enabled with FCV 6.0, false otherwise.
- Source:
startAndWaitForListeners(dbName, collNames, nListeners, changeStreamOptions, selectiveChange) → {Object}
Starts and waits for the change stream listeners to be ready.
Parameters:
Name | Type | Description |
---|---|---|
dbName |
String | The database name. |
collNames |
Array | An array of collection names on which to listen for change streams. |
nListeners |
Number | The number of change streams listeners to start. Should be a multiple of the number of collections. |
changeStreamOptions |
Object | Options for the '$changeStream' stage. |
selectiveChange |
Boolean | Whether additional aggregation stages should be added after the '$changeStream' stage. |
- Source:
Returns:
A dictionary mapping collection names to arrays of corresponding listeners.
- Type
- Object
startListeners(nbListeners, dbName, collName, filterPipeline, changeStreamOptions, changeHandler, changeHandlerOptions, mongoHosts, readPreferenceMode) → {Array}
Starts change stream listeners.
Parameters:
Name | Type | Description |
---|---|---|
nbListeners |
Number | The number of change stream listeners to start. |
dbName |
String | The database name. |
collName |
String | The collection name. |
filterPipeline |
Array | The aggregation pipeline stages to append to the '$changeStream' stage. |
changeStreamOptions |
Object | The options to pass to the '$changeStream' stage. |
changeHandler |
function | A callback function that takes a change document and a state object as parameters. The function will be called for each change document read. |
changeHandlerOptions |
Object | An object that will be passed as argument to the changeHandler callback function. Defaults to an empty object. |
mongoHosts |
Array | An array of mongos hosts to connect to. The listeners are assigned to each host sequentially (round robin). Optional. |
readPreferenceMode |
String | The read preference of the change stream aggregation pipeline. |
- Source:
Returns:
The created listeners.
- Type
- Array
stopListeners(listeners) → {Array}
Stops the change stream listeners.
Parameters:
Name | Type | Description |
---|---|---|
listeners |
Array | An array of ChangeStreamListenerThread objects. |
- Source:
Returns:
An array containing the final state values for all the listeners.
- Type
- Array
useBinDataResumeToken()
Indicates if the servers use a resume token with the BinData format. This format is used before 3.7.4 and also when featureCompatibilityVersion is 3.6 (change streams are only supported since 3.6).
- Source:
waitForListeners(listeners)
Waits for the listeners to be ready.
Parameters:
Name | Type | Description |
---|---|---|
listeners |
Array | The listeners as an array of ChangeStreamListenerThreads. |
- Source: