Uploaded image for project: 'MongoDB ETL Tools'
  1. MongoDB ETL Tools
  2. TOOLS-1140

tools do not respect readPreference=secondary when connecting to a mongos

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.2.4
    • Fix Version/s: 3.0.13, 3.3.11, 3.2.10
    • Component/s: All Tools
    • Labels:
      None
    • Environment:
      GCP n1-highcpu-16(mongod) , n1-highcpu-2(mongoc,mongod-arbitter,mongos), 3sharded cluster
    • Backport Requested:
      v3.2, v3.0
    • Sprint:
      Server Tools 13 (04/22/16), Platforms 2016-08-26

      Description

      Hi, community.

      When I use mongoexport with --readPreference=secondary, I got bellow error.

      15:33:49 [0] % mongoexport --host mongos-01-b.dummy.com -d dummyDB --port 27017 -c accounts --readPreference=secondary > hoge.json
      2016-04-13T15:34:43.815+0900 Warning: using a non-primary readPreference with a connection to mongos may produce inconsistent duplicates or miss some documents.
      2016-04-13T15:34:46.989+0900 Failed: no reachable servers
      

      When I use mongoexport with --readPreference=secondaryPreferred, All went well.

      15:34:47 [1] % mongoexport --host mongos-01-b.dummy.co -d dummyDB --port 27017 -c accounts --readPreference=secondaryPreferred > hoge.json
      2016-04-13T15:37:35.978+0900 Warning: using a non-primary readPreference with a connection to mongos may produce inconsistent duplicates or miss some documents.
      2016-04-13T15:37:36.018+0900 connected to: mongos-01-b.dummy.co:27017
      2016-04-13T15:37:37.019+0900 [........................] dummyDB.acounts 16000/5700367 (0.3%)
      2016-04-13T15:37:38.019+0900 [........................] dummyDB.acounts 64000/5700367 (1.1%)
      2016-04-13T15:37:39.020+0900 [........................] dummyDB.acounts 96000/5700367 (1.7%)
      

      As far as I read mongo-tool code and mgo.v2 code, mongo-tool only output warning log "Warning: using a non-primary readPreference with a connection -<< omit >> ". And the Error "no reachable servers" is returned in mgo.v2/cluster.go cluster.AcquireSocket().
      why we can't use --readPreference=secondaryPreferred with mongo-tool?

        Attachments

          Activity

            People

            • Assignee:
              gabriel.russell Gabriel Russell
              Reporter:
              loadtest@abema.tv Yoshikazu Umino
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: