Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-14132

Warn during initial sync if _id index missing on any cloned collection

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • Replication
    • Quint Iteration 7, QuInt 8 08/28/15, Quint 9 09/18/15, QuInt A (10/12/15)

    Description

      The server logs a warning at startup if any collection is missing an _id index. A startup warning should also be generated at time of initial sync for any cloned collection that does not have this index.

      Correctness of replication is not guaranteed for any collection that is missing this index. To illustrate a simple example: the following script inserts two documents into a replicated collection without an _id index, and shows that the secondary's copy of the collection ends up with only one document.

      var rst = new ReplSetTest({nodes: 2});
      rst.startSet();
      rst.initiate();
      var primary = rst.getPrimary();
      primary.getCollection("test.foo").runCommand("create", {autoIndexId: false});
      primary.getCollection("test.foo").insert({_id: 0, a: 1});
      primary.getCollection("test.foo").insert({_id: 0, a: 2});
      rst.awaitReplication();
      var secondary = rst.getSecondary();
      assert.eq(primary.getCollection("test.foo").count(), secondary.getCollection("test.foo").count());
      // Line 10 throws "assert: [2] != [1] are not equal : undefined"
      

      Attachments

        Activity

          People

            backlog-server-repl Backlog - Replication Team
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: