diff options
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/cost_model/config.json | 8 | ||||
-rw-r--r-- | buildscripts/cost_model/database_instance.py | 4 | ||||
-rw-r--r-- | buildscripts/cost_model/mongod-inmemory.yaml | 12 | ||||
-rw-r--r-- | buildscripts/cost_model/mongod.yaml | 10 | ||||
-rw-r--r-- | buildscripts/cost_model/parameters_extractor.py | 9 | ||||
-rw-r--r-- | buildscripts/cost_model/workload_execution.py | 11 |
6 files changed, 32 insertions, 22 deletions
diff --git a/buildscripts/cost_model/config.json b/buildscripts/cost_model/config.json index da2a9bbaae3..cf16b3e5ecb 100644 --- a/buildscripts/cost_model/config.json +++ b/buildscripts/cost_model/config.json @@ -3,8 +3,8 @@ "connectionString": "mongodb://localhost", "databaseName": "abt_calibration", "dumpPath": "~/data/dump", - "restoreFromDump": "onlyNew", - "dumpOnExit": true + "restoreFromDump": "never", + "dumpOnExit": false }, "dataGenerator": { "enabled": true, @@ -120,8 +120,8 @@ "workloadExecution": { "enabled": true, "outputCollectionName": "calibrationData", - "writeMode": "append", + "writeMode": "replace", "warmupRuns": 1, - "runs": 20 + "runs": 5 } } diff --git a/buildscripts/cost_model/database_instance.py b/buildscripts/cost_model/database_instance.py index f651123d4c7..7fd271709d0 100644 --- a/buildscripts/cost_model/database_instance.py +++ b/buildscripts/cost_model/database_instance.py @@ -28,7 +28,6 @@ """A wrapper with useful methods over MongoDB database.""" from __future__ import annotations -import re from typing import Sequence, Mapping, NewType, Any import subprocess from pymongo import MongoClient, InsertOne @@ -76,7 +75,6 @@ class DatabaseInstance: def enable_sbe(self, state: bool) -> None: """Enable new query execution engine. Throw pymongo.errors.OperationFailure in case of failure.""" - # self.client.admin.command({'setParameter': 1, 'internalQueryEnableSlotBasedExecutionEngine': state}) self.client.admin.command({ 'setParameter': 1, 'internalQueryFrameworkControl': 'trySbeEngine' if state else 'forceClassicEngine' @@ -84,6 +82,8 @@ class DatabaseInstance: def enable_cascades(self, state: bool) -> None: """Enable new query optimizer. Requires featureFlagCommonQueryFramework set to True.""" + self.client.admin.command( + {'configureFailPoint': 'enableExplainInBonsai', 'mode': 'alwaysOn'}) self.client.admin.command({ 'setParameter': 1, 'internalQueryFrameworkControl': 'tryBonsai' if state else 'trySbeEngine' diff --git a/buildscripts/cost_model/mongod-inmemory.yaml b/buildscripts/cost_model/mongod-inmemory.yaml new file mode 100644 index 00000000000..8a8234a3f6d --- /dev/null +++ b/buildscripts/cost_model/mongod-inmemory.yaml @@ -0,0 +1,12 @@ +storage: + engine: inMemory + dbPath: /home/ubuntu/data/inmemorydb +systemLog: + path: /home/ubuntu/data/logs/mongod-inmemory.log + destination: file + logAppend: false +setParameter: + featureFlagCommonQueryFramework: true + internalQueryFrameworkControl: "tryBonsai" + internalMeasureQueryExecutionTimeInMicroseconds: true + enableTestCommands: 1 diff --git a/buildscripts/cost_model/mongod.yaml b/buildscripts/cost_model/mongod.yaml index ade7a3a0e22..eee02775918 100644 --- a/buildscripts/cost_model/mongod.yaml +++ b/buildscripts/cost_model/mongod.yaml @@ -1,9 +1,11 @@ storage: - engine: inMemory - dbPath: /home/ubuntu/data/inmemorydb - journal: - enabled: false + dbPath: /home/ubuntu/data/db +systemLog: + path: /home/ubuntu/data/logs/mongod.log + destination: file + logAppend: false setParameter: featureFlagCommonQueryFramework: true internalQueryFrameworkControl: "tryBonsai" internalMeasureQueryExecutionTimeInMicroseconds: true + enableTestCommands: 1 diff --git a/buildscripts/cost_model/parameters_extractor.py b/buildscripts/cost_model/parameters_extractor.py index d36a399f5f0..9bdbceabff7 100644 --- a/buildscripts/cost_model/parameters_extractor.py +++ b/buildscripts/cost_model/parameters_extractor.py @@ -112,8 +112,13 @@ def parse_explain(explain: Mapping[str, any], abt_types: Sequence[str]): """Extract ExecutionStats from the given explain for the given ABT types.""" result: Mapping[str, ExecutionStats] = {} - et = execution_tree.build_execution_tree(explain['executionStats']) - pt = physical_tree.build(explain['queryPlanner']['winningPlan']['optimizerPlan']) + try: + et = execution_tree.build_execution_tree(explain['executionStats']) + pt = physical_tree.build(explain['queryPlanner']['winningPlan']['optimizerPlan']) + except Exception as exception: + print(f'*** Failed to parse explain with the followinf error: {exception}') + print(explain) + raise exception if len(abt_types) == 0: abt_types = get_abt_types(pt) diff --git a/buildscripts/cost_model/workload_execution.py b/buildscripts/cost_model/workload_execution.py index 95f33b8943d..956d9b03bc3 100644 --- a/buildscripts/cost_model/workload_execution.py +++ b/buildscripts/cost_model/workload_execution.py @@ -71,16 +71,7 @@ def execute(database: DatabaseInstance, config: WorkloadExecutionConfig, return collector = WorkloadExecution(database, config) - # run with indexes enabled - for coll_info in collection_infos: - database.unhide_all_indexes(coll_info.name) - print('>>> running queries with indexed enabled') - collector.collect(collection_infos, queries) - - # run with indexes disabled - for coll_info in collection_infos: - database.hide_all_indexes(coll_info.name) - print('\n\n>>> running queries with indexed disabled') + print('>>> running queries') collector.collect(collection_infos, queries) |