Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-688

Java driver concurrency documentation should state that db.requestStart() will not guarantee reading own writes with slaveOk if sharding

    XMLWordPrintableJSON

Details

    Description

      The Java Driver Concurrency documentation documents the use of db.requestStart() and db.requestDone() to try to ensure that you read your own write when slaveOk is set. However, it should indicate that this technique is only effective if you are not sharding, and hence the driver is connecting directly to the mongod instances. When you are sharding, while requests will be processed sequentially by the mongos, there is no guarantee that writes and reads will be directed to the same underlying mongod. Hence you should never use slaveOk in a sharded environment if consistency across requests is important.

      This documentation should also mention that slaveOk is deprecated, and instead (or also) refer to read preferences rather than slaveOk.

      Perhaps some of the other driver documentation has the same issues. I did not check.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jantje.daniel Ian Daniel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: