我知道 Mongo Java 驱动程序会重试 collection.find()
,以及大多数其他读取操作,根据 Mongo docs .
但我在文档或 driver source 中看不到任何地方- 会重试DBCursor.next()
或 DBCursor.hasNext()
?
最佳答案
不,它不会重试基于游标的读取。
Cursor.getMore() cannot be retried because of the inability for the client to discern if the cursor was advanced. In other words, since the driver does not know if the original getMore() succeeded or not, the driver cannot reliably know if results might be inadvertently skipped.
更多细节在这里 - https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.rst#implementing-retryable-reads
关于java - MongoDB Java 驱动程序 4.0+ 会重试 DBCursor.next() 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65257536/