Destroy `PinnedConnectionTaskExecutor` before shutting down the underlying executor

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • ALL
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Destroying any instance of PinnedConnectionTaskExecutor ensures it will drain all scheduled work from the parent executor:

      PinnedConnectionTaskExecutor::~PinnedConnectionTaskExecutor() {
          shutdown();
          join();
      }
      

      The existing shutdown order, which calls into the following, does not guarantee this requirement for using PinnedConnectionTaskExecutor and allows instances of PinnedConnectionTaskExecutor to continue processing work while the underlying executor is shutdown.

      void shutdownSearchExecutorsIfNeeded(ServiceContext* svc) {
          auto& state = getExecutorHolder(svc);
          if (!globalMongotParams.host.empty()) {
              ...
              state.mongotExecutor->shutdown();
              state.mongotExecutor->join();
              state.mongotExecutor.reset();
          }
          ...
      }
      

      We should make sure all instances of PinnedConnectionTaskExecutor, which are created by calling into makeTaskExecutorCursor with the pinning option, are destroyed before the shutdown code for search runs (the above function).

              Assignee:
              Mariano Shaar
              Reporter:
              Amirsaman Memaripour
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: