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

inconsistent behaviour between java drivers before and after version 2.7.3

      We've found an iconsistent behaviour between java drivers before and after version 2.7.3 on a replica set (mongo version 2.2.3 - but doesn't matter for this issue).
      Before (incl.) v2.7.3 we could read from collection A and write into collection B within the same request even if ReadPreference.SECONDARY was set on the database.

      After v2.7.3 a MongoException is thrown: "not talking to master and retries used up".
      Our solution is either to set ReadPreference.PRIMARY (either on the database or on the find method) or to close the request and to open a new one for the write request.

      It would be nice if the connection wouldn't be tied to a mongo node dependant on the first request, because it's very hard to find the cause of the above mentioned error (imagine a much more complex business logic, which we have nailed down to one well isolated test case). It would be smarter when Mongo could automatically decide to connect to the master when a write request comes in even when ReadPreference.SECONDARY is set and return to a secondary for further read requests.

      Please see attached our test class to reproduce the issue.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kay.agahd@idealo.de Kay Agahd
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: