模块:Mongo::Error::ReadWriteRetryable
- 定义于:
- lib/ Mongo/error/read_write_retryable.rb
Overview
注意:
尽管该模块的方法是公共 API 的一部分,但这些方法是在此模块上定义的,而不是在包含该模块的类上定义的,因此,公共 API 不属于该模块的一部分。
一个模块,封装了指示错误是否可重试的功能。
常量摘要折叠
- WRITE_RETRY_ERRORS =
此常量是私有 API 的一部分。 应尽可能避免使用此常量,因为它将来可能会被删除或更改。
会导致重试写入失败的错误代码和代码名称。
[ { code_name: 'HostUnreachable', 代码: 6 }, { code_name: ' HostNotFound ', 代码: 7 }, { code_name: ' NetworkTimeout ', 代码: 89 }, { code_name: ' ShutdownInProgress ', 代码: 91 }, { code_name: ' PrimarySteppedDown ', 代码: 189 }, { code_name: 'ExceededTimeLimit', 代码: 262 }, { code_name: ' SocketException ', 代码: 9001 }, { code_name: ' NotMaster ', 代码: 10 _ 107 }, { code_name: ' InterruptedAtShutdown ', 代码: 11 _ 600 }, { code_name: ' InterruptedDueToReplStateChange ', 代码: 11 _ 602 }, { code_name: ' NotPrimaryNoSecondaryOk ', 代码: 13 _ 435 }, { code_name: ' NotMasterOrSecondary ', 代码: 13 _ 436 }, ].冻结
- WRITE_RETRY_MESSAGES =
此常量是私有 API 的一部分。 应尽可能避免使用此常量,因为它将来可能会被删除或更改。
这些是神奇的错误消息,可能表明主节点发生变更。
[ ' not master ', ' node is Recovery ', ].冻结
- RETRY_MESSAGES =
此常量是私有 API 的一部分。 应尽可能避免使用此常量,因为它将来可能会被删除或更改。
这些是神奇的错误消息,可能表明mongos背后的集群重新配置。
WRITE_RETRY_MESSAGES + [ ' transport error ', ' socket 异常', " can't connect ", ' connect failed ', ' error querying ', ' could not get last error ', '连接尝试失败', ' Interrupted at shutdown ', ' unknown replica set ', “ dbclient 与服务器通信时出错” ].冻结
实例方法摘要折叠
- #可重试? ⇒ true, false 已弃用 已弃用。
-
# write_retryable? ⇒ true, false
根据现代可重试读取和可重试写入规范,该错误是否为可重试错误。
实例方法详细信息
#可重试? ⇒ true , false
已弃用。
根据传统读取重试逻辑,该错误是否为可重试错误。
78 79 80 81 |
# File 'lib/ Mongo/error/read_write_retryable.rb', line 78 def 可重试? write_retryable? || (代码.nil? && RETRY_MESSAGES.任何? { |m| .包括?(m) }) end |
# write_retryable? ⇒ true , false
根据现代可重试读取和可重试写入规范,该错误是否为可重试错误。
传统可重试写入逻辑也使用此方法来确定错误是否为可重试错误。
90 91 92 93 |
# File 'lib/ Mongo/error/read_write_retryable.rb', line 90 def write_retryable? write_retryable_code? || (代码.nil? && WRITE_RETRY_MESSAGES.任何? { |m| .包括?(m) }) end |