Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-293

Retrying bad connections

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.7.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible

      We've seen the master be unable to contact the secondary nodes, so it steps down (and a new master is elected). When this happens, the driver's existing connection suddenly becomes "not master", and throws an error on the next read/write. We'd like the mongo driver to handle (catch error and retry) this instead of bubbling it up to the application level (and having to patch every application.

      Our current approach is to actually wrap the methods on Collection/Cursor. We originally tried to handle this on the Connection object directly, but this lead to an unmaintainable fork. If you were to add this directly to the driver, it might be a fine way to approach the problem. We tried to wrap the methods on Collection/Cursor per Kyle Banker's suggestion. Here is the code we are using. https://gist.github.com/d5ea38c973abdaddeeb0

      This kind of thing should be turned off by default, but could be configured if the user of the driver wanted this sort of behavior.

            Assignee:
            tyler@10gen.com Tyler Brock
            Reporter:
            iamjwc Justin Camerer
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: