RoutingTableHistory::makeUpdated should skip copying chunkMap if it will result in no diffs

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • Sharding 2020-08-10
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      RoutingTableHistory currently copies the chunkMap unconditionally:

      https://github.com/mongodb/mongo/blob/r4.4.0-rc12/src/mongo/s/chunk_manager.cpp#L600

      And throws it away if it results in no diff:

      https://github.com/mongodb/mongo/blob/r4.4.0-rc12/src/mongo/s/chunk_manager.cpp#L665

      In special cases when the size of the changedChunks is 1, we can simply inspect the chunk and compare it to the chunk in the map and skip the copying all together when they are the same. This would save memory and computation in collections with millions of chunks.

            Assignee:
            Allison Easton
            Reporter:
            Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: