multi shard have the same shard key

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Gone away
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.4.4
    • Component/s: None
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      I have a mongodb server with four shards.
      first, I create a collection 'PERSON', then I specify a shard key '_id' by following code:

       MongoDatabase adminDB = client.getDatabase("admin");
        try {
            adminDB.runCommand(new Document("enablesharding", "myDB"));
        }catch(Exception e) {
            System.out.println(e.getMessage());
        }
        MongoDatabase db = client.getDatabase("myDB");
        db.createCollection("PERSON");
        adminDB.runCommand(new Document().append("shardCollection","myDB.PERSON").append("key",new Document().append("_id","hashed")));
      

      finally , I saved some data to the collection. but when I try to query person info with some conditions, I got two records with total same values include ids. I logged into each shard and checked my record. I found the record with same id appeared in both shard0 and shard3.

      btw:
      My data is saved to mongodb through spark conector( artifactId: mongo-spark-connector_2.11, version: 2.1.0) using data set api.

        1. same id in diffient shard.jpeg
          same id in diffient shard.jpeg
          243 kB
        2. person-failed.log.zip
          3.40 MB

            Assignee:
            Mark Agarunov (Inactive)
            Reporter:
            JavenZhang
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: