OPTIONS
翻译或纠错本页面

configureFailPoint

Definition

configureFailPoint

Configures a failure point that you can turn on and off while MongoDB runs. configureFailPoint is an internal command for testing purposes that takes the following form:

{configureFailPoint: "<failure_point>", mode: <behavior> }

You must issue configureFailPoint against the admin database. configureFailPoint has the following fields:

Field Type Description
configureFailPoint string The name of the failure point.
mode document or string Controls the behavior of a failure point. The possible values are alwaysOn, off, or a document in the form of {times: n} that specifies the number of times the failure point remains on before it deactivates. The maximum value for the number is a 32-bit signed integer.
data document Optional. Passes in additional data for use in configuring the fail point. For example, to imitate a slow connection pass in a document that contains a delay time.

注解

configureFailPoint is an internal command that is not enabled by default. configureFailPoint must be enabled by using --setParameter enableTestCommands=1 on the mongod command line. configureFailPoint cannot be enabled during run-time.

Example

db.adminCommand( { configureFailPoint: "blocking_thread", mode: {times: 21} } )