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

Inserts fails during a replica set failover

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.1
    • Component/s: Cluster Management
    • Labels:
      None
    • Environment:
      db version v1.7.1-pre-, pdfile version 4.5
      git hash: eb74c84814a1f0aceb7cd335e1296d419550ae23
      sys info: Linux domU-12-31-39-06-79-A1 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41

      Problem:
      Three member replica set. I have code that is inserting into a collection, the connection string has been configured with the three members

      MongoOptions mo = new MongoOptions();
      mo.connectionsPerHost = MAX_THREADS + 5;
      mo.autoConnectRetry = true;

      String addresses = args[0];

      while (addresses.contains(","))

      { String next[] = addresses.split(","); connectionList.add(createAddress(next[0])); addresses = next[1]; }

      connectionList.add(createAddress(addresses));

      Mongo mongo = new Mongo( connectionList , mo );

      When I cause the current primary to step down (rs.stepDown()), the Java driver throws the following

      Exception in thread "Thread-1" com.mongodb.MongoException: not talking to master and retries used up
      at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:206)
      at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208)
      at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208)
      at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:223)
      at com.mongodb.DBCollection.findOne(DBCollection.java:486)
      at com.mongodb.DBCollection.findOne(DBCollection.java:475)
      at com.mongodb.DB.command(DB.java:137)
      at com.mongodb.DB.getLastError(DB.java:283)
      at InsertSpeed$RunnerInsert.run(InsertSpeed.java:72)

      Not sure if there is something else that can be set in order to continue the insert process during the take over event.

      Workaround:
      When going through the mongos process (in a sharded + repl set deployment), can the connection is to the mongos process then this exception does not occur.

      Business Case:
      Reliability
      User Expereince

            Assignee:
            antoine Antoine Girbal
            Reporter:
            alvin Alvin Richards (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: