diff options
author | David Storch <david.storch@10gen.com> | 2018-12-07 17:12:07 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2018-12-10 10:52:38 -0500 |
commit | 35efc48897270a83097008f9343ae8c56a9e77cc (patch) | |
tree | 406883d218e510433424f8d3bff29e0ab28d97f3 /src/mongo/db/exec/cached_plan.h | |
parent | 7b1e64f12e855d979232ef7b185002d5c8103353 (diff) | |
download | mongo-35efc48897270a83097008f9343ae8c56a9e77cc.tar.gz |
SERVER-37449 Add RequiresAllIndicesStage and use for subplanning and multiplanning.
These stages hold the collection's list of indices during
plan selection, and expect all indices in this list to
remain valid until plan selection completes.
Diffstat (limited to 'src/mongo/db/exec/cached_plan.h')
-rw-r--r-- | src/mongo/db/exec/cached_plan.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mongo/db/exec/cached_plan.h b/src/mongo/db/exec/cached_plan.h index d1c6fcaaf8f..2ea991517cd 100644 --- a/src/mongo/db/exec/cached_plan.h +++ b/src/mongo/db/exec/cached_plan.h @@ -33,7 +33,7 @@ #include <memory> #include <queue> -#include "mongo/db/exec/requires_collection_stage.h" +#include "mongo/db/exec/requires_all_indices_stage.h" #include "mongo/db/exec/working_set.h" #include "mongo/db/jsobj.h" #include "mongo/db/query/canonical_query.h" @@ -46,13 +46,16 @@ namespace mongo { class PlanYieldPolicy; /** - * This stage outputs its mainChild, and possibly its backup child - * and also updates the cache. - * - * Preconditions: Valid RecordId. + * Runs a trial period in order to evaluate the cost of a cached plan. If the cost is unexpectedly + * high, the plan cache entry is deactivated and we use multi-planning to select an entirely new + * winning plan. This process is called "replanning". * + * This stage requires all indices to stay intact during the trial period so that replanning can + * occur with the set of indices in 'params'. As a future improvement, we could instead refresh the + * list of indices in 'params' prior to replanning, and thus avoid inheriting from + * RequiresAllIndicesStage. */ -class CachedPlanStage final : public RequiresCollectionStage { +class CachedPlanStage final : public RequiresAllIndicesStage { public: CachedPlanStage(OperationContext* opCtx, Collection* collection, @@ -86,11 +89,6 @@ public: */ Status pickBestPlan(PlanYieldPolicy* yieldPolicy); -protected: - void doSaveStateRequiresCollection() final {} - - void doRestoreStateRequiresCollection() final {} - private: /** * Passes stats from the trial period run of the cached plan to the plan cache. |