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

Fix PlanCacheClear::clear time of check/time of use bug

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.3
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
    • Fully Compatible
    • ALL
    • Query 2018-09-10, Query 2018-09-24

      PlanCacheClear::clear, two checks happen: one for whether the cache entry exists, and another for whether removing it was successful:

      https://github.com/mongodb/mongo/blob/56a4d894cc679db1ccd2336c490a1c3cd838f0d6/src/mongo/db/commands/plan_cache_commands.cpp#L313-L325

      This strange because the call to contains() and remove() each acquire the plan cache mutex separately, so it's possible for something to happen between the two calls and for the command to return an error without logging a message. While this won't crash the server or do anything really nasty, we should fix it. This would just involve removing the call to contains().

      I do not believe we'd need to add any specific testing for this.

            Assignee:
            yuta.arai@mongodb.com Yuta Arai
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: