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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Sprint:
      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

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: