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

XMLWordPrintableJSON

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

      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
            Reporter:
            Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: