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

Fix dataSize can be negative and incorrect on rollback

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0, 6.0.5, 6.0.6, 5.0.22, 4.4.26
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v6.3, v6.0, v5.0, v4.4
    • Execution Team 2022-11-14
    • 4

      if (_sizeInfo->dataSize.fetchAndAdd(amount) < 0)
      _sizeInfo->dataSize.store(std::max(amount, int64_t(0))); 

      Value is checked before adding, and clamping is done only if the previous value was negative, so the value can still be negative.

      Additionally, similar to SERVER-63585 with fast count, data size can be incorrect after a rollback due to a race. We should allow dataSize to be negative internally and clamp only in the getter.

            Assignee:
            yujin.kang@mongodb.com Yujin Kang Park
            Reporter:
            yujin.kang@mongodb.com Yujin Kang Park
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: