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

Prevent concurrent direct writes from unsetting kPendingDirectWrite flag

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0, 6.3.0-rc1
    • Affects Version/s: 6.3.0-rc0
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v6.3
    • Execution Team 2023-02-20, Execution Team 2023-02-06

      If two direct writes to a single time series bucket race with each other, we could end up releasing the bucket for inserts earlier than expected, and corrupt the bucket contents.

      Consider the following sequence:

      | Update1               | Update2                         | Insert1                         | Insert2                           |
      |-----------------------|---------------------------------|---------------------------------|-----------------------------------|
      | Write to storage      |                                 |                                 |                                   |
      | Set kDirectWriteStart |                                 |                                 |                                   |
      |                       | Write to storage                |                                 |                                   |
      |                       | Set kDirectWriteStart           |                                 |                                   |
      |                       | Abort + unset kDirectWriteStart |                                 |                                   |
      |                       |                                 | Reopen/fetch the bucket into BC |                                   |
      |                       |                                 | ...                             | Insert into the same bucket in BC |
      |                       |                                 |                                 |                                   |
      | Commit                |                                 |                                 |                                   |
      |                       |                                 |                                 | Read doc updated by Update1       |
      |                       |                                 |                                 | Write the stale diff              |             

            Assignee:
            fausto.leyva@mongodb.com Fausto Leyva (Inactive)
            Reporter:
            dan.larkin-york@mongodb.com Dan Larkin-York
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: