summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIrina Yatsenko <irina.yatsenko@mongodb.com>2022-04-18 17:56:11 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-19 01:27:39 +0000
commit496a3233aae099c2aa95f739e3c0b03c9cd8c504 (patch)
tree16245b6e728469ed20251caf75f978919924dcb7
parent69796a5d7a9e10dbb5def8ec3e7248d39e6ca79a (diff)
downloadmongo-496a3233aae099c2aa95f739e3c0b03c9cd8c504.tar.gz
SERVER-65686 split sbe_query_stages lib out of sbe_query
(cherry picked from commit 5689f05f30f299560fad5e9eacadc19c54947c91)
-rw-r--r--src/mongo/db/exec/sbe/SConscript46
-rw-r--r--src/mongo/db/exec/sbe/stages/ix_scan.cpp4
-rw-r--r--src/mongo/db/exec/sbe/stages/ix_scan.h6
-rw-r--r--src/mongo/db/exec/sbe/stages/stage_visitors.h4
-rw-r--r--src/mongo/db/query/SConscript1
5 files changed, 40 insertions, 21 deletions
diff --git a/src/mongo/db/exec/sbe/SConscript b/src/mongo/db/exec/sbe/SConscript
index 755497e7b9c..21bcb0f1a53 100644
--- a/src/mongo/db/exec/sbe/SConscript
+++ b/src/mongo/db/exec/sbe/SConscript
@@ -39,6 +39,32 @@ sbeEnv.Library(
source=[
'expressions/expression.cpp',
'size_estimator.cpp',
+ 'util/debug_print.cpp',
+ 'util/spilling.cpp',
+ 'util/stage_results_printer.cpp',
+ 'values/sbe_pattern_value_cmp.cpp',
+ 'values/slot.cpp',
+ 'values/slot_printer.cpp',
+ 'vm/arith.cpp',
+ 'vm/datetime.cpp',
+ 'vm/vm.cpp',
+ ],
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/mongohasher',
+ '$BUILD_DIR/mongo/db/storage/record_store_base',
+ '$BUILD_DIR/third_party/shim_snappy',
+ 'query_sbe_values',
+ ],
+ LIBDEPS_PRIVATE=[
+ '$BUILD_DIR/mongo/db/bson/dotted_path_support',
+ '$BUILD_DIR/mongo/db/sorter/sorter_idl',
+ ]
+ )
+
+sbeEnv.Library(
+ target='query_sbe_stages',
+ source=[
'stages/branch.cpp',
'stages/bson_scan.cpp',
'stages/check_bounds.cpp',
@@ -59,15 +85,6 @@ sbeEnv.Library(
'stages/union.cpp',
'stages/unique.cpp',
'stages/unwind.cpp',
- 'util/debug_print.cpp',
- 'util/spilling.cpp',
- 'util/stage_results_printer.cpp',
- 'values/sbe_pattern_value_cmp.cpp',
- 'values/slot.cpp',
- 'values/slot_printer.cpp',
- 'vm/arith.cpp',
- 'vm/datetime.cpp',
- 'vm/vm.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
@@ -75,14 +92,12 @@ sbeEnv.Library(
'$BUILD_DIR/mongo/db/concurrency/write_conflict_exception',
'$BUILD_DIR/mongo/db/exec/js_function',
'$BUILD_DIR/mongo/db/exec/scoped_timer',
- '$BUILD_DIR/mongo/db/mongohasher',
'$BUILD_DIR/mongo/db/query/plan_yield_policy',
'$BUILD_DIR/mongo/db/query/query_index_bounds',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/db/stats/resource_consumption_metrics',
'$BUILD_DIR/mongo/db/storage/encryption_hooks',
'$BUILD_DIR/mongo/db/storage/index_entry_comparison',
- '$BUILD_DIR/mongo/db/storage/record_store_base',
'$BUILD_DIR/mongo/util/concurrency/thread_pool',
'$BUILD_DIR/third_party/shim_snappy',
'query_sbe_plan_stats',
@@ -91,6 +106,8 @@ sbeEnv.Library(
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/bson/dotted_path_support',
'$BUILD_DIR/mongo/db/sorter/sorter_idl',
+ 'query_sbe',
+ 'query_sbe_storage',
]
)
@@ -118,7 +135,8 @@ env.Library(
LIBDEPS=[
'query_sbe',
'query_sbe_abt',
- 'query_sbe_storage'
+ 'query_sbe_stages',
+ 'query_sbe_storage',
]
)
@@ -130,7 +148,8 @@ env.Library(
LIBDEPS=[
'$BUILD_DIR/mongo/db/query/optimizer/optimizer',
'query_sbe',
- 'query_sbe_storage'
+ 'query_sbe_stages',
+ 'query_sbe_storage',
]
)
@@ -143,6 +162,7 @@ env.Library(
'$BUILD_DIR/mongo/db/query/sbe_stage_builder_helpers',
'$BUILD_DIR/mongo/unittest/unittest',
'query_sbe',
+ 'query_sbe_stages',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/auth/authmocks',
diff --git a/src/mongo/db/exec/sbe/stages/ix_scan.cpp b/src/mongo/db/exec/sbe/stages/ix_scan.cpp
index 5fdfafd2c05..f16f2f6ee67 100644
--- a/src/mongo/db/exec/sbe/stages/ix_scan.cpp
+++ b/src/mongo/db/exec/sbe/stages/ix_scan.cpp
@@ -509,4 +509,8 @@ size_t IndexScanStage::estimateCompileTimeSize() const {
return size;
}
+std::string IndexScanStage::getIndexName() const {
+ return _indexName;
+}
+
} // namespace mongo::sbe
diff --git a/src/mongo/db/exec/sbe/stages/ix_scan.h b/src/mongo/db/exec/sbe/stages/ix_scan.h
index 7e6c84ba14a..ce00ef17128 100644
--- a/src/mongo/db/exec/sbe/stages/ix_scan.h
+++ b/src/mongo/db/exec/sbe/stages/ix_scan.h
@@ -97,11 +97,7 @@ public:
const SpecificStats* getSpecificStats() const final;
std::vector<DebugPrinter::Block> debugPrint() const final;
size_t estimateCompileTimeSize() const final;
- std::string getIndexName() const {
- // Note: the implementation of this getter cannot be moved to 'ix_scan.cpp', as it'd create
- // a circular dependency after fixing the compilation scripts.
- return _indexName;
- }
+ std::string getIndexName() const;
protected:
void doSaveState(bool relinquishCursor) override;
diff --git a/src/mongo/db/exec/sbe/stages/stage_visitors.h b/src/mongo/db/exec/sbe/stages/stage_visitors.h
index 405567e1054..942dfcedd44 100644
--- a/src/mongo/db/exec/sbe/stages/stage_visitors.h
+++ b/src/mongo/db/exec/sbe/stages/stage_visitors.h
@@ -73,9 +73,7 @@ protected:
} else if (stats->stageType == "scan"_sd) {
collectionScans += stats->opens;
} else if (stats->stageType == "ixseek"_sd || stats->stageType == "ixscan"_sd) {
- // It's not possible to use a 'dynamic_cast' here, as 'IndexScanStage' is defined inside
- // a separate compilation unit and it's type information is not available at this point.
- auto indexScanStage = static_cast<const IndexScanStage*>(root);
+ auto indexScanStage = dynamic_cast<const IndexScanStage*>(root);
uassert(6267647,
str::stream() << stats->stageType
<< " stage is not an instance of IndexScanStage",
diff --git a/src/mongo/db/query/SConscript b/src/mongo/db/query/SConscript
index 1612821f26a..efd548fdad2 100644
--- a/src/mongo/db/query/SConscript
+++ b/src/mongo/db/query/SConscript
@@ -111,6 +111,7 @@ env.Library(
LIBDEPS=[
"$BUILD_DIR/mongo/base",
'$BUILD_DIR/mongo/db/exec/sbe/query_sbe',
+ '$BUILD_DIR/mongo/db/exec/sbe/query_sbe_stages',
'$BUILD_DIR/mongo/db/exec/sbe/query_sbe_storage',
"$BUILD_DIR/mongo/db/index/index_access_method",
"$BUILD_DIR/mongo/db/matcher/expressions",