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

Fix data race over the chunk jumbo flag

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 7.3.3, 7.0.12, 8.0.0-rc7, 6.0.17
    • Affects Version/s: 5.0.0, 6.0.0, 7.0.0, 8.1.0-rc0, 8.0.0-rc4
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0, v6.0, v5.0
    • CAR Team 2024-05-27
    • 200

      The RoutingInformationCache keeps in memory a ChunkInfo struct data for every chunk and it's passed as a reference every time a chunk is consulted.

      All the ChunkInfo attributes are const except for the jumbo flag. Therefore, we have a data race since there is no mechanism to serialize its read and writes.

      Here is a point where the jumbo flag is written. And here is a point where the jumbo flag is read.

       

      Dumping some extra clarifications:

      When the jumbo flag is set, we update the config.chunks collection and the RoutingInformationCache at the same time. Usually, the chunk updates are only applied to the config.chunks collection and, later, the RoutingInformationCache detects those changes and refreshes its cache. But, in the case of the jumbo flag, we are not increasing the collection version to avoid having an unnecessary refresh on every shard, therefore, we also have to force the update on the RoutingInformationCache side, otherwise, we wouldn't see the change until the RoutingInformationCache was reset.

            Assignee:
            silvia.surroca@mongodb.com Silvia Surroca
            Reporter:
            silvia.surroca@mongodb.com Silvia Surroca
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: