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

auto retry during failover

    XMLWordPrintableJSON

Details

    Description

      When the driver is configured to work with a replica set, it still favors a single node in the replica set. If that node becomes unavailable, the next request will invalidate the connection and return failure. A subsequent request will attempt to reconnect to the replica set, thereby establishing a connection to a different node, and therefore succeed. Thus, in a failover scenario, one (or maybe more) requests are lost.

      How we deal with this at the AKC is to use a "retry" aspect; it advises every interaction with MongoDB, and if the interaction returns an UncategorizedMongoException or DataAccessResourceFailureException, it resubmits the request one time. That way, in a failover, we give ourselves the chance to have zero lost requests.

      While we have a code solution for this, I'd like it if this were supported by the official distribution. I've included our aspect for reference.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dpb@akc.org Dan Bularzik
              Votes:
              12 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: