ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 9.1.0-rc0
    • Component/s: None
    • None
    • Storage Execution
    • ALL
    • Storage Execution 2027-01-04
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Issue

      The following sequence causes replicated fast count to go out of sync with the actual count and fail collection validation:

      1. Start a sharded DSC sharded cluster with a embedded CSRS ("config shard").
      2. Create a sharded collection "coll" with 1 document on the CSRS.
      3. Force a checkpoint and ensure fast count is flushed.
      4. Transition the CSRS from embedded to dedicated.
        • This moves all data out of the CSRS, and drops "coll" from the CSRS.
      5. Transition the CSRS back from dedicated to embedded.
      6. Move the chunk of "coll" back to the CSRS.
      7. Checkpoint the new state without flushing the fast count.
      8. Restart the node.

       

      Once the node start again, the fast count is 2, but the actual number of documents is 1.

      See the attached reproducer.

       

      Bug

      It seems that the issue is that fast count does not correctly handle a collection being dropped and later re-created with the same UUID. In the steps above:

      • In step 4, "coll" gets dropped from the CSRS.
      • In step 6, "coll" gets re-created again with the same UUID in the CSRS.

       

      It seems that while recovering from the kill, fast count computes the new count as:

      • The last flushed fast count (step 3) had 1 document.
      • During steps 4-8, 1 new document was inserted to the collection (step 6).
      • Hence the final count is 1+1 = 2.

      However this misses that during steps 4-8 the collection was dropped & re-created, so the last flushed fast count should be discarded when merging.

       

      Notes

      It seems that this could potentially also reproduce on replica sets with tools like mongodump which can re-create a collection with the same UUID.

        1. repro-SERVER-138505.js
          3 kB
          Joan Bruguera Micó

            Assignee:
            Yuhong Zhang
            Reporter:
            Joan Bruguera Micó
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: