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

Use Future-Promise pair to convey that an IndexCatalogEntry has been dropped/destructed

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
      None
    • Storage Execution

      Query code and background validation both hold pointers to IndexCatalogEntrys outside of locks, via the IndexCatalog::getEntryShared() function.

      This leads to problems when the index is either dropped or the catalog recreated for the restartCatalog cmd (open/closeCatalog), where the IndexCatalogEntry becomes unsafe, for example because it has IndexDescriptors pointing to memory that has been released with the catalog destruction.

      Query currently holds a weak_ptr to the IndexCatalogEntry, and depends upon no other callers to getSharedEntry, which is a very fragile dependency with no safeguards. With background validation, we now we have an isDropped function on the IndexCatalogEntry, along with a catalog generation number saved on the ServiceContext, in order to detect when an IndexCatalogEntry shared_ptr is no longer safe.

      Instead of the difficulties and subtleties above, I suggest a Future-Promise solution, wherein callers can get a Promise that notifies them when the IndexCatalogEntry is destructed for any reason, along with the appropriate error code.

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: