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

Fixing invariants on ShardServerCatalogCacheLoader to consider different terms

    • Fully Compatible
    • ALL
    • v5.0, v4.4, v4.2, v4.0
    • Sharding EMEA 2021-05-31

      These two invariants of the ShardServerCatalogCacheLoader verify that the ChunkVersions of the last task is contiguous to the ChunkVersions of the new task. However these invariants are incomplete: they do not properly cover scenarios in which there are stepdowns/stepups.

      Note that when a new node is elected as primary it bumps its term. This is important because it changes how the minQueryVersion is computed: instead of looking at the in-memory list of tasks associated with the previous term (i.e., last time this node was primary) we end up taking as minQueryVersion whatever version is persisted on config.cache.chunks. However, when we add this new task to the list, the implementation does not consider the terms and ends up comparing versions that are not contiguous: the maxQueryVersion of the last task is different than the minQueryVersion of the new task.

      The proposed solution is to avoid comparing tasks of different terms.

            antonio.fuschetto@mongodb.com Antonio Fuschetto
            antonio.fuschetto@mongodb.com Antonio Fuschetto
            0 Vote for this issue
            5 Start watching this issue