Java Driver
  1. Java Driver
  2. JAVA-275

with default write concern (no getLastError), if master changes in repl set, small edge case where writes will fail undetected

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major - P3 Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: None
    • Labels:
      None
    • Operating System:
      ALL
    • # Replies:
      5
    • Last comment by Customer:
      true

      Description

      In case or reads, we always get an answer back from db and if it's an error saying "not master", we do a force check master.
      But for writes, with default setting, client never gets an answer back and the error goes unnoticed.
      A clean fix would be to have updater thread do a forced checkmaster.
      This way the max we lose is 5s worth of docs.. which is ok for w=0.

        Issue Links

          Activity

          Hide
          Antoine Girbal
          added a comment -

          this may not have been picked up earlier since as soon as you do a read() it will get error and force checkMaster.
          Though if you have slaveOk=true, then no error.

          Show
          Antoine Girbal
          added a comment - this may not have been picked up earlier since as soon as you do a read() it will get error and force checkMaster. Though if you have slaveOk=true, then no error.
          Hide
          auto
          added a comment -

          Author:

          {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

          Message: JAVA-275: with default write concern (no getLastError), if master changes in repl set, writes will fail undetected forever
          https://github.com/mongodb/mongo-java-driver/commit/7841cdf95495c89fc77d513cbba7865a14967474

          Show
          auto
          added a comment - Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'} Message: JAVA-275 : with default write concern (no getLastError), if master changes in repl set, writes will fail undetected forever https://github.com/mongodb/mongo-java-driver/commit/7841cdf95495c89fc77d513cbba7865a14967474
          Hide
          auto
          added a comment -

          Author:

          {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

          Message: JAVA-275: fix to implementation, was looping in case driver is started with no master available
          https://github.com/mongodb/mongo-java-driver/commit/dcfe3bd1ed0e95cec1ccb62d62a0270149d8f6ea

          Show
          auto
          added a comment - Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'} Message: JAVA-275 : fix to implementation, was looping in case driver is started with no master available https://github.com/mongodb/mongo-java-driver/commit/dcfe3bd1ed0e95cec1ccb62d62a0270149d8f6ea
          Hide
          Dwight Merriman
          added a comment -

          the mongod server drops its priamry state, it will force a close of all sockets for this very reason.

          because of that, doesn't require special handling.

          Show
          Dwight Merriman
          added a comment - the mongod server drops its priamry state, it will force a close of all sockets for this very reason. because of that, doesn't require special handling.
          Hide
          Antoine Girbal
          added a comment -

          so only the former primary will drop all its connections?
          I think it's still good to have the updater thread update the master when it runs isMaster on servers, it doesnt cost anything.
          There is a very small edge case:

          • writes go to server1, there is no connection to server2
          • server1 steps down, and bounces all connections. New master is server2
          • driver does 1 write to server1 which gets ioexception, picks up server2 as master (through the updater's own port, not the general pool)
          • before more writes go out the master changes again to master3.
          • driver will use master2 for further writes but not get ioexceptions.
            That is if there is no read or slaveOk=true.
            Changing ticket title since it's not that bad..
          Show
          Antoine Girbal
          added a comment - so only the former primary will drop all its connections? I think it's still good to have the updater thread update the master when it runs isMaster on servers, it doesnt cost anything. There is a very small edge case: writes go to server1, there is no connection to server2 server1 steps down, and bounces all connections. New master is server2 driver does 1 write to server1 which gets ioexception, picks up server2 as master (through the updater's own port, not the general pool) before more writes go out the master changes again to master3. driver will use master2 for further writes but not get ioexceptions. That is if there is no read or slaveOk=true. Changing ticket title since it's not that bad..

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                3 years, 8 weeks, 5 days ago
                Date of 1st Reply: