From 825f7246e8a973f134c533d0d1f3b68abeeba010 Mon Sep 17 00:00:00 2001 From: Andrew Morrow Date: Tue, 10 Dec 2019 20:05:44 +0000 Subject: SERVER-44546 Remove mobile variants and embedded benchmarks (cherry picked from commit be05c9ea62d6f01895545628992f1899426b88c4) (cherry picked from commit c51ba0a06ede1d87cd8df637f379bb3ceabad6fa) --- buildscripts/bypass_compile_and_fetch_binaries.py | 2 - buildscripts/mobile/README-Android.md | 40 -- buildscripts/mobile/__init__.py | 1 - buildscripts/mobile/adb_monitor.py | 437 --------------------- .../mobile/benchrun_embedded_setup_android.py | 214 ---------- .../suites/benchrun_embedded_aggregation.yml | 10 - .../suites/benchrun_embedded_commands.yml | 10 - .../suites/benchrun_embedded_insert.yml | 10 - .../suites/benchrun_embedded_misc.yml | 19 - .../suites/benchrun_embedded_mixed_and_multi.yml | 11 - .../suites/benchrun_embedded_queries.yml | 10 - .../suites/benchrun_embedded_remove.yml | 10 - .../suites/benchrun_embedded_update.yml | 10 - buildscripts/resmokelib/config.py | 16 +- buildscripts/resmokelib/parser.py | 28 +- buildscripts/resmokelib/selector.py | 1 - .../testing/hooks/collect_embedded_resources.py | 58 --- .../hooks/combine_benchrun_embedded_results.py | 156 -------- .../testing/testcases/benchrun_embedded_test.py | 149 ------- buildscripts/tests/mobile/__init__.py | 1 - buildscripts/tests/mobile/test_adb_monitor.py | 136 ------- .../test_combine_benchrun_embedded_results.py | 165 -------- etc/evergreen.yml | 387 ------------------ jstests/core_standalone/write_concern.js | 4 +- jstests/libs/mongoebench.js | 49 --- jstests/noPassthrough/mongoebench_test.js | 51 --- src/mongo/db/ftdc/ftdc_system_stats_android.cpp | 129 ------ src/mongo/db/ftdc/ftdc_system_stats_iOS-sim.cpp | 31 -- src/mongo/db/ftdc/ftdc_system_stats_iOS.cpp | 31 -- src/mongo/db/ftdc/ftdc_system_stats_tvOS-sim.cpp | 31 -- src/mongo/db/ftdc/ftdc_system_stats_tvOS.cpp | 31 -- src/mongo/embedded/SConscript | 29 -- .../java/embedded-android/AndroidManifest.xml | 2 - .../java/embedded-android/build.gradle | 95 ----- src/mongo/embedded/mongoed_main.cpp | 158 -------- src/mongo/platform/stack_locator_android.cpp | 31 -- src/mongo/platform/stack_locator_iOS-sim.cpp | 31 -- src/mongo/platform/stack_locator_iOS.cpp | 31 -- src/mongo/platform/stack_locator_tvOS-sim.cpp | 31 -- src/mongo/platform/stack_locator_tvOS.cpp | 31 -- src/mongo/platform/stack_locator_watchOS-sim.cpp | 31 -- src/mongo/platform/stack_locator_watchOS.cpp | 31 -- src/mongo/shell/bench.cpp | 6 +- src/mongo/tools/SConscript | 23 -- src/mongo/tools/mongoebench_main.cpp | 168 -------- src/mongo/tools/mongoebench_options.cpp | 163 -------- src/mongo/tools/mongoebench_options.h | 77 ---- src/mongo/tools/mongoebench_options_init.cpp | 56 --- src/mongo/util/dns_query_android-impl.h | 84 ---- src/mongo/util/processinfo_android.cpp | 31 -- src/mongo/util/processinfo_iOS-sim.cpp | 31 -- src/mongo/util/processinfo_iOS.cpp | 31 -- src/mongo/util/processinfo_tvOS-sim.cpp | 31 -- src/mongo/util/processinfo_tvOS.cpp | 31 -- src/mongo/util/processinfo_watchOS-sim.cpp | 31 -- src/mongo/util/processinfo_watchOS.cpp | 31 -- src/third_party/scripts/mongo-perf_get_sources.sh | 78 ---- 57 files changed, 9 insertions(+), 3602 deletions(-) mode change 100644 => 100755 buildscripts/bypass_compile_and_fetch_binaries.py delete mode 100644 buildscripts/mobile/README-Android.md delete mode 100644 buildscripts/mobile/__init__.py delete mode 100644 buildscripts/mobile/adb_monitor.py delete mode 100644 buildscripts/mobile/benchrun_embedded_setup_android.py delete mode 100644 buildscripts/resmokeconfig/suites/benchrun_embedded_aggregation.yml delete mode 100644 buildscripts/resmokeconfig/suites/benchrun_embedded_commands.yml delete mode 100644 buildscripts/resmokeconfig/suites/benchrun_embedded_insert.yml delete mode 100644 buildscripts/resmokeconfig/suites/benchrun_embedded_misc.yml delete mode 100644 buildscripts/resmokeconfig/suites/benchrun_embedded_mixed_and_multi.yml delete mode 100644 buildscripts/resmokeconfig/suites/benchrun_embedded_queries.yml delete mode 100644 buildscripts/resmokeconfig/suites/benchrun_embedded_remove.yml delete mode 100644 buildscripts/resmokeconfig/suites/benchrun_embedded_update.yml delete mode 100644 buildscripts/resmokelib/testing/hooks/collect_embedded_resources.py delete mode 100644 buildscripts/resmokelib/testing/hooks/combine_benchrun_embedded_results.py delete mode 100644 buildscripts/resmokelib/testing/testcases/benchrun_embedded_test.py delete mode 100644 buildscripts/tests/mobile/__init__.py delete mode 100644 buildscripts/tests/mobile/test_adb_monitor.py delete mode 100755 buildscripts/tests/resmokelib/testing/hooks/test_combine_benchrun_embedded_results.py delete mode 100644 jstests/libs/mongoebench.js delete mode 100644 jstests/noPassthrough/mongoebench_test.js delete mode 100644 src/mongo/db/ftdc/ftdc_system_stats_android.cpp delete mode 100644 src/mongo/db/ftdc/ftdc_system_stats_iOS-sim.cpp delete mode 100644 src/mongo/db/ftdc/ftdc_system_stats_iOS.cpp delete mode 100644 src/mongo/db/ftdc/ftdc_system_stats_tvOS-sim.cpp delete mode 100644 src/mongo/db/ftdc/ftdc_system_stats_tvOS.cpp delete mode 100644 src/mongo/embedded/mongo_embedded/java/embedded-android/AndroidManifest.xml delete mode 100644 src/mongo/embedded/mongo_embedded/java/embedded-android/build.gradle delete mode 100644 src/mongo/embedded/mongoed_main.cpp delete mode 100644 src/mongo/platform/stack_locator_android.cpp delete mode 100644 src/mongo/platform/stack_locator_iOS-sim.cpp delete mode 100644 src/mongo/platform/stack_locator_iOS.cpp delete mode 100644 src/mongo/platform/stack_locator_tvOS-sim.cpp delete mode 100644 src/mongo/platform/stack_locator_tvOS.cpp delete mode 100644 src/mongo/platform/stack_locator_watchOS-sim.cpp delete mode 100644 src/mongo/platform/stack_locator_watchOS.cpp delete mode 100644 src/mongo/tools/mongoebench_main.cpp delete mode 100644 src/mongo/tools/mongoebench_options.cpp delete mode 100644 src/mongo/tools/mongoebench_options.h delete mode 100644 src/mongo/tools/mongoebench_options_init.cpp delete mode 100644 src/mongo/util/dns_query_android-impl.h delete mode 100644 src/mongo/util/processinfo_android.cpp delete mode 100644 src/mongo/util/processinfo_iOS-sim.cpp delete mode 100644 src/mongo/util/processinfo_iOS.cpp delete mode 100644 src/mongo/util/processinfo_tvOS-sim.cpp delete mode 100644 src/mongo/util/processinfo_tvOS.cpp delete mode 100644 src/mongo/util/processinfo_watchOS-sim.cpp delete mode 100644 src/mongo/util/processinfo_watchOS.cpp delete mode 100755 src/third_party/scripts/mongo-perf_get_sources.sh diff --git a/buildscripts/bypass_compile_and_fetch_binaries.py b/buildscripts/bypass_compile_and_fetch_binaries.py old mode 100644 new mode 100755 index 831d864a582..7c46063a595 --- a/buildscripts/bypass_compile_and_fetch_binaries.py +++ b/buildscripts/bypass_compile_and_fetch_binaries.py @@ -269,8 +269,6 @@ def main(): # pylint: disable=too-many-locals,too-many-statements extract_files = [ executable_name("dbtest"), executable_name("mongobridge"), - executable_name("mongoebench"), - executable_name("mongoed"), "build/integration_tests.txt", ] with tarfile.open(filename, "r:gz") as tar: diff --git a/buildscripts/mobile/README-Android.md b/buildscripts/mobile/README-Android.md deleted file mode 100644 index ed9cc744eb9..00000000000 --- a/buildscripts/mobile/README-Android.md +++ /dev/null @@ -1,40 +0,0 @@ -# Profiling an Application on Android -How to profile a test application for Android - -## Set up Your Local Environment -1. Download ADB SDK -1. Add the SDK platform-tools to your PATH - * export PATH="$PATH:$HOME/Library/Android/sdk/platform-tools" - -## Run the ADB profiler -The ADB profiler is a custom script which provides - * Battery statistics - battery.csv - * Memory statistics - memory.csv - * CPU statistics - cpu.json -`python buildscripts/mobile/adb_monitor.py` - - -## Enable USB Debugging on Android Device -Enabling USB debugging can differ by device, see https://developer.android.com/studio/debug/dev-options -1. Enable USB debugging via ADB, example - * Select Settings/About phone(or tablet) - * Select Build number 7 times, to enable Developer Options - * Select Settings/Developer Options/USB Debugging -1. Connect the Android device to the computer via USB cable -1. Select "Aways allow from this computer" and OK, when the prompt "Allow USB debugging?" appears on the device - -## Run the ADB Profiler Wirelessly -1. Ensure the local computer and Android device are on the same network -1. Connect the Android device to the computer via USB cable -1. Set the Android device's ADB listening port - * `adb devices` - * `adb tcpip 5555` -1. Disconnect the USB cable -1. Identify the Android's IP address - * Settings/About phone(or tablet)/Status - * `adb_ip=`, i.e., adb_ip=10.4.123.244 -1. Connect wirelessly to the Android device - * `adb connect $adb_ip` -1. Ensure you can connect to the Android device - * `adb shell uptime` -1. Run the ADB profiler as detailed above diff --git a/buildscripts/mobile/__init__.py b/buildscripts/mobile/__init__.py deleted file mode 100644 index 4b7a2bb941b..00000000000 --- a/buildscripts/mobile/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Empty.""" diff --git a/buildscripts/mobile/adb_monitor.py b/buildscripts/mobile/adb_monitor.py deleted file mode 100644 index d33a37e08d8..00000000000 --- a/buildscripts/mobile/adb_monitor.py +++ /dev/null @@ -1,437 +0,0 @@ -#!/usr/bin/env python -"""ADB utilities to collect adb samples from a locally connected Android device.""" - -import distutils.spawn # pylint: disable=no-name-in-module -import logging -import optparse -import os -import pipes -import re -import shlex -import sys -import tempfile -import threading -import time -import warnings - -# pylint: disable=wrong-import-position -# Get relative imports to work when the package is not installed on the PYTHONPATH. -if __name__ == "__main__" and __package__ is None: - sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) - -from buildscripts.util import fileops -from buildscripts.util import runcommand - -# Initialize the global logger. -LOGGER = logging.getLogger(__name__) - - -class Adb(object): - """Class to abstract calls to adb.""" - - def __init__(self, adb_binary="adb", logger=LOGGER): - """Initialize the Adb object.""" - self._cmd = None - self.logger = logger - self.adb_path = distutils.spawn.find_executable(adb_binary) - if not self.adb_path: - raise EnvironmentError( - "Executable '{}' does not exist or is not in the PATH.".format(adb_binary)) - - # We support specifying a path the adb binary to use; however, systrace.py only - # knows how to find it using the PATH environment variable. It is possible that - # 'adb_binary' is an absolute path specified by the user, so we add its parent - # directory to the PATH manually. - adb_dir = os.path.dirname(self.adb_path) - os.environ["PATH"] = "{}{}{}".format(os.environ["PATH"], os.path.pathsep, adb_dir) - - # systrace.py should be in /systrace/systrace.py - self.systrace_script = os.path.join(adb_dir, "systrace", "systrace.py") - if not os.path.isfile(self.systrace_script): - raise EnvironmentError("Script '{}' cannot be found.".format(self.systrace_script)) - self._tempfile = None - - @staticmethod - def adb_cmd(adb_command, output_file=None, append_file=False, output_string=False): - """Run an adb command and return result.""" - cmd = runcommand.RunCommand("adb {}".format(adb_command), output_file, append_file) - if output_string or not output_file: - return cmd.execute_with_output() - return cmd.execute_save_output() - - @staticmethod - def shell(adb_shell_command): - """Run an adb shell command and return output_string. - - Raise an exception if the exit status is non-zero. - - Since the adb shell command does not return an exit status. We simulate it by - saving the exit code in the output and then stripping if off. - - See https://stackoverflow.com/questions/9379400/adb-error-codes - """ - cmd_prefix = "set -o errexit; function _exit_ { echo __EXIT__:$?; } ; trap _exit_ EXIT ;" - cmd = runcommand.RunCommand("adb shell {} {}".format(cmd_prefix, adb_shell_command)) - cmd_output = cmd.execute_with_output() - if "__EXIT__" in cmd_output: - exit_code = int(cmd_output.split()[-1].split(":")[1]) - cmd_output_stripped = re.split("__EXIT__.*\n", cmd_output)[0] - if exit_code: - raise RuntimeError("{}: {}".format(exit_code, cmd_output_stripped)) - return cmd_output_stripped - return cmd_output - - def devices(self): - """Return the available ADB devices and the uptime.""" - return self.adb_cmd("devices -l", output_string=True) - - def device_available(self): - """Return the the uptime of the connected device.""" - # If the device is not available this will throw an exception. - return self.adb_cmd("shell uptime", output_string=True) - - def push(self, files, remote_dir, sync=False): - """Push a list of files over adb to remote_dir.""" - # We can specify files as a single file name or a list of files. - if isinstance(files, list): - files = " ".join(files) - sync_opt = "--sync " if sync else "" - return self.adb_cmd("push {}{} {}".format(sync_opt, files, remote_dir), output_string=True) - - def pull(self, files, local_dir): - """Pull a list of remote files over adb to local_dir.""" - # We can specify files as a single file name or a list of files. - if isinstance(files, list): - files = " ".join(files) - return self.adb_cmd("pull {} {}".format(files, local_dir), output_string=True) - - def _battery_cmd(self, option, output_file=None, append_file=False): - self.adb_cmd("shell dumpsys batterystats {}".format(option), output_file, append_file) - - def battery(self, reset=False, output_file=None, append_file=False): - """Collect the battery stats and save to the output_file.""" - if reset: - self._battery_cmd("--reset") - self._battery_cmd("--checkin", output_file, append_file) - - def memory(self, output_file=None, append_file=False): - """Collect the memory stats and save to the output_file.""" - self.adb_cmd("shell dumpsys meminfo -c -d", output_file, append_file) - - def systrace_start(self, output_file=None): - """Start the systrace.py script to collect CPU usage.""" - self._tempfile = tempfile.NamedTemporaryFile(delete=False).name - self._cmd = runcommand.RunCommand(output_file=self._tempfile, propagate_signals=False) - self._cmd.add_file(sys.executable) - self._cmd.add_file(self.systrace_script) - self._cmd.add("--json") - self._cmd.add("-o") - self._cmd.add_file(output_file) - self._cmd.add("dalvik sched freq idle load") - self._cmd.start_process() - - def systrace_stop(self, output_file=None): - """Stop the systrace.py script.""" - self._cmd.send_to_process("bye") - with open(self._tempfile) as fh: - buff = fh.read() - os.remove(self._tempfile) - self.logger.debug("systrace_stop: %s", buff) - if "Wrote trace" not in buff: - self.logger.error("CPU file not saved: %s", buff) - if os.path.isfile(output_file): - os.remove(output_file) - - -class AdbControl(object): # pylint: disable=too-many-instance-attributes - """Class to controls calls to adb.""" - - _JOIN_TIMEOUT = 24 * 60 * 60 # 24 hours (a long time to have the monitor run for) - - def __init__( # pylint: disable=too-many-arguments - self, adb, logger=LOGGER, battery_file=None, memory_file=None, cpu_file=None, - append_file=False, num_samples=0, collection_time_secs=0, sample_interval_ms=0): - """Initialize AdbControl object.""" - - self.adb = adb - - self.logger = logger - - output_files = [battery_file, memory_file, cpu_file] - if not any(output_files): - raise ValueError("There are no collection sample files selected.") - self.battery_file = battery_file - self.memory_file = memory_file - self.cpu_file = cpu_file - - # The AdbResourceMonitor will always append results to the specified file. - # If append_file is specified in this init, then if there's an existing file - # we do not overwrite it. - for output_file in output_files: - if not append_file: - fileops.create_empty(output_file) - - self.append_file = append_file - # collection_time_secs overrides num_samples - self.num_samples = num_samples if collection_time_secs == 0 else 0 - self.collection_time_secs = collection_time_secs - self.sample_interval_ms = sample_interval_ms - - self.should_stop = threading.Event() - self.should_stop.clear() - self.sample_based_threads = [] - self.all_threads = [] - - def start(self): - """Start adb sample collection.""" - if self.cpu_file: - monitor = AdbContinuousResourceMonitor(self.cpu_file, self.should_stop, - self.adb.systrace_start, self.adb.systrace_stop) - self.all_threads.append(monitor) - monitor.start() - - if self.battery_file: - monitor = AdbSampleBasedResourceMonitor(self.battery_file, self.should_stop, - self.adb.battery, self.num_samples, - self.sample_interval_ms) - self.sample_based_threads.append(monitor) - self.all_threads.append(monitor) - monitor.start() - - if self.memory_file: - monitor = AdbSampleBasedResourceMonitor(self.memory_file, self.should_stop, - self.adb.memory, self.num_samples, - self.sample_interval_ms) - self.sample_based_threads.append(monitor) - self.all_threads.append(monitor) - monitor.start() - - def stop(self): - """Stop adb sample collection.""" - self.should_stop.set() - self.wait() - - def wait(self): - """Wait for all sample collections to complete.""" - try: - # We either wait for the specified amount of time or for the sample-based monitors - # to have collected the specified number of samples. - if self.collection_time_secs > 0: - self.should_stop.wait(self.collection_time_secs) - else: - for thread in self.sample_based_threads: - # We must specify a timeout to threading.Thread.join() to ensure that the - # wait is interruptible. The main thread would otherwise never be able to - # receive a KeyboardInterrupt. - thread.join(self._JOIN_TIMEOUT) - except KeyboardInterrupt: - # The user has interrupted the script, so we signal to all of the monitor threads - # that they should exit as quickly as they can. - pass - finally: - self.should_stop.set() - # Wait for all of the monitor threads to exit, by specifying a timeout to - # threading.Thread.join() in case the user tries to interrupt the script again. - for thread in self.all_threads: - thread.join(self._JOIN_TIMEOUT) - - self.logger.info("Collections stopped.") - - # If any of the monitor threads encountered an error, then reraise the exception in the - # main thread. - for thread in self.all_threads: - if thread.exception is not None: - raise thread.exception - - -class AdbResourceMonitor(threading.Thread): - """Thread to collect information about a specific resource using adb.""" - - def __init__(self, output_file, should_stop, logger=LOGGER): - """Initialize the AdbResourceMonitor object.""" - threading.Thread.__init__(self, name="AdbResourceMonitor {}".format(output_file)) - self._output_file = output_file - self._should_stop = should_stop - self.logger = logger - self.exception = None - - def run(self): - """Collect adb samples.""" - try: - self._do_monitoring() - except Exception as err: # pylint: disable=broad-except - self.logger.error("%s: Encountered an error: %s", self._output_file, err) - self.exception = err - self._should_stop.set() - - -class AdbSampleBasedResourceMonitor(AdbResourceMonitor): - """Subclass for ADB sample based monitor.""" - - def __init__( # pylint: disable=too-many-arguments - self, output_file, should_stop, adb_cmd, num_samples, sample_interval_ms): - """Initialize AdbSampleBasedResourceMonitor.""" - AdbResourceMonitor.__init__(self, output_file, should_stop) - self.adb_cmd = adb_cmd - self._num_samples = num_samples - self._sample_interval_ms = sample_interval_ms - - def _do_monitoring(self): - """Monitor function.""" - collected_samples = 0 - now = time.time() - - while not self._should_stop.is_set(): - if self._num_samples > 0 and collected_samples >= self._num_samples: - break - if collected_samples > 0: - self.logger.debug("%s: Sleeping %d ms.", self._output_file, - self._sample_interval_ms) - self._should_stop.wait(self._sample_interval_ms / 1000.0) - collected_samples += 1 - self._take_sample(collected_samples) - - total_time_ms = (time.time() - now) * 1000 - self.logger.info("%s: Stopping monitoring, %d samples collected in %d ms.", - self._output_file, collected_samples, total_time_ms) - - def _take_sample(self, collected_samples): - """Collect sample.""" - self.logger.debug("%s: Collecting sample %d of %d", self._output_file, collected_samples, - self._num_samples) - self.adb_cmd(output_file=self._output_file, append_file=True) - - -class AdbContinuousResourceMonitor(AdbResourceMonitor): - """Subclass for ADB continuous sample based monitoring.""" - - def __init__(self, output_file, should_stop, adb_start_cmd, adb_stop_cmd): - """Initialize AdbContinuousResourceMonitor.""" - AdbResourceMonitor.__init__(self, output_file, should_stop) - self._adb_start_cmd = adb_start_cmd - self._adb_stop_cmd = adb_stop_cmd - - def _do_monitoring(self): - """Monitor function.""" - self.logger.debug("%s: Starting monitoring.", self._output_file) - now = time.time() - self._adb_start_cmd(output_file=self._output_file) - self._should_stop.wait() - total_time_ms = (time.time() - now) * 1000 - self.logger.info("%s: Stopping monitoring after %d ms.", self._output_file, total_time_ms) - self._adb_stop_cmd(output_file=self._output_file) - - -def main(): #pylint: disable=too-many-statements - """Execute Main program.""" - - logging.basicConfig(format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO) - logging.Formatter.converter = time.gmtime - - parser = optparse.OptionParser() - - program_options = optparse.OptionGroup(parser, "Program Options") - battery_options = optparse.OptionGroup(parser, "Battery Options") - memory_options = optparse.OptionGroup(parser, "Memory Options") - systrace_options = optparse.OptionGroup(parser, "Systrace Options") - - program_options.add_option("--adbBinary", dest="adb_binary", - help="The path for adb. Defaults to '%default', which is in $PATH.", - default="adb") - - program_options.add_option( - "--samples", dest="num_samples", - help="Number of samples to collect, 0 indicates infinite. [Default: %default]", type=int, - default=0) - - program_options.add_option( - "--collectionTime", dest="collection_time_secs", - help="Time in seconds to collect samples, if specifed overrides '--samples'.", type=int, - default=0) - - program_options.add_option( - "--sampleIntervalMs", dest="sample_interval_ms", - help="Time in milliseconds between collecting a sample. [Default: %default]", type=int, - default=500) - - log_levels = ["debug", "error", "info", "warning"] - program_options.add_option( - "--logLevel", dest="log_level", choices=log_levels, - help="The log level. Accepted values are: {}. [default: '%default'].".format(log_levels), - default="info") - - battery_options.add_option( - "--batteryFile", dest="battery_file", - help="The destination file for battery stats (CSV format). [Default: %default].", - default="battery.csv") - - battery_options.add_option("--noBattery", dest="no_battery", - help="Disable collection of battery samples.", action="store_true", - default=False) - - memory_options.add_option( - "--memoryFile", dest="memory_file", - help="The destination file for memory stats (CSV format). [Default: %default].", - default="memory.csv") - - memory_options.add_option("--noMemory", dest="no_memory", - help="Disable collection of memory samples.", action="store_true", - default=False) - - systrace_options.add_option( - "--cpuFile", dest="cpu_file", - help="The destination file for CPU stats (JSON format). [Default: %default].", - default="cpu.json") - - systrace_options.add_option("--noCpu", dest="no_cpu", help="Disable collection of CPU samples.", - action="store_true", default=False) - - parser.add_option_group(program_options) - parser.add_option_group(battery_options) - parser.add_option_group(memory_options) - parser.add_option_group(systrace_options) - - options, _ = parser.parse_args() - - output_files = {} - if options.no_battery: - options.battery_file = None - else: - output_files[options.battery_file] = fileops.getmtime(options.battery_file) - - if options.no_memory: - options.memory_file = None - else: - output_files[options.memory_file] = fileops.getmtime(options.memory_file) - - if options.no_cpu: - options.cpu_file = None - else: - output_files[options.cpu_file] = fileops.getmtime(options.cpu_file) - - LOGGER.setLevel(options.log_level.upper()) - LOGGER.info("This program can be cleanly terminated by issuing the following command:" - "\n\t\t'kill -INT %d'", os.getpid()) - - adb = Adb(options.adb_binary) - LOGGER.info("Detected devices by adb:\n%s%s", adb.devices(), adb.device_available()) - - adb_control = AdbControl(adb=adb, battery_file=options.battery_file, - memory_file=options.memory_file, cpu_file=options.cpu_file, - num_samples=options.num_samples, - collection_time_secs=options.collection_time_secs, - sample_interval_ms=options.sample_interval_ms) - - adb_control.start() - try: - adb_control.wait() - finally: - files_saved = [] - for path in output_files: - if fileops.getmtime(path) > output_files[path] and not fileops.is_empty(path): - files_saved.append(path) - LOGGER.info("Files saved: %s", files_saved) - - -if __name__ == "__main__": - main() diff --git a/buildscripts/mobile/benchrun_embedded_setup_android.py b/buildscripts/mobile/benchrun_embedded_setup_android.py deleted file mode 100644 index f2aaac544bd..00000000000 --- a/buildscripts/mobile/benchrun_embedded_setup_android.py +++ /dev/null @@ -1,214 +0,0 @@ -#!/usr/bin/env python -"""Setup an Android device to run the benchrun_embedded test suite.""" - -from __future__ import print_function - -import glob -import logging -import optparse -import os -import posixpath -import shutil -import sys -import tarfile -import tempfile -import time -import urllib - -# pylint: disable=wrong-import-position -# Get relative imports to work when the package is not installed on the PYTHONPATH. -if __name__ == "__main__" and __package__ is None: - sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) - -from buildscripts.mobile import adb_monitor - -# Initialize the global logger. -LOGGER = logging.getLogger(__name__) - - -def download_and_untar(url, root_dir): - """Download url and untar into root_dir.""" - temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".tgz").name - LOGGER.info("Downloading %s", url) - urllib.urlretrieve(url, temp_file) - with tarfile.open(temp_file, "r:gz") as tar: - tar.extractall(root_dir) - os.remove(temp_file) - - -def push_directory_contents(adb, local_dir, remote_dir): - """Push contents of local_dir to remote_dir via adb.""" - # Push the contents of temp_dir. - paths = glob.glob(os.path.join(local_dir, "*")) - paths.sort() - paths_msg = paths - if isinstance(paths, list): - paths_msg = [os.path.basename(path) for path in paths] - paths_msg = "{}{}".format(paths_msg[:5], "" if len(paths) <= 5 else " ...") - LOGGER.info("Pushing %s to %s", paths_msg, remote_dir) - adb.push(paths, remote_dir) - - -def download_and_push(adb, url, remote_dir, local_dir=None): - """Download url and push directory to remote_dir via adb. - - If local_dir is defined, then save the unzipped tar there. - """ - temp_dir = tempfile.mkdtemp() - download_and_untar(url, temp_dir) - push_directory_contents(adb, temp_dir, remote_dir) - if local_dir: - if os.path.exists(local_dir): - LOGGER.info("Removing local path %s", local_dir) - shutil.rmtree(local_dir) - LOGGER.info("Saving local copy to %s", local_dir) - shutil.move(temp_dir, local_dir) - else: - shutil.rmtree(temp_dir) - - -def create_empty_remote_dirs(adb, dirs): - """Create empty remote directories via adb.""" - # We can specify dirs as a single directory name or as list. - if isinstance(dirs, str): - dirs = [dirs] - # Keep directories in order, so we do not delete a root level later. - dirs.sort() - for remote_dir in dirs: - LOGGER.info("Creating remote directory %s", remote_dir) - adb.shell( - "if [ -d {remote_dir} ]; then rm -fr {remote_dir}; fi; mkdir -p {remote_dir}".format( - remote_dir=remote_dir)) - - -def move_sdk_files(adb, sdk_root_dir): - """Move all the files in bin and lib into sdk_root_dir.""" - LOGGER.info("Moving SDK bin & lib files to %s", sdk_root_dir) - adb_command = "lib_dir=$(find {} -name 'lib')".format(sdk_root_dir) - adb_command = "{}; bin_dir=$(find {} -name 'bin')".format(adb_command, sdk_root_dir) - adb_command = "{}; mv $lib_dir/* $bin_dir/* {}".format(adb_command, sdk_root_dir) - adb.shell(adb_command) - - -def main(): - """Execute Main program.""" - - logging.basicConfig(format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO) - logging.Formatter.converter = time.gmtime - - benchrun_root = "/data/local/tmp/benchrun_embedded" - - parser = optparse.OptionParser() - program_options = optparse.OptionGroup(parser, "Program Options") - device_options = optparse.OptionGroup(parser, "Device Options") - sdk_options = optparse.OptionGroup(parser, "Embedded Test SDK Options") - json_options = optparse.OptionGroup(parser, "JSON benchrun file Options") - - program_options.add_option("--adbBinary", dest="adb_binary", - help="The path for adb. Defaults to '%default', which is in $PATH.", - default="adb") - - device_options.add_option( - "--rootRemoteDir", dest="embedded_root_dir", - help="The remote root directory to store the files. Defaults to '%default'.", - default=benchrun_root) - - device_options.add_option( - "--dbDir", dest="db_dir", - help=("The remote dbpath directory used by mongoebench." - " Will be created if it does not exist. Defaults to '%default'."), - default=posixpath.join(benchrun_root, "db")) - - device_options.add_option( - "--resultsDir", dest="results_dir", - help=("The remote directory to store the mongoebench results." - " Will be created if it does not exist. Defaults to '%default'."), - default=posixpath.join(benchrun_root, "results")) - - device_options.add_option( - "--sdkRemoteDir", dest="sdk_remote_dir", - help="The remote directory to store the embedded SDK files. Defaults to '%default'.", - default=posixpath.join(benchrun_root, "sdk")) - - device_options.add_option("--benchrunJsonRemoteDir", dest="json_remote_dir", - help="The remote directory to store the benchrun JSON files." - " Defaults to '%default'.", default=posixpath.join( - benchrun_root, "testcases")) - - sdk_url = "https://s3.amazonaws.com/mciuploads/mongodb-mongo-v4.0/embedded-sdk-test/embedded-sdk-android-arm64-latest.tgz" - sdk_options.add_option( - "--sdkUrl", dest="sdk_url", - help=("The embedded SDK test URL. This tarball must contain mongoebench and" - " any required shared object (.so) libraries. Defaults to '%default'."), - default=sdk_url) - - sdk_options.add_option("--sdkLocalDir", dest="sdk_local_dir", - help="The local directory of embedded SDK files to be copied." - "If specified, overrides --sdkUrl.", default=None) - - sdk_options.add_option( - "--sdkSaveLocalDir", dest="sdk_save_local_dir", - help=("The local directory to save the downloaded embedded SDK as an unzipped tarball." - " Only used if the embedded SDK tarball is downloaded. Note - this will delete" - " the existing directory."), default=None) - - json_url = "https://s3.amazonaws.com/mciuploads/mongodb-mongo-v4.0/benchrun_embedded/benchrun_json_files.tgz" - json_options.add_option( - "--benchrunJsonUrl", dest="json_url", - help=("The benchrun JSON files URL. This tarball must contain all the JSON" - " files to be used in the benchrun embedded test." - " Defaults to '%default'."), default=json_url) - - json_options.add_option("--benchrunJsonLocalDir", dest="json_local_dir", - help="The local directory of benchrun JSON files to be copied." - "If specified, overrides --benchrunJsonUrl.", default=None) - - json_options.add_option( - "--benchrunJsonSaveLocalDir", dest="json_save_local_dir", - help=("The local directory to save the downloaded benchrun JSON as an unzipped tarball." - " Only used if the benchrun JSON files tarball is downloaded. Note - this will" - " delete the existing directory. Defaults to '%default'."), default=os.path.join( - "benchrun_embedded", "testcases")) - - json_options.add_option( - "--noBenchrunJsonSaveLocal", action="store_true", dest="no_json_save_local_dir", - help=("Disable saving downloaded benchrun JSON as an unzipped tarball."), default=False) - - parser.add_option_group(program_options) - parser.add_option_group(device_options) - parser.add_option_group(sdk_options) - parser.add_option_group(json_options) - options, _ = parser.parse_args() - - if options.no_json_save_local_dir: - options.json_save_local_dir = None - - adb = adb_monitor.Adb(options.adb_binary) - adb.device_available() - LOGGER.info("Detected devices by adb:\n%s%s", adb.devices(), adb.device_available()) - - # Create/empty remote directories. - create_empty_remote_dirs(adb, [ - options.embedded_root_dir, options.db_dir, options.results_dir, options.sdk_remote_dir, - options.json_remote_dir - ]) - - # Download, untar and push Embedded SDK Tests & Benchrun JSON files. - # Unfortunately gunzip may not exist on the Android device, so we cannot use this remote command: - # curl URL | tar -xzv -C LOCAL_DIR - - if options.sdk_local_dir: - push_directory_contents(adb, options.sdk_local_dir, options.sdk_remote_dir) - else: - download_and_push(adb, options.sdk_url, options.sdk_remote_dir, options.sdk_save_local_dir) - move_sdk_files(adb, options.sdk_remote_dir) - - if options.json_local_dir: - push_directory_contents(adb, options.json_local_dir, options.json_remote_dir) - else: - download_and_push(adb, options.json_url, options.json_remote_dir, - options.json_save_local_dir) - - -if __name__ == "__main__": - main() diff --git a/buildscripts/resmokeconfig/suites/benchrun_embedded_aggregation.yml b/buildscripts/resmokeconfig/suites/benchrun_embedded_aggregation.yml deleted file mode 100644 index 6db291dcde1..00000000000 --- a/buildscripts/resmokeconfig/suites/benchrun_embedded_aggregation.yml +++ /dev/null @@ -1,10 +0,0 @@ -test_kind: benchrun_embedded_test - -selector: - roots: - - benchrun_embedded/testcases/**/aggregation*.json - -executor: - hooks: - - class: CollectEmbeddedResources - - class: CombineBenchrunEmbeddedResults diff --git a/buildscripts/resmokeconfig/suites/benchrun_embedded_commands.yml b/buildscripts/resmokeconfig/suites/benchrun_embedded_commands.yml deleted file mode 100644 index c44747998c6..00000000000 --- a/buildscripts/resmokeconfig/suites/benchrun_embedded_commands.yml +++ /dev/null @@ -1,10 +0,0 @@ -test_kind: benchrun_embedded_test - -selector: - roots: - - benchrun_embedded/testcases/**/commands*.json - -executor: - hooks: - - class: CollectEmbeddedResources - - class: CombineBenchrunEmbeddedResults diff --git a/buildscripts/resmokeconfig/suites/benchrun_embedded_insert.yml b/buildscripts/resmokeconfig/suites/benchrun_embedded_insert.yml deleted file mode 100644 index 55350189472..00000000000 --- a/buildscripts/resmokeconfig/suites/benchrun_embedded_insert.yml +++ /dev/null @@ -1,10 +0,0 @@ -test_kind: benchrun_embedded_test - -selector: - roots: - - benchrun_embedded/testcases/**/insert*.json - -executor: - hooks: - - class: CollectEmbeddedResources - - class: CombineBenchrunEmbeddedResults diff --git a/buildscripts/resmokeconfig/suites/benchrun_embedded_misc.yml b/buildscripts/resmokeconfig/suites/benchrun_embedded_misc.yml deleted file mode 100644 index 56896e5b6e1..00000000000 --- a/buildscripts/resmokeconfig/suites/benchrun_embedded_misc.yml +++ /dev/null @@ -1,19 +0,0 @@ -test_kind: benchrun_embedded_test - -selector: - roots: - - benchrun_embedded/testcases/**/*.json - exclude_files: - - benchrun_embedded/testcases/**/aggregation*.json - - benchrun_embedded/testcases/**/commands*.json - - benchrun_embedded/testcases/**/insert*.json - - benchrun_embedded/testcases/**/mixed*.json - - benchrun_embedded/testcases/**/multi*.json - - benchrun_embedded/testcases/**/queries*.json - - benchrun_embedded/testcases/**/remove*.json - - benchrun_embedded/testcases/**/update*.json - -executor: - hooks: - - class: CollectEmbeddedResources - - class: CombineBenchrunEmbeddedResults diff --git a/buildscripts/resmokeconfig/suites/benchrun_embedded_mixed_and_multi.yml b/buildscripts/resmokeconfig/suites/benchrun_embedded_mixed_and_multi.yml deleted file mode 100644 index cd0deb1d09f..00000000000 --- a/buildscripts/resmokeconfig/suites/benchrun_embedded_mixed_and_multi.yml +++ /dev/null @@ -1,11 +0,0 @@ -test_kind: benchrun_embedded_test - -selector: - roots: - - benchrun_embedded/testcases/**/mixed*.json - - benchrun_embedded/testcases/**/multi*.json - -executor: - hooks: - - class: CollectEmbeddedResources - - class: CombineBenchrunEmbeddedResults diff --git a/buildscripts/resmokeconfig/suites/benchrun_embedded_queries.yml b/buildscripts/resmokeconfig/suites/benchrun_embedded_queries.yml deleted file mode 100644 index 9ba8ef7db43..00000000000 --- a/buildscripts/resmokeconfig/suites/benchrun_embedded_queries.yml +++ /dev/null @@ -1,10 +0,0 @@ -test_kind: benchrun_embedded_test - -selector: - roots: - - benchrun_embedded/testcases/**/queries*.json - -executor: - hooks: - - class: CollectEmbeddedResources - - class: CombineBenchrunEmbeddedResults diff --git a/buildscripts/resmokeconfig/suites/benchrun_embedded_remove.yml b/buildscripts/resmokeconfig/suites/benchrun_embedded_remove.yml deleted file mode 100644 index f625a2e874b..00000000000 --- a/buildscripts/resmokeconfig/suites/benchrun_embedded_remove.yml +++ /dev/null @@ -1,10 +0,0 @@ -test_kind: benchrun_embedded_test - -selector: - roots: - - benchrun_embedded/testcases/**/remove*.json - -executor: - hooks: - - class: CollectEmbeddedResources - - class: CombineBenchrunEmbeddedResults diff --git a/buildscripts/resmokeconfig/suites/benchrun_embedded_update.yml b/buildscripts/resmokeconfig/suites/benchrun_embedded_update.yml deleted file mode 100644 index a9ad8734a1b..00000000000 --- a/buildscripts/resmokeconfig/suites/benchrun_embedded_update.yml +++ /dev/null @@ -1,10 +0,0 @@ -test_kind: benchrun_embedded_test - -selector: - roots: - - benchrun_embedded/testcases/**/update*.json - -executor: - hooks: - - class: CollectEmbeddedResources - - class: CombineBenchrunEmbeddedResults diff --git a/buildscripts/resmokelib/config.py b/buildscripts/resmokelib/config.py index b6429d5498c..f0886877bfc 100644 --- a/buildscripts/resmokelib/config.py +++ b/buildscripts/resmokelib/config.py @@ -26,7 +26,6 @@ MONGO_RUNNER_SUBDIR = "mongorunner" # Default path for where to look for executables. DEFAULT_DBTEST_EXECUTABLE = os.path.join(os.curdir, "dbtest") DEFAULT_MONGO_EXECUTABLE = os.path.join(os.curdir, "mongo") -DEFAULT_MONGOEBENCH_EXECUTABLE = os.path.join(os.curdir, "mongoebench") DEFAULT_MONGOD_EXECUTABLE = os.path.join(os.curdir, "mongod") DEFAULT_MONGOS_EXECUTABLE = os.path.join(os.curdir, "mongos") @@ -43,9 +42,6 @@ DEFAULTS = { "archive_limit_mb": 5000, "archive_limit_tests": 10, "base_port": 20000, - "benchrun_device": "Desktop", - "benchrun_embedded_root": "/data/local/tmp/benchrun_embedded", - "benchrun_report_root": "benchrun_embedded/results", "buildlogger_url": "https://logkeeper.mongodb.org", "continue_on_failure": False, "dbpath_prefix": None, @@ -57,7 +53,6 @@ DEFAULTS = { "mongo_executable": None, "mongod_executable": None, "mongod_set_parameters": None, - "mongoebench_executable": None, "mongos_executable": None, "mongos_set_parameters": None, "no_journal": False, @@ -277,9 +272,6 @@ MONGOD_EXECUTABLE = None # The --setParameter options passed to mongod. MONGOD_SET_PARAMETERS = None -# The path to the mongoebench executable used by resmoke.py. -MONGOEBENCH_EXECUTABLE = None - # The path to the mongos executable used by resmoke.py. MONGOS_EXECUTABLE = None @@ -368,11 +360,6 @@ BENCHMARK_LIST_TESTS = None BENCHMARK_MIN_TIME = None BENCHMARK_REPETITIONS = None -# Embedded Benchrun Test options. -BENCHRUN_DEVICE = None -BENCHRUN_EMBEDDED_ROOT = None -BENCHRUN_REPORT_ROOT = None - ## # Internally used configuration options that aren't exposed to the user ## @@ -394,5 +381,4 @@ DEFAULT_INTEGRATION_TEST_LIST = "build/integration_tests.txt" # External files or executables, used as suite selectors, that are created during the build and # therefore might not be available when creating a test membership map. EXTERNAL_SUITE_SELECTORS = (DEFAULT_BENCHMARK_TEST_LIST, DEFAULT_UNIT_TEST_LIST, - DEFAULT_INTEGRATION_TEST_LIST, DEFAULT_DBTEST_EXECUTABLE, - DEFAULT_MONGOEBENCH_EXECUTABLE) + DEFAULT_INTEGRATION_TEST_LIST, DEFAULT_DBTEST_EXECUTABLE) diff --git a/buildscripts/resmokelib/parser.py b/buildscripts/resmokelib/parser.py index 63c8e3f9e4d..d209d70e230 100644 --- a/buildscripts/resmokelib/parser.py +++ b/buildscripts/resmokelib/parser.py @@ -112,10 +112,6 @@ def _make_parser(): # pylint: disable=too-many-statements " started by resmoke.py. The argument is specified as bracketed YAML -" " i.e. JSON with support for single quoted and unquoted keys.")) - parser.add_option("--mongoebench", dest="mongoebench_executable", metavar="PATH", - help=("The path to the mongoebench (benchrun embedded) executable for" - " resmoke.py to use.")) - parser.add_option("--mongos", dest="mongos_executable", metavar="PATH", help="The path to the mongos executable for resmoke.py to use.") @@ -303,23 +299,9 @@ def _make_parser(): # pylint: disable=too-many-statements benchmark_options.add_option("--benchmarkRepetitions", type="int", dest="benchmark_repetitions", metavar="BENCHMARK_REPETITIONS", help=benchmark_repetitions_help) - benchrun_devices = ["Android", "Desktop"] - benchmark_options.add_option("--benchrunDevice", dest="benchrun_device", metavar="DEVICE", - type="choice", action="store", choices=benchrun_devices, - help=("The device to run the benchrun test on, choose from {}." - " Defaults to DEVICE='%default'.".format(benchrun_devices))) - - benchmark_options.add_option("--benchrunReportRoot", dest="benchrun_report_root", - metavar="PATH", help="The root path for benchrun test report.") - - benchmark_options.add_option("--benchrunEmbeddedRoot", dest="benchrun_embedded_root", - metavar="PATH", - help="The root path on the mobile device, for a benchrun test.") - - parser.set_defaults(benchrun_device="Desktop", dry_run="off", find_suites=False, - list_suites=False, logger_file="console", prealloc_journal="off", - shuffle="auto", stagger_jobs="off", suite_files="with_server", - majority_read_concern="on") + parser.set_defaults(dry_run="off", find_suites=False, list_suites=False, logger_file="console", + prealloc_journal="off", shuffle="auto", stagger_jobs="off", + suite_files="with_server", majority_read_concern="on") return parser @@ -384,8 +366,6 @@ def _update_config_vars(values): # pylint: disable=too-many-statements _config.ARCHIVE_LIMIT_MB = config.pop("archive_limit_mb") _config.ARCHIVE_LIMIT_TESTS = config.pop("archive_limit_tests") _config.BASE_PORT = int(config.pop("base_port")) - _config.BENCHRUN_DEVICE = config.pop("benchrun_device") - _config.BENCHRUN_EMBEDDED_ROOT = config.pop("benchrun_embedded_root") _config.BUILDLOGGER_URL = config.pop("buildlogger_url") _config.DBPATH_PREFIX = _expand_user(config.pop("dbpath_prefix")) _config.DBTEST_EXECUTABLE = _expand_user(config.pop("dbtest_executable")) @@ -398,7 +378,6 @@ def _update_config_vars(values): # pylint: disable=too-many-statements _config.MONGO_EXECUTABLE = _expand_user(config.pop("mongo_executable")) _config.MONGOD_EXECUTABLE = _expand_user(config.pop("mongod_executable")) _config.MONGOD_SET_PARAMETERS = config.pop("mongod_set_parameters") - _config.MONGOEBENCH_EXECUTABLE = _expand_user(config.pop("mongoebench_executable")) _config.MONGOS_EXECUTABLE = _expand_user(config.pop("mongos_executable")) _config.MONGOS_SET_PARAMETERS = config.pop("mongos_set_parameters") _config.NO_JOURNAL = config.pop("no_journal") @@ -443,7 +422,6 @@ def _update_config_vars(values): # pylint: disable=too-many-statements if benchmark_min_time is not None: _config.BENCHMARK_MIN_TIME = datetime.timedelta(seconds=benchmark_min_time) _config.BENCHMARK_REPETITIONS = config.pop("benchmark_repetitions") - _config.BENCHRUN_REPORT_ROOT = config.pop("benchrun_report_root") shuffle = config.pop("shuffle") if shuffle == "auto": diff --git a/buildscripts/resmokelib/selector.py b/buildscripts/resmokelib/selector.py index 197102b16b0..0ed27403cbc 100644 --- a/buildscripts/resmokelib/selector.py +++ b/buildscripts/resmokelib/selector.py @@ -676,7 +676,6 @@ _SELECTOR_REGISTRY = { "cpp_integration_test": (_CppTestSelectorConfig, _CppTestSelector), "cpp_unit_test": (_CppTestSelectorConfig, _CppTestSelector), "benchmark_test": (_CppTestSelectorConfig, _CppTestSelector), - "benchrun_embedded_test": (_JsonTestSelectorConfig, _Selector), "db_test": (_DbTestSelectorConfig, _DbTestSelector), "fsm_workload_test": (_JSTestSelectorConfig, _JSTestSelector), "parallel_fsm_workload_test": (_MultiJSTestSelectorConfig, _MultiJSTestSelector), diff --git a/buildscripts/resmokelib/testing/hooks/collect_embedded_resources.py b/buildscripts/resmokelib/testing/hooks/collect_embedded_resources.py deleted file mode 100644 index f6ddffc3963..00000000000 --- a/buildscripts/resmokelib/testing/hooks/collect_embedded_resources.py +++ /dev/null @@ -1,58 +0,0 @@ -"""Module for generating and collecting embedded resource results.""" - -from __future__ import absolute_import - -import os - -from buildscripts.mobile import adb_monitor -from buildscripts.resmokelib import config as _config -from buildscripts.resmokelib.testing.hooks import interface - - -class CollectEmbeddedResources(interface.Hook): # pylint: disable=too-many-instance-attributes - """CollectEmbeddedResources class. - - CollectEmbeddedResources starts and stops the resource monitoring for each test. - """ - - DESCRIPTION = "Embedded resources" - - def __init__(self, hook_logger, fixture, sample_interval_ms=500, threads=1): - """Initialize CollectEmbeddedResources.""" - interface.Hook.__init__(self, hook_logger, fixture, CollectEmbeddedResources.DESCRIPTION) - self.hook_logger = hook_logger - self.adb = None - self.adb_control = None - if _config.BENCHRUN_DEVICE == "Android": - self.report_root = _config.BENCHRUN_REPORT_ROOT - self.sample_interval_ms = sample_interval_ms - self.threads = threads - self.battery_file = "battery.csv" - self.cpu_file = "cpu.json" - self.memory_file = "memory.csv" - self.adb = adb_monitor.Adb(logger=hook_logger) - - def before_test(self, test, test_report): - """Start ADB monitoring.""" - if self.adb: - battery_file = self._report_path(test, "battery.csv") - cpu_file = self._report_path(test, "cpu.json") - memory_file = self._report_path(test, "memory.csv") - self.adb_control = adb_monitor.AdbControl( - self.adb, logger=self.hook_logger, battery_file=battery_file, cpu_file=cpu_file, - memory_file=memory_file, sample_interval_ms=self.sample_interval_ms) - self.hook_logger.info("Starting ADB monitoring for test %s", test.short_name()) - self.hook_logger.info("ADB resource files: %s %s %s", battery_file, cpu_file, - memory_file) - self.adb_control.start() - - def after_test(self, test, test_report): - """Stop ADB monitoring.""" - if self.adb_control: - self.hook_logger.info("Stopping ADB monitoring for test %s", test.short_name()) - self.adb_control.stop() - - def _report_path(self, test, report_name): - """Return the report path. Reports are stored in //thread/.""" - return os.path.join(self.report_root, test.short_name(), "thread{}".format(self.threads), - report_name) diff --git a/buildscripts/resmokelib/testing/hooks/combine_benchrun_embedded_results.py b/buildscripts/resmokelib/testing/hooks/combine_benchrun_embedded_results.py deleted file mode 100644 index b70e57d8741..00000000000 --- a/buildscripts/resmokelib/testing/hooks/combine_benchrun_embedded_results.py +++ /dev/null @@ -1,156 +0,0 @@ -"""Module for generating the test results file fed into the perf plugin.""" - -from __future__ import absolute_import -from __future__ import division - -import collections -import datetime -import glob -import json -import os -import re - -from buildscripts.resmokelib import config as _config -from buildscripts.resmokelib.testing.hooks import combine_benchmark_results as cbr - - -class CombineBenchrunEmbeddedResults(cbr.CombineBenchmarkResults): - """CombineBenchrunEmbeddedResults class. - - The CombineBenchrunEmbeddedResults hook combines test results from - individual benchmark embedded files to a single file. This is useful for - generating the json file to feed into the Evergreen performance - visualization plugin. - """ - - DESCRIPTION = "Combine JSON results from embedded benchrun" - - def __init__(self, hook_logger, fixture): - """Initialize CombineBenchrunEmbeddedResults.""" - cbr.CombineBenchmarkResults.__init__(self, hook_logger, fixture) - self.report_root = _config.BENCHRUN_REPORT_ROOT - - def before_test(self, test, test_report): - """Remove any existing mongoebench reports for this test.""" - for bm_report in self._test_result_files(test): - os.remove(bm_report) - - def after_test(self, test, test_report): - """Update test report.""" - for bm_report in self._test_result_files(test): - test_name = test.short_name() - thread_count = self._parse_report_name(bm_report) - with open(bm_report, "r") as report_file: - report_dict = json.load(report_file) - if test_name not in self.benchmark_reports: - self.benchmark_reports[test_name] = _BenchrunEmbeddedThreadsReport() - self.benchmark_reports[test_name].add_report(thread_count, report_dict) - - def before_suite(self, test_report): - """Set suite start time.""" - self.create_time = datetime.datetime.now() - # Remove any existing perf reports. - if self.report_file and os.path.isfile(self.report_file): - os.remove(self.report_file) - - def _generate_perf_plugin_report(self): - """Format the data to look like a perf plugin report.""" - perf_report = { - "start": self._strftime(self.create_time), - "end": self._strftime(self.end_time), - "errors": [], # There are no errors if we have gotten this far. - "results": [] - } - - for name, report in self.benchmark_reports.items(): - test_report = {"name": name, "results": report.generate_perf_plugin_dict()} - - perf_report["results"].append(test_report) - - return perf_report - - def _test_result_files(self, test): - """Return a list of existing test result files based on the test.short_name().""" - return glob.glob( - os.path.join(self.report_root, test.short_name(), "**", "mongoebench[.]*[.]json")) - - def _parse_report_name(self, report_path): - """Parse mongoebench report path and return thread_count. - - The format of the mongoebench report file name is defined in - ../testing/testcases/benchrun_embedded_test.py - as self.report_root//thread/mongoebench..json - """ - _, report_subpath = report_path.split(self.report_root + os.sep) - _, thread_name, _ = report_subpath.split(os.sep) - return re.findall(r"\d+", thread_name)[0] - - -class _BenchrunEmbeddedThreadsReport(object): - """_BenchrunEmbeddedThreadsReport class. - - Class representation of a report for all thread levels of a single - benchmark test. Each report is designed to correspond to one graph - in the Evergreen perf plugin. - - A raw mongoebench report looks like the following: - { - "note" : "values per second", - "errCount" : { "$numberLong" : "0" }, - "trapped" : "error: not implemented", - "insertLatencyAverageMicros" : 389.4926654182272, - "totalOps" : { "$numberLong" : "12816" }, - "totalOps/s" : 2563.095938304905, - "findOne" : 0, - "insert" : 2563.095938304905, - "delete" : 0, - "update" : 0, - "query" : 0, - "command" : 0, - "findOnes" : { "$numberLong" : "0" }, - "inserts" : { "$numberLong" : "12816" }, - "deletes" : { "$numberLong" : "0" }, - "updates" : { "$numberLong" : "0" }, - "queries" : { "$numberLong" : "0" }, - "commands" : { "$numberLong" : "0" } - } - """ - - def __init__(self): - # list of benchmark runs for each thread. - self.thread_benchmark_map = collections.defaultdict(list) - - def add_report(self, thread_count, report): - """Add to report.""" - self.thread_benchmark_map[thread_count].append(report) - - def generate_perf_plugin_dict(self): - """Generate perf plugin data points of the following format. - - "1": { - "error_values": [ - 0, - 0, - 0 - ], - "ops_per_sec": 9552.108279243452, - "ops_per_sec_values": [ - 9574.812658450564, - 9522.642340821469, - 9536.252775275878 - ] - }, - """ - - res = {} - for thread_count, reports in self.thread_benchmark_map.items(): - thread_report = {"error_values": [], "ops_per_sec_values": []} - - for report in reports: - thread_report["error_values"].append(report["errCount"]["$numberLong"]) - thread_report["ops_per_sec_values"].append(report["totalOps/s"]) - thread_report["ops_per_sec"] = sum(thread_report["ops_per_sec_values"]) / len(reports) - - res[thread_count] = thread_report - - return res diff --git a/buildscripts/resmokelib/testing/testcases/benchrun_embedded_test.py b/buildscripts/resmokelib/testing/testcases/benchrun_embedded_test.py deleted file mode 100644 index 89b95424cdb..00000000000 --- a/buildscripts/resmokelib/testing/testcases/benchrun_embedded_test.py +++ /dev/null @@ -1,149 +0,0 @@ -"""The unittest.TestCase for tests using benchrun embedded (mongoebench).""" - -from __future__ import absolute_import - -import os -import posixpath - -from buildscripts.mobile import adb_monitor -from buildscripts.resmokelib import config as _config -from buildscripts.resmokelib import core -from buildscripts.resmokelib import parser -from buildscripts.resmokelib import utils -from buildscripts.resmokelib.testing.testcases import interface - - -class BenchrunEmbeddedTestCase( # pylint: disable=too-many-instance-attributes - interface.ProcessTestCase): - """A Benchrun embedded test to execute.""" - - REGISTERED_NAME = "benchrun_embedded_test" - - def __init__(self, logger, mongoebench_config_file, program_options=None): - """Initialize the BenchrunEmbeddedTestCase with the executable to run.""" - - interface.ProcessTestCase.__init__(self, logger, "Benchmark embedded test", - mongoebench_config_file) - parser.validate_benchmark_options() - - self.benchrun_config_file = mongoebench_config_file - - # Command line options override the YAML configuration. - self.benchrun_executable = utils.default_if_none(_config.MONGOEBENCH_EXECUTABLE, - _config.DEFAULT_MONGOEBENCH_EXECUTABLE) - self.benchrun_repetitions = utils.default_if_none(_config.BENCHMARK_REPETITIONS, - _config.DEFAULT_BENCHMARK_REPETITIONS) - self.suite_benchrun_options = program_options - self.benchrun_threads = 1 - if program_options and "threads" in program_options: - self.benchrun_threads = program_options["threads"] - self.report_root = _config.BENCHRUN_REPORT_ROOT - self.benchrun_options = {} - - # Set the dbpath. - dbpath = utils.default_if_none(_config.DBPATH_PREFIX, _config.DEFAULT_DBPATH_PREFIX) - self.dbpath = os.path.join(dbpath, "mongoebench") - - self.android_device = _config.BENCHRUN_DEVICE == "Android" - # If Android device, then the test runs via adb shell. - if self.android_device: - self.adb = adb_monitor.Adb() - self.android_benchrun_root = _config.BENCHRUN_EMBEDDED_ROOT - self.device_report_root = posixpath.join(self.android_benchrun_root, "results") - self.dbpath = posixpath.join(self.android_benchrun_root, "db") - self.benchrun_config_file = posixpath.join(self.android_benchrun_root, "testcases", - os.path.basename(self.benchrun_config_file)) - ld_library_path = "LD_LIBRARY_PATH={}".format( - posixpath.join(self.android_benchrun_root, "sdk")) - mongoebench = posixpath.join(self.android_benchrun_root, "sdk", "mongoebench") - self.benchrun_executable = "adb shell {} {}".format(ld_library_path, mongoebench) - - def configure(self, fixture, *args, **kwargs): - """Configure BenchrunEmbeddedTestCase.""" - interface.ProcessTestCase.configure(self, fixture, *args, **kwargs) - - # 1. Set the default benchmark options. - benchrun_options = {"time": _config.DEFAULT_BENCHMARK_MIN_TIME.total_seconds()} - - # 2. Override Benchmark options with options set through `program_options` in the suite - # configuration. - suite_benchrun_options = utils.default_if_none(self.suite_benchrun_options, {}) - benchrun_options.update(suite_benchrun_options) - - # 3. Override Benchmark options with options set through resmoke's command line. - resmoke_benchrun_options = {"dbpath": self.dbpath, "time": _config.BENCHMARK_MIN_TIME} - - for key, value in resmoke_benchrun_options.items(): - if value is not None: - # 4. sanitize options before passing them to Benchmark's command line. - if key == "time": - value = value.total_seconds() - benchrun_options[key] = value - - self.benchrun_options = benchrun_options - - # Create the test report directory. - utils.rmtree(self._report_dir(), ignore_errors=True) - try: - os.makedirs(self._report_dir()) - except os.error: - # Directory already exists. - pass - - # Create the dbpath. - if self.android_device: - self.adb.shell("rm -fr {}".format(self.dbpath)) - self.adb.shell("mkdir {}".format(self.dbpath)) - else: - utils.rmtree(self.dbpath, ignore_errors=True) - try: - os.makedirs(self.dbpath) - except os.error: - # Directory already exists. - pass - - def run_test(self): - """Run the test for specified number of iterations.""" - for iter_num in xrange(self.benchrun_repetitions): - # Set the output file for each iteration. - local_report_path = self._report_path(iter_num) - device_report_path = self._device_report_path(iter_num) - self.benchrun_options["output"] = device_report_path - interface.ProcessTestCase.run_test(self) - self._move_report(device_report_path, local_report_path) - - def _move_report(self, remote_path, local_path): - """Move report from device to local directory.""" - if self.android_device: - # Pull test result from the Android device and then delete it from the device. - self.logger.info("Moving report %s from device to local %s ...", remote_path, - local_path) - self.adb.pull(remote_path, local_path) - self.adb.shell("rm {}".format(remote_path)) - - def _device_report_path(self, iter_num): - """Return the device report path.""" - if self.android_device: - # The mongoebench report is generated on the remote device. - return posixpath.join(self.device_report_root, self._report_name(iter_num)) - return self._report_path(iter_num) - - def _report_path(self, iter_num): - """Return the local report path.""" - return os.path.join(self._report_dir(), self._report_name(iter_num)) - - def _report_dir(self): - """Return the report directory. Reports are stored in //.""" - return os.path.join(self.report_root, self.short_name(), "thread{}".format( - self.benchrun_threads)) - - @staticmethod - def _report_name(iter_num): - """Return the constructed report name of the form mongoebench..json.""" - return "mongoebench.{}.json".format(iter_num) - - def _make_process(self): - # The 'commands' argument for core.programs.generic_program must be a list. - commands = self.benchrun_executable.split() - commands.append(self.benchrun_config_file) - return core.programs.generic_program(self.logger, commands, **self.benchrun_options) diff --git a/buildscripts/tests/mobile/__init__.py b/buildscripts/tests/mobile/__init__.py deleted file mode 100644 index 4b7a2bb941b..00000000000 --- a/buildscripts/tests/mobile/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Empty.""" diff --git a/buildscripts/tests/mobile/test_adb_monitor.py b/buildscripts/tests/mobile/test_adb_monitor.py deleted file mode 100644 index c6680d6dd67..00000000000 --- a/buildscripts/tests/mobile/test_adb_monitor.py +++ /dev/null @@ -1,136 +0,0 @@ -""" Unit tests for adb_monitor. """ - -from __future__ import absolute_import - -import distutils.spawn # pylint: disable=no-name-in-module -import os -import shutil -import sys -import tempfile -import unittest - -import buildscripts.mobile.adb_monitor as adb_monitor - -_IS_WINDOWS = sys.platform == "win32" or sys.platform == "cygwin" - -if _IS_WINDOWS: - import win32file - -# pylint: disable=missing-docstring,protected-access - - -def mock_adb_and_systrace(directory): - """Mock adb and systrace.py.""" - # Create mock 'adb', which is really 'echo'. - adb_binary = os.path.join(directory, "adb") - echo_binary = distutils.spawn.find_executable("echo") - if _IS_WINDOWS: - adb_binary = "{}.exe".format(adb_binary) - shutil.copyfile(echo_binary, adb_binary) - else: - os.symlink(echo_binary, adb_binary) - os.environ["PATH"] = "{}{}{}".format(directory, os.path.pathsep, os.environ["PATH"]) - - # Create mock 'systrace.py'. - systrace_dir = os.path.join(directory, "systrace") - os.mkdir(systrace_dir) - systrace = os.path.join(systrace_dir, "systrace.py") - with open(systrace, "w") as fh: - fh.write("import optparse\n") - fh.write("raw_input('waiting...')\n") - fh.write("print('Wrote trace')\n") - fh.write("parser = optparse.OptionParser()\n") - fh.write("parser.add_option('-o', dest='output_file')\n") - fh.write("parser.add_option('--json', dest='json_opts', action='store_true')\n") - fh.write("options, args = parser.parse_args()\n") - fh.write("with open(options.output_file, 'w') as fh:\n") - fh.write("\tfh.write('{hello:1}')\n") - - -def file_contents(path): - with open(path, "r") as fh: - return fh.read() - - -class AdbTestCase(unittest.TestCase): - @classmethod - def setUpClass(cls): - cls.temp_dir = tempfile.mkdtemp() - mock_adb_and_systrace(cls.temp_dir) - cls.adb = adb_monitor.Adb() - - @classmethod - def tearDownClass(cls): - shutil.rmtree(cls.temp_dir) - - -class AdbTest(AdbTestCase): - def test_bad_adb(self): - self.assertRaises(EnvironmentError, lambda: adb_monitor.Adb("bad_adb")) - - def test_devices(self): - self.adb.devices() - - def test_battery(self): - temp_file = os.path.join(self.temp_dir, "battery_output") - self.adb.battery(output_file=temp_file) - self.assertTrue(os.path.isfile(temp_file)) - - def test_memory(self): - temp_file = os.path.join(self.temp_dir, "memory_output") - self.adb.memory(output_file=temp_file) - self.assertTrue(os.path.isfile(temp_file)) - - def test_systrace(self): - temp_file = os.path.join(self.temp_dir, "systrace_output") - self.adb.systrace_start(output_file=temp_file) - self.adb.systrace_stop() - self.assertTrue(os.path.isfile(temp_file)) - - -class AdbControlTestCase(unittest.TestCase): - @classmethod - def setUpClass(cls): - cls.temp_dir = tempfile.mkdtemp() - mock_adb_and_systrace(cls.temp_dir) - cls.adb = adb_monitor.Adb() - - @classmethod - def tearDownClass(cls): - shutil.rmtree(cls.temp_dir) - - -class AdbControlTest(AdbControlTestCase): - def _test_files(self, num_samples=1, collection_time_secs=0, sample_interval_ms=500, - arg_list=None): - args = {} - arg_file_list = [] - for arg_name in arg_list: - arg_test_file = tempfile.NamedTemporaryFile(delete=False).name - args[arg_name] = arg_test_file - arg_file_list.append(arg_test_file) - adb_control = adb_monitor.AdbControl(self.adb, collection_time_secs=collection_time_secs, - num_samples=num_samples, - sample_interval_ms=sample_interval_ms, **args) - adb_control.start() - adb_control.wait() - for arg_file in arg_file_list: - self.assertGreater(os.stat(arg_file).st_size, 0) - os.remove(arg_file) - - def test_all_files_num_samples(self): - self._test_files(num_samples=5, arg_list=["battery_file", "cpu_file", "memory_file"]) - - def test_all_files_collection_time_secs(self): - self._test_files(collection_time_secs=3, - arg_list=["battery_file", "cpu_file", "memory_file"]) - - def test_all_files_collection_and_samples(self): - self._test_files(collection_time_secs=3, num_samples=5, - arg_list=["battery_file", "cpu_file", "memory_file"]) - - def test_no_file_arg(self): - self.assertRaises(ValueError, lambda: adb_monitor.AdbControl(self.adb)) - - def test_bad_file_arg(self): - self.assertRaises(TypeError, lambda: self._test_files(arg_list=["bad_file_arg"])) diff --git a/buildscripts/tests/resmokelib/testing/hooks/test_combine_benchrun_embedded_results.py b/buildscripts/tests/resmokelib/testing/hooks/test_combine_benchrun_embedded_results.py deleted file mode 100755 index 02248602f4b..00000000000 --- a/buildscripts/tests/resmokelib/testing/hooks/test_combine_benchrun_embedded_results.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env python -"""Unit tests for the resmokelib.testing.hooks.combine_benchrun_embedded_results module.""" - -from __future__ import absolute_import - -import datetime -import os -import unittest - -import mock - -import buildscripts.resmokelib.testing.hooks.combine_benchrun_embedded_results as cber - -# pylint: disable=missing-docstring,protected-access,attribute-defined-outside-init - -_BM_REPORT_INSERT_1 = { - "note": "values per second", "errCount": {"$numberLong": "0"}, - "trapped": "error: not implemented", "insertLatencyAverageMicros": 389.4926654182272, - "totalOps": {"$numberLong": "12816"}, "totalOps/s": 2563.095938304905, "findOne": 0, - "insert": 2563.095938304905, "delete": 0, "update": 0, "query": 0, "command": 0, "findOnes": { - "$numberLong": "0" - }, "inserts": {"$numberLong": "12816"}, "deletes": {"$numberLong": "0"}, "updates": { - "$numberLong": "0" - }, "queries": {"$numberLong": "0"}, "commands": {"$numberLong": "0"} -} - -_BM_REPORT_INSERT_2 = { - "note": "values per second", "errCount": {"$numberLong": "0"}, - "trapped": "error: not implemented", "insertLatencyAverageMicros": 2563.095938304905, - "totalOps": {"$numberLong": "7404"}, "totalOps/s": 2409.05, "findOne": 0, "insert": 2409.05, - "delete": 0, "update": 0, "query": 0, "command": 0, "findOnes": {"$numberLong": "0"}, - "inserts": {"$numberLong": "7404"}, "deletes": {"$numberLong": "0"}, "updates": { - "$numberLong": "0" - }, "queries": {"$numberLong": "0"}, "commands": {"$numberLong": "0"} -} - -_BM_REPORT_DELETE = { - "note": "values per second", "errCount": {"$numberLong": "0"}, - "trapped": "error: not implemented", "insertLatencyAverageMicros": "1234.56", "totalOps": { - "$numberLong": "2345" - }, "totalOps/s": 1234.56, "findOne": 0, "insert": 0, "delete": 1234.56, "update": 0, "query": 0, - "command": 0, "findOnes": {"$numberLong": "0"}, "inserts": {"$numberLong": "0"}, "deletes": { - "$numberLong": "2345" - }, "updates": {"$numberLong": "0"}, "queries": {"$numberLong": "0"}, - "commands": {"$numberLong": "0"} -} - -_BM_REPORT_UPDATE = { - "note": "values per second", "errCount": {"$numberLong": "0"}, - "trapped": "error: not implemented", "insertLatencyAverageMicros": 654.321, "totalOps": { - "$numberLong": "4521" - }, "totalOps/s": 4521.00, "findOne": 0, "insert": 0, "delete": 0, "update": 4521.00, "query": 0, - "command": 0, "findOnes": {"$numberLong": "0"}, "inserts": {"$numberLong": "0"}, "deletes": { - "$numberLong": "0" - }, "updates": {"$numberLong": "4521"}, "queries": {"$numberLong": "0"}, - "commands": {"$numberLong": "0"} -} - -_BM_REPORT_MULTI = { - "note": "values per second", "errCount": {"$numberLong": "0"}, - "trapped": "error: not implemented", "insertLatencyAverageMicros": 111.111, "totalOps": { - "$numberLong": "11532" - }, "totalOps/s": 5766.00, "findOne": 0, "insert": 2490.00, "delete": 0, "update": 9042.00, - "query": 0, "command": 0, "findOnes": {"$numberLong": "0"}, "inserts": { - "$numberLong": "2490.00" - }, "deletes": {"$numberLong": "0"}, "updates": {"$numberLong": "9042"}, - "queries": {"$numberLong": "0"}, "commands": {"$numberLong": "0"} -} - -_BM_ALL_REPORTS = [ - _BM_REPORT_INSERT_1, _BM_REPORT_INSERT_2, _BM_REPORT_DELETE, _BM_REPORT_UPDATE, _BM_REPORT_MULTI -] - -# 12/31/2999 @ 11:59pm (UTC) -_START_TIME = 32503679999 - -# 01/01/3000 @ 12:00am (UTC) -_END_TIME = 32503680000 - - -class CombineBenchrunEmbeddedResultsFixture(unittest.TestCase): - - # Mock the hook's parent class because we're testing only functionality of this hook and - # not anything related to or inherit from the parent class. - @mock.patch("buildscripts.resmokelib.testing.hooks.interface.Hook", autospec=True) - def setUp(self, MockHook): # pylint: disable=arguments-differ,unused-argument - self.cber_hook = cber.CombineBenchrunEmbeddedResults(None, None) - self.cber_hook.create_time = datetime.datetime.utcfromtimestamp(_START_TIME) - self.cber_hook.end_time = datetime.datetime.utcfromtimestamp(_END_TIME) - - -class TestCombineBenchmarkResults(CombineBenchrunEmbeddedResultsFixture): - def _setup_reports(self, reports, test_name, num_threads): - self.total_ops_per_sec = 0 - self.num_tests = len(reports) - self.cber_hook.benchmark_reports[test_name] = cber._BenchrunEmbeddedThreadsReport() - for rep in reports: - self.cber_hook.benchmark_reports[test_name].add_report(num_threads, rep) - self.total_ops_per_sec += rep["totalOps/s"] - self.ops_per_sec = self.total_ops_per_sec / self.num_tests - self.report = self.cber_hook._generate_perf_plugin_report() - - def test_generate_one_report(self): - test_name = "test_cber1" - num_threads = "2" - self._setup_reports([_BM_REPORT_MULTI], test_name, num_threads) - report_0 = self.report["results"][0] - self.assertEqual(report_0["name"], test_name) - self.assertEqual(report_0["results"][str(num_threads)]["ops_per_sec"], self.ops_per_sec) - - def test_generate_all_reports(self): - test_name = "test_cber2" - thread_num = "1" - self._setup_reports(_BM_ALL_REPORTS, test_name, thread_num) - self.assertEqual(len(self.report.keys()), 4) - report_0 = self.report["results"][0] - self.assertEqual(report_0["name"], test_name) - self.assertEqual(report_0["results"][thread_num]["ops_per_sec"], self.ops_per_sec) - self.assertEqual(self.report["start"], "2999-12-31T23:59:59Z") - self.assertEqual(self.report["end"], "3000-01-01T00:00:00Z") - - def test_parse_report_name(self): - self.cber_hook.report_root = os.path.join("benchrun_embedded", "results") - test_name = "test1" - thread_num = 3 - file_name = os.path.join(self.cber_hook.report_root, test_name, - "thread{}".format(thread_num), "mongoebench.0.json") - report_threads = self.cber_hook._parse_report_name(file_name) - self.assertEqual(thread_num, int(report_threads)) - - -class TestBenchrunEmbeddedThreadsReport(CombineBenchrunEmbeddedResultsFixture): - def test_generate_single_thread_perf_plugin_dict(self): - thread_report = cber._BenchrunEmbeddedThreadsReport() - thread_num = "1" - thread_report.add_report(thread_num, _BM_REPORT_INSERT_1) - perf_report = thread_report.generate_perf_plugin_dict() - self.assertEqual(len(perf_report.keys()), 1) - self.assertEqual(perf_report[thread_num]["ops_per_sec"], _BM_REPORT_INSERT_1["totalOps/s"]) - self.assertEqual(len(perf_report[thread_num]["ops_per_sec_values"]), 1) - - thread_report.add_report(thread_num, _BM_REPORT_INSERT_2) - perf_report = thread_report.generate_perf_plugin_dict() - self.assertEqual(len(perf_report.keys()), 1) - ops_per_sec = (_BM_REPORT_INSERT_1["totalOps/s"] + _BM_REPORT_INSERT_2["totalOps/s"]) / 2 - self.assertEqual(perf_report[thread_num]["ops_per_sec"], ops_per_sec) - self.assertEqual(len(perf_report[thread_num]["ops_per_sec_values"]), 2) - - def test_generate_multi_thread_perf_plugin_dict(self): - thread_report = cber._BenchrunEmbeddedThreadsReport() - thread_num = "1" - thread_report.add_report(thread_num, _BM_REPORT_INSERT_1) - perf_report = thread_report.generate_perf_plugin_dict() - self.assertEqual(len(perf_report.keys()), 1) - self.assertEqual(perf_report[thread_num]["ops_per_sec"], _BM_REPORT_INSERT_1["totalOps/s"]) - self.assertEqual(len(perf_report[thread_num]["ops_per_sec_values"]), 1) - - thread_num = "2" - thread_report.add_report(thread_num, _BM_REPORT_INSERT_2) - perf_report = thread_report.generate_perf_plugin_dict() - self.assertEqual(len(perf_report.keys()), 2) - self.assertEqual(perf_report["1"]["ops_per_sec"], _BM_REPORT_INSERT_1["totalOps/s"]) - self.assertEqual(len(perf_report["1"]["ops_per_sec_values"]), 1) - self.assertEqual(perf_report[thread_num]["ops_per_sec"], _BM_REPORT_INSERT_2["totalOps/s"]) - self.assertEqual(len(perf_report[thread_num]["ops_per_sec_values"]), 1) diff --git a/etc/evergreen.yml b/etc/evergreen.yml index a1aa1ae9d9a..ef79fbbe96b 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -70,18 +70,6 @@ variables: resmoke_jobs_max: 1 - func: "send benchmark results" -- &benchrun_embedded_template - name: benchrun_embedded_template - depends_on: - - generate_benchrun_embedded_files - commands: - - func: "do benchmark embedded setup" - - func: "run tests" - vars: - resmoke_args: --help - resmoke_jobs_max: 1 - - func: "send benchmark results" - - &jepsen_config_vars jepsen_key_time_limit: --key-time-limit 15 jepsen_protocol_version: --protocol-version 1 @@ -181,19 +169,6 @@ variables: mongod_options: --mongodUsablePorts ${standard_port} ${secret_port} --dbPath=${db_path} --logPath=${log_path} mongod_extra_options: --mongodOptions=\"--setParameter enableTestCommands=1 --setParameter logComponentVerbosity='{storage:{recovery:2}}'\" -- &benchrun_embedded - name: benchrun_embedded - execution_tasks: - - benchrun_embedded_aggregation - - benchrun_embedded_commands - - benchrun_embedded_insert - - benchrun_embedded_misc - - benchrun_embedded_mixed_and_multi - - benchrun_embedded_queries - - benchrun_embedded_remove - - benchrun_embedded_update - - generate_benchrun_embedded_files - - &compile_task_group_template name: compile_task_group_template max_hosts: 1 @@ -445,15 +420,6 @@ functions: bucket: mciuploads extract_to: src - "fetch benchrun embedded files" : &fetch_benchrun_embedded_files - command: s3.get - params: - aws_key: ${aws_key} - aws_secret: ${aws_secret} - remote_file: ${project}/${build_variant}/${revision}/benchrun_json_files.tgz - bucket: mciuploads - extract_to: src/benchrun_embedded/testcases - "get buildnumber" : &get_buildnumber command: keyval.inc params: @@ -883,13 +849,6 @@ functions: - *set_up_credentials - *fetch_benchmarks - "do benchmark embedded setup" : - - *git_get_project - - *fetch_artifacts - - *get_buildnumber - - *set_up_credentials - - *fetch_benchrun_embedded_files - "set up virtualenv" : command: shell.exec type: test @@ -3221,8 +3180,6 @@ tasks: - "./test*" - "./dbtest*" - "./mongobridge*" - - "./mongoebench*" - - "./mongoed*" - "buildscripts/**" - "*Example" - "*Test" @@ -3706,143 +3663,6 @@ tasks: resmoke_jobs_max: 1 - func: "send benchmark results" -- <<: *task_template - name: generate_benchrun_embedded_files - commands: - - func: "git get project" - - func: "fetch binaries" - - func: "extract binaries" - - command: shell.exec - params: - working_dir: src - script: | - set -o errexit - set -o verbose - - ${activate_virtualenv} - - mkdir -p /data/db - rm -rf /data/db/* - - ./mongod --fork --logpath=/data/db/mongod.log - PATH="$(pwd):$PATH" ./src/third_party/scripts/mongo-perf_get_sources.sh - ./mongo --eval 'db.getSiblingDB("admin").shutdownServer()' - - command: archive.targz_pack - params: - target: "src/benchrun_json_files.tgz" - source_dir: "${workdir}/src/benchrun_embedded/testcases" - include: - - "**.json" - - command: s3.put - params: - aws_key: ${aws_key} - aws_secret: ${aws_secret} - local_file: src/benchrun_json_files.tgz - remote_file: ${project}/${build_variant}/${revision}/benchrun_json_files.tgz - bucket: mciuploads - permissions: public-read - content_type: ${content_type|application/gzip} - display_name: benchrun embedded JSON config files - -- <<: *task_template - name: upload_benchrun_embedded_files - depends_on: - - generate_benchrun_embedded_files - patchable: false - commands: - - command: s3Copy.copy - params: - aws_key: ${aws_key} - aws_secret: ${aws_secret} - s3_copy_files: - - source: - path: ${project}/${build_variant}/${revision}/benchrun_json_files.tgz - bucket: mciuploads - destination: - path: ${project}/benchrun_embedded/benchrun_json_files.tgz - bucket: mciuploads - build_variants: [rhel-62-64-bit-mobile] - -- <<: *benchrun_embedded_template - name: benchrun_embedded_aggregation - commands: - - func: "do benchmark embedded setup" - - func: "run tests" - vars: - resmoke_args: --suites=benchrun_embedded_aggregation - resmoke_jobs_max: 1 - - func: "send benchmark results" - -- <<: *benchrun_embedded_template - name: benchrun_embedded_commands - commands: - - func: "do benchmark embedded setup" - - func: "run tests" - vars: - resmoke_args: --suites=benchrun_embedded_commands - resmoke_jobs_max: 1 - - func: "send benchmark results" - -- <<: *benchrun_embedded_template - name: benchrun_embedded_insert - commands: - - func: "do benchmark embedded setup" - - func: "run tests" - vars: - resmoke_args: --suites=benchrun_embedded_insert - resmoke_jobs_max: 1 - - func: "send benchmark results" - -- <<: *benchrun_embedded_template - name: benchrun_embedded_misc - commands: - - func: "do benchmark embedded setup" - - func: "run tests" - vars: - resmoke_args: --suites=benchrun_embedded_misc - resmoke_jobs_max: 1 - - func: "send benchmark results" - -- <<: *benchrun_embedded_template - name: benchrun_embedded_mixed_and_multi - commands: - - func: "do benchmark embedded setup" - - func: "run tests" - vars: - resmoke_args: --suites=benchrun_embedded_mixed_and_multi - resmoke_jobs_max: 1 - - func: "send benchmark results" - -- <<: *benchrun_embedded_template - name: benchrun_embedded_queries - commands: - - func: "do benchmark embedded setup" - - func: "run tests" - vars: - resmoke_args: --suites=benchrun_embedded_queries - resmoke_jobs_max: 1 - - func: "send benchmark results" - -- <<: *benchrun_embedded_template - name: benchrun_embedded_remove - commands: - - func: "do benchmark embedded setup" - - func: "run tests" - vars: - resmoke_args: --suites=benchrun_embedded_remove - resmoke_jobs_max: 1 - - func: "send benchmark results" - -- <<: *benchrun_embedded_template - name: benchrun_embedded_update - commands: - - func: "do benchmark embedded setup" - - func: "run tests" - vars: - resmoke_args: --suites=benchrun_embedded_update - resmoke_jobs_max: 1 - - func: "send benchmark results" - - <<: *run_jepsen_template name: jepsen_register_findAndModify_WT commands: @@ -4660,14 +4480,6 @@ tasks: vars: resmoke_args: --suites=core --storageEngine=wiredTiger -- <<: *task_template - name: jsCore_mobile - commands: - - func: "do setup" - - func: "run tests" - vars: - resmoke_args: --suites=core --mongod=./mongoed --excludeWithAnyTags=requires_scripting,requires_auth,requires_sharding,does_not_support_stepdowns,requires_eval_command,requires_background_index,requires_ttl_index,incompatible_with_embedded,incompatible_with_embedded_todo_investigate,requires_replication,requires_capped,requires_profiling,requires_compact - - <<: *task_template name: jsCore_ese depends_on: @@ -10625,205 +10437,6 @@ buildvariants: - name: write_concern_majority_passthrough - name: secondary_reads_passthrough_gen -- name: rhel-62-64-bit-mobile - display_name: RHEL 6.2 (mobile) - run_on: - - rhel62-small - batchtime: 1440 # 1 day - expansions: &rhel-62-64-bit-mobile-expansions - # Transactions are only supported on replica sets, and replication is not supported by the - # mobile storage engine. - test_flags: >- - --storageEngine=mobile - --excludeWithAnyTags=requires_mmapv1,requires_wiredtiger,requires_replication,requires_sharding,uses_transactions,requires_capped,requires_profiling,requires_compact - --excludeWithAnyTags=SERVER-32869,SERVER-40561 - compile_flags: >- - -j$(grep -c ^processor /proc/cpuinfo) - --mobile-se=on - --variables-files=etc/scons/mongodbtoolchain_gcc.vars - CPPPATH="/opt/basis/rlp/rlp/include /opt/basis/rlp/utilities/include" - MONGO_DISTMOD=rhel62 - scons_cache_scope: shared - build_mongoreplay: true - additional_targets: mongoebench mongoed - display_tasks: - - *benchrun_embedded - tasks: - - name: compile_all_run_unittests_TG - distros: - - rhel62-large - - name: aggregation - - name: aggregation_auth - - name: aggregation_facet_unwind_passthrough - - name: auth_gen - - name: concurrency - - name: benchrun_embedded_aggregation - distros: - - centos6-perf - - name: benchrun_embedded_commands - distros: - - centos6-perf - - name: benchrun_embedded_insert - distros: - - centos6-perf - - name: benchrun_embedded_misc - distros: - - centos6-perf - - name: benchrun_embedded_mixed_and_multi - distros: - - centos6-perf - - name: benchrun_embedded_queries - distros: - - centos6-perf - - name: benchrun_embedded_remove - distros: - - centos6-perf - - name: benchrun_embedded_update - distros: - - centos6-perf - - name: disk_mobile - - name: failpoints - - name: failpoints_auth - - name: generate_benchrun_embedded_files - - name: integration_tests_standalone - - name: jsCore - - name: jsCore_auth - - name: jsCore_compatibility - - name: jsCore_decimal - - name: jsCore_minimum_batch_size - - name: jsCore_mobile - - name: jsCore_op_query - - name: jsonSchema - - name: jstestfuzz_gen - - name: jstestfuzz_concurrent_gen - - name: noPassthrough_gen - - name: noPassthroughWithMongod_gen - - name: powercycle_mobile - - name: serial_run - - name: session_jscore_passthrough - - name: upload_benchrun_embedded_files - -- name: ubuntu1604-arm64-mobile - display_name: "Ubuntu 16.04 arm64 (mobile)" - run_on: - - ubuntu1604-arm64-large - batchtime: 1440 # 1 day - expansions: - test_flags: >- - --storageEngine=mobile - --excludeWithAnyTags=requires_mmapv1,requires_wiredtiger,requires_replication,requires_sharding,uses_transactions,requires_capped,requires_profiling,requires_compact - --excludeWithAnyTags=SERVER-32869,SERVER-40561 - compile_flags: >- - -j$(grep -c ^processor /proc/cpuinfo) - --mobile-se=on - --release - --variables-files=etc/scons/mongodbtoolchain_gcc.vars - CCFLAGS="-march=armv8-a+crc -mtune=generic" - MONGO_DISTMOD=ubuntu1604 - resmoke_jobs_max: 8 # Avoid starting too many mongod's on ARM test servers - build_mongoreplay: true - additional_targets: mongoebench mongoed - tasks: - - name: compile_all_run_unittests_TG - - name: aggregation - - name: aggregation_auth - - name: aggregation_facet_unwind_passthrough - - name: auth_gen - - name: concurrency - - name: disk_mobile - - name: failpoints - - name: failpoints_auth - - name: integration_tests_standalone - - name: jsCore - - name: jsCore_auth - - name: jsCore_compatibility - - name: jsCore_decimal - - name: jsCore_minimum_batch_size - - name: jsCore_mobile - - name: jsCore_op_query - - name: jsonSchema - - name: jstestfuzz_gen - - name: jstestfuzz_concurrent_gen - - name: noPassthrough_gen - - name: noPassthroughWithMongod_gen - - name: serial_run - - name: session_jscore_passthrough - -- name: rhel-62-64-bit-required-mobile - display_name: "! RHEL 6.2 (mobile)" - run_on: - - rhel62-small - expansions: - <<: *rhel-62-64-bit-mobile-expansions - burn_in_tests_build_variant: rhel-62-64-bit-mobile - tasks: - # This build variant exists specifically to test that newly added or modified JavaScript tests are - # correctly tagged with "requires_replication" and "requires_sharding" prior to the changes being - # pushed. It uses the task list from the rhel-62-64-bit-mobile build variant to - # determine the resmoke.py YAML suite configurations to run the tests under. Do not add more tasks - # to this list. - - name: compile_TG - requires: - - name: burn_in_tests - distros: - - rhel62-large - - name: burn_in_tests - - name: jsCore_mobile - -- name: osx-1010-mobile - display_name: macOS 10.10 (mobile) - run_on: - - macos-1012 - batchtime: 1440 # 1 day - expansions: - push_path: osx - push_bucket: downloads.10gen.com - push_name: osx - push_arch: x86_64 - # Transactions are only supported on replica sets, and replication is not supported by the - # mobile storage engine. - test_flags: >- - --storageEngine=mobile - --excludeWithAnyTags=requires_mmapv1,requires_wiredtiger,requires_replication,requires_sharding,uses_transactions,requires_capped,requires_profiling,requires_compact - --excludeWithAnyTags=SERVER-32869,SERVER-40561 - compile_env: DEVELOPER_DIR=/Applications/Xcode8.3.app - compile_flags: >- - -j$(sysctl -n hw.logicalcpu) - --libc++ - --mobile-se=on - --release - CCFLAGS="-mmacosx-version-min=10.10" - CPPPATH=/opt/mongodbtoolchain/v2/include - LINKFLAGS="-mmacosx-version-min=10.10" - resmoke_jobs_max: 1 - build_mongoreplay: true - additional_targets: mongoebench mongoed - tasks: - - name: compile_all_run_unittests_TG - - name: aggregation - - name: aggregation_auth - - name: aggregation_facet_unwind_passthrough - - name: auth_gen - - name: concurrency - - name: disk_mobile - - name: failpoints - - name: failpoints_auth - - name: integration_tests_standalone - - name: jsCore - - name: jsCore_auth - - name: jsCore_compatibility - - name: jsCore_decimal - - name: jsCore_minimum_batch_size - - name: jsCore_mobile - - name: jsCore_op_query - - name: jsonSchema - - name: jstestfuzz_gen - - name: jstestfuzz_concurrent_gen - - name: noPassthrough_gen - - name: noPassthroughWithMongod_gen - - name: serial_run - - name: session_jscore_passthrough - - name: linux-64-ephemeralForTest display_name: Linux (ephemeralForTest) run_on: diff --git a/jstests/core_standalone/write_concern.js b/jstests/core_standalone/write_concern.js index fd4036e6925..5c7846c7905 100644 --- a/jstests/core_standalone/write_concern.js +++ b/jstests/core_standalone/write_concern.js @@ -1,4 +1,4 @@ -// This test verifies writeConcern behavior on a standalone mongod or embedded mongoed. +// This test verifies writeConcern behavior on a standalone mongod. (function() { 'use strict'; @@ -15,4 +15,4 @@ assert.writeError(col.insert({_id: 2}, {writeConcern: {w: 2}}), "expected writeConcern: 2 to fail"); -})(); \ No newline at end of file +})(); diff --git a/jstests/libs/mongoebench.js b/jstests/libs/mongoebench.js deleted file mode 100644 index f6feb4eb9f0..00000000000 --- a/jstests/libs/mongoebench.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; - -var {runMongoeBench} = (function() { - - /** - * Spawns a mongoebench process with the specified options. - * - * If a plain JavaScript object is specified as the 'config' parameter, then it is serialized to - * a file as a JSON string which is then specified as the config file for the mongoebench - * process. - */ - function runMongoeBench(config, options = {}) { - const args = ["mongoebench"]; - - if (typeof config === "object") { - const filename = MongoRunner.dataPath + "mongoebench_config.json"; - writeFile(filename, tojson(config)); - args.push(filename); - } else if (typeof config === "string") { - args.push(config); - } else { - throw new Error("'config' parameter must be a string or an object"); - } - - if (!options.hasOwnProperty("dbpath")) { - options.dbpath = MongoRunner.dataDir; - } - - for (let key of Object.keys(options)) { - const value = options[key]; - if (value === null || value === undefined) { - throw new Error( - "Value '" + value + "' for '" + key + - "' option is ambiguous; specify {flag: ''} to add --flag command line" + - " options'"); - } - - args.push("--" + key); - if (value !== "") { - args.push(value.toString()); - } - } - - const exitCode = _runMongoProgram(...args); - assert.eq(0, exitCode, "encountered an error in mongoebench"); - } - - return {runMongoeBench}; -})(); diff --git a/jstests/noPassthrough/mongoebench_test.js b/jstests/noPassthrough/mongoebench_test.js deleted file mode 100644 index 1ae0e6ba29f..00000000000 --- a/jstests/noPassthrough/mongoebench_test.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Tests for the mongoebench executable. - */ -(function() { - "use strict"; - - load("jstests/libs/mongoebench.js"); // for runMongoeBench - - if (jsTest.options().storageEngine !== "mobile") { - print("Skipping test because storage engine isn't mobile"); - return; - } - - const dbpath = MongoRunner.dataPath + "mongoebench_test"; - resetDbpath(dbpath); - - // Test that the operations in the "pre" section of the configuration are run exactly once. - runMongoeBench( // Force clang-format to break this line. - { - pre: [{ - op: "insert", - ns: "test.mongoebench_test", - doc: {pre: {"#SEQ_INT": {seq_id: 0, start: 0, step: 1, unique: true}}} - }], - ops: [{ - op: "update", - ns: "test.mongoebench_test", - update: {$inc: {ops: 1}}, - multi: true, - }] - }, - {dbpath}); - - const output = cat(dbpath + "/perf.json"); - const stats = assert.doesNotThrow( - JSON.parse, [output], "failed to parse output file as strict JSON: " + output); - assert.eq({$numberLong: "0"}, - stats.errCount, - () => "stats file reports errors but exit code was zero: " + tojson(stats)); - assert(stats.hasOwnProperty("totalOps/s"), - () => "stats file doesn't report ops per second: " + tojson(stats)); - - const conn = MongoRunner.runMongod({dbpath, noCleanData: true}); - assert.neq(null, conn, "failed to start mongod after running mongoebench"); - - const db = conn.getDB("test"); - const count = db.mongoebench_test.find().itcount(); - assert.eq(1, count, "ops in 'pre' section ran more than once or didn't run at all"); - - MongoRunner.stopMongod(conn); -})(); diff --git a/src/mongo/db/ftdc/ftdc_system_stats_android.cpp b/src/mongo/db/ftdc/ftdc_system_stats_android.cpp deleted file mode 100644 index 1e276898613..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_android.cpp +++ /dev/null @@ -1,129 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/basic.h" - -#include "mongo/db/ftdc/ftdc_system_stats.h" - -#include -#include - -#include "mongo/base/status.h" -#include "mongo/base/string_data.h" -#include "mongo/bson/bsonobjbuilder.h" -#include "mongo/db/ftdc/collector.h" -#include "mongo/db/ftdc/controller.h" -#include "mongo/stdx/memory.h" -#include "mongo/util/processinfo.h" -#include "mongo/util/procparser.h" - -namespace mongo { - -namespace { - -static const std::vector kCpuKeys{ - "btime"_sd, "cpu"_sd, "ctxt"_sd, "processes"_sd, "procs_blocked"_sd, "procs_running"_sd}; - -static const std::vector kMemKeys{ - "MemTotal"_sd, - "MemFree"_sd, - "Cached"_sd, - "Dirty"_sd, - "Buffers"_sd, - "SwapTotal"_sd, - "SwapCached"_sd, - "SwapFree"_sd, - "Active"_sd, - "Inactive"_sd, - "Active(anon)"_sd, - "Inactive(anon)"_sd, - "Active(file)"_sd, - "Inactive(file)"_sd, -}; - -/** - * Collect metrics from the Linux /proc file system. - */ -class LinuxSystemMetricsCollector final : public SystemMetricsCollector { -public: - LinuxSystemMetricsCollector() : _disks(procparser::findPhysicalDisks("/sys/block"_sd)) { - for (const auto& disk : _disks) { - _disksStringData.emplace_back(disk); - } - } - - void collect(OperationContext* opCtx, BSONObjBuilder& builder) override { - { - BSONObjBuilder subObjBuilder(builder.subobjStart("cpu"_sd)); - - // Include the number of cpus to simplify client calculations - ProcessInfo p; - subObjBuilder.append("num_cpus", p.getNumCores()); - - processStatusErrors( - procparser::parseProcStatFile("/proc/stat"_sd, kCpuKeys, &subObjBuilder), - &subObjBuilder); - subObjBuilder.doneFast(); - } - - { - BSONObjBuilder subObjBuilder(builder.subobjStart("memory"_sd)); - processStatusErrors( - procparser::parseProcMemInfoFile("/proc/meminfo"_sd, kMemKeys, &subObjBuilder), - &subObjBuilder); - subObjBuilder.doneFast(); - } - - // Skip the disks section if we could not find any disks. - // This can happen when we do not have permission to /sys/block for instance. - if (!_disksStringData.empty()) { - BSONObjBuilder subObjBuilder(builder.subobjStart("disks"_sd)); - processStatusErrors(procparser::parseProcDiskStatsFile( - "/proc/diskstats"_sd, _disksStringData, &subObjBuilder), - &subObjBuilder); - subObjBuilder.doneFast(); - } - } - -private: - // List of physical disks to collect stats from as string from findPhysicalDisks. - std::vector _disks; - - // List of physical disks to collect stats from as StringData to pass to parseProcDiskStatsFile. - std::vector _disksStringData; -}; - -} // namespace - -void installSystemMetricsCollector(FTDCController* controller) { - controller->addPeriodicCollector(stdx::make_unique()); -} - -} // namespace mongo diff --git a/src/mongo/db/ftdc/ftdc_system_stats_iOS-sim.cpp b/src/mongo/db/ftdc/ftdc_system_stats_iOS-sim.cpp deleted file mode 100644 index 10eab9ee385..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_iOS-sim.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/db/ftdc/ftdc_system_stats_osx.cpp" diff --git a/src/mongo/db/ftdc/ftdc_system_stats_iOS.cpp b/src/mongo/db/ftdc/ftdc_system_stats_iOS.cpp deleted file mode 100644 index 10eab9ee385..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_iOS.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/db/ftdc/ftdc_system_stats_osx.cpp" diff --git a/src/mongo/db/ftdc/ftdc_system_stats_tvOS-sim.cpp b/src/mongo/db/ftdc/ftdc_system_stats_tvOS-sim.cpp deleted file mode 100644 index 10eab9ee385..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_tvOS-sim.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/db/ftdc/ftdc_system_stats_osx.cpp" diff --git a/src/mongo/db/ftdc/ftdc_system_stats_tvOS.cpp b/src/mongo/db/ftdc/ftdc_system_stats_tvOS.cpp deleted file mode 100644 index 10eab9ee385..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_tvOS.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/db/ftdc/ftdc_system_stats_osx.cpp" diff --git a/src/mongo/embedded/SConscript b/src/mongo/embedded/SConscript index d0998905281..7589b735829 100644 --- a/src/mongo/embedded/SConscript +++ b/src/mongo/embedded/SConscript @@ -124,32 +124,3 @@ env.Library( '$BUILD_DIR/mongo/util/options_parser/options_parser', ], ) - -if get_option('link-model') != 'dynamic-sdk': - mongoed = yamlEnv.Program( - target='mongoed', - source=[ - 'mongoed_main.cpp', - ], - LIBDEPS=[ - '$BUILD_DIR/mongo/db/commands/shell_protocol', - '$BUILD_DIR/mongo/db/mongod_options', - '$BUILD_DIR/mongo/db/server_options', - '$BUILD_DIR/mongo/db/repl/repl_set_status_commands', - '$BUILD_DIR/mongo/embedded/embedded', - '$BUILD_DIR/mongo/embedded/embedded_integration_helpers', - '$BUILD_DIR/mongo/transport/service_entry_point', - '$BUILD_DIR/mongo/transport/transport_layer_manager', - '$BUILD_DIR/mongo/util/signal_handlers', - ], - INSTALL_ALIAS=[ - 'embedded-test', - ], - ) - - env.Alias('all', mongoed) # This ensures it compiles and links, but doesn't copy it anywhere. - - hygienic = get_option('install-mode') == 'hygienic' - - if not hygienic: - env.Install('#/', mongoed) diff --git a/src/mongo/embedded/mongo_embedded/java/embedded-android/AndroidManifest.xml b/src/mongo/embedded/mongo_embedded/java/embedded-android/AndroidManifest.xml deleted file mode 100644 index 8d3ffd30527..00000000000 --- a/src/mongo/embedded/mongo_embedded/java/embedded-android/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - diff --git a/src/mongo/embedded/mongo_embedded/java/embedded-android/build.gradle b/src/mongo/embedded/mongo_embedded/java/embedded-android/build.gradle deleted file mode 100644 index 9c81b4e01c5..00000000000 --- a/src/mongo/embedded/mongo_embedded/java/embedded-android/build.gradle +++ /dev/null @@ -1,95 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'optional-base' -apply plugin: 'maven' -apply plugin: 'signing' - -android { - compileSdkVersion 28 - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 28 - } - - buildTypes { - release { - minifyEnabled false - } - } - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDir '../src' - jniLibs.srcDirs '../jniLibs' - } - } -} - -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' -} - -dependencies { - api "net.java.dev.jna:jna:$jnaVersion@aar" - api 'org.slf4j:slf4j-api:1.7.6', optional -} - -artifacts { - archives sourcesJar -} - -signing { - sign configurations.archives -} - -uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } - - snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } - - pom.project { - name "${libraryName}-android" - packaging 'aar' - description "${pomDescription} - Android" - url pomUrl - - scm { - connection "scm:${pomScmConnection}" - developerConnection "scm:${pomScmConnection}" - url pomScmUrl - } - - licenses { - license { - name pomLicenseName - url pomLicenseUrl - } - } - - developers { - developer { - id 'mongodb' - name 'MongoDB Inc.' - email 'build@mongodb.com' - } - } - } - } - } -} - -def deployer = uploadArchives.repositories.mavenDeployer -deployer.pom*.whenConfigured { pom -> - pom.dependencies.find { dep -> dep.groupId == 'org.slf4j' }.optional = true -} - diff --git a/src/mongo/embedded/mongoed_main.cpp b/src/mongo/embedded/mongoed_main.cpp deleted file mode 100644 index 5c6264b32ee..00000000000 --- a/src/mongo/embedded/mongoed_main.cpp +++ /dev/null @@ -1,158 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault - -#include "mongo/platform/basic.h" - -#include "mongo/base/init.h" -#include "mongo/db/mongod_options.h" -#include "mongo/db/service_context.h" -#include "mongo/embedded/embedded.h" -#include "mongo/embedded/embedded_options.h" -#include "mongo/embedded/embedded_options_helpers.h" -#include "mongo/embedded/service_entry_point_embedded.h" -#include "mongo/transport/service_entry_point_impl.h" -#include "mongo/transport/transport_layer.h" -#include "mongo/transport/transport_layer_manager.h" -#include "mongo/util/exit.h" -#include "mongo/util/log.h" -#include "mongo/util/options_parser/options_parser.h" -#include "mongo/util/options_parser/startup_options.h" -#include "mongo/util/signal_handlers.h" -#include "mongo/util/text.h" - -#include - -namespace mongo { -namespace { - -class ServiceEntryPointMongoe : public ServiceEntryPointImpl { -public: - explicit ServiceEntryPointMongoe(ServiceContext* svcCtx) - : ServiceEntryPointImpl(svcCtx), - _sepEmbedded(std::make_unique()) {} - - DbResponse handleRequest(OperationContext* opCtx, const Message& request) final { - return _sepEmbedded->handleRequest(opCtx, request); - } - -private: - std::unique_ptr _sepEmbedded; -}; - -MONGO_INITIALIZER_WITH_PREREQUISITES(SignalProcessingStartup, ("ThreadNameInitializer")) -(InitializerContext*) { - // Make sure we call this as soon as possible but before any other threads are started. Before - // embedded::initialize is too early and after is too late. So instead we hook in during the - // global initialization at the right place. - startSignalProcessingThread(); - return Status::OK(); -} - -int mongoedMain(int argc, char* argv[], char** envp) { - ServiceContext* serviceContext = nullptr; - - registerShutdownTask([&]() { - if (!serviceContext) - return; - - if (auto tl = serviceContext->getTransportLayer()) { - log(logger::LogComponent::kNetwork) << "shutdown: going to close listening sockets..."; - tl->shutdown(); - } - - if (auto sep = serviceContext->getServiceEntryPoint()) { - if (sep->shutdown(Seconds(10))) { - embedded::shutdown(serviceContext); - } else { - log(logger::LogComponent::kNetwork) << "Failed to shutdown service entry point " - "within timelimit, skipping embedded " - "shutdown."; - } - } - }); - - setupSignalHandlers(); - - log() << "MongoDB embedded standalone application, for testing purposes only"; - - try { - optionenvironment::OptionSection startupOptions("Options"); - // Adding all options mongod we don't have to maintain a separate set for this executable, - // some will be unused but that's fine as this is just an executable for testing purposes - // anyway. - uassertStatusOK(addMongodOptions(&startupOptions)); - uassertStatusOK( - embedded_integration_helpers::parseCommandLineOptions(argc, argv, startupOptions)); - uassertStatusOK(storeMongodOptions(optionenvironment::startupOptionsParsed)); - - // Add embedded specific options that's not available in mongod here. - YAML::Emitter yaml; - serviceContext = embedded::initialize(yaml.c_str()); - - // Override the ServiceEntryPoint with one that can support transport layers. - serviceContext->setServiceEntryPoint( - std::make_unique(serviceContext)); - - auto tl = - transport::TransportLayerManager::createWithConfig(&serverGlobalParams, serviceContext); - uassertStatusOK(tl->setup()); - - serviceContext->setTransportLayer(std::move(tl)); - - uassertStatusOK(serviceContext->getServiceExecutor()->start()); - uassertStatusOK(serviceContext->getTransportLayer()->start()); - } catch (const std::exception& ex) { - error() << ex.what(); - return EXIT_BADOPTIONS; - } - - return waitForShutdown(); -} - -} // namespace -} // namespace mongo - -#if defined(_WIN32) -// In Windows, wmain() is an alternate entry point for main(), and receives the same parameters -// as main() but encoded in Windows Unicode (UTF-16); "wide" 16-bit wchar_t characters. The -// WindowsCommandLine object converts these wide character strings to a UTF-8 coded equivalent -// and makes them available through the argv() and envp() members. This enables mongoDbMain() -// to process UTF-8 encoded arguments and environment variables without regard to platform. -int wmain(int argc, wchar_t* argvW[], wchar_t* envpW[]) { - mongo::WindowsCommandLine wcl(argc, argvW, envpW); - return mongo::mongoedMain(argc, wcl.argv(), wcl.envp()); -} -#else -int main(int argc, char* argv[], char** envp) { - return mongo::mongoedMain(argc, argv, envp); -} -#endif diff --git a/src/mongo/platform/stack_locator_android.cpp b/src/mongo/platform/stack_locator_android.cpp deleted file mode 100644 index 790eb06357b..00000000000 --- a/src/mongo/platform/stack_locator_android.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "stack_locator_pthread_getattr_np.cpp" diff --git a/src/mongo/platform/stack_locator_iOS-sim.cpp b/src/mongo/platform/stack_locator_iOS-sim.cpp deleted file mode 100644 index 3604e2f90ed..00000000000 --- a/src/mongo/platform/stack_locator_iOS-sim.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/stack_locator_osx.cpp" diff --git a/src/mongo/platform/stack_locator_iOS.cpp b/src/mongo/platform/stack_locator_iOS.cpp deleted file mode 100644 index 3604e2f90ed..00000000000 --- a/src/mongo/platform/stack_locator_iOS.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/stack_locator_osx.cpp" diff --git a/src/mongo/platform/stack_locator_tvOS-sim.cpp b/src/mongo/platform/stack_locator_tvOS-sim.cpp deleted file mode 100644 index 3604e2f90ed..00000000000 --- a/src/mongo/platform/stack_locator_tvOS-sim.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/stack_locator_osx.cpp" diff --git a/src/mongo/platform/stack_locator_tvOS.cpp b/src/mongo/platform/stack_locator_tvOS.cpp deleted file mode 100644 index 3604e2f90ed..00000000000 --- a/src/mongo/platform/stack_locator_tvOS.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/stack_locator_osx.cpp" diff --git a/src/mongo/platform/stack_locator_watchOS-sim.cpp b/src/mongo/platform/stack_locator_watchOS-sim.cpp deleted file mode 100644 index 3604e2f90ed..00000000000 --- a/src/mongo/platform/stack_locator_watchOS-sim.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/stack_locator_osx.cpp" diff --git a/src/mongo/platform/stack_locator_watchOS.cpp b/src/mongo/platform/stack_locator_watchOS.cpp deleted file mode 100644 index 3604e2f90ed..00000000000 --- a/src/mongo/platform/stack_locator_watchOS.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/stack_locator_osx.cpp" diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp index aee5ea1217f..c8f5a6acbf0 100644 --- a/src/mongo/shell/bench.cpp +++ b/src/mongo/shell/bench.cpp @@ -748,9 +748,9 @@ BenchRunWorker::BenchRunWorker(size_t id, BenchRunWorker::~BenchRunWorker() { try { - // We explicitly call join() on the started thread to ensure that any thread-local variables - // (e.g. 'currentClient' when running through mongoebench) have been destructed before - // returning from BenchRunWorker's destructor. + // We explicitly call join() on the started thread to ensure + // that any thread-local variables have been destructed + // before returning from BenchRunWorker's destructor. _thread.join(); } catch (...) { severe() << "caught exception in destructor: " << exceptionToStatus(); diff --git a/src/mongo/tools/SConscript b/src/mongo/tools/SConscript index e65cbc2c209..095b2485927 100644 --- a/src/mongo/tools/SConscript +++ b/src/mongo/tools/SConscript @@ -32,29 +32,6 @@ mongobridge = env.Program( ], ) -mongoebench = yamlEnv.Program( - target='mongoebench', - source=[ - 'mongoebench_main.cpp', - 'mongoebench_options.cpp', - 'mongoebench_options_init.cpp', - ], - LIBDEPS=[ - '$BUILD_DIR/mongo/db/dbdirectclient', - '$BUILD_DIR/mongo/embedded/embedded', - '$BUILD_DIR/mongo/embedded/embedded_integration_helpers', - '$BUILD_DIR/mongo/shell/benchrun', - '$BUILD_DIR/mongo/util/signal_handlers', - ], - INSTALL_ALIAS=[ - 'embedded-test', - 'tools', - ], -) - hygienic = get_option('install-mode') == 'hygienic' if not hygienic: env.Install("#/", mongobridge) - env.Install("#/", mongoebench) - -env.Alias('all', mongoebench) # This ensures it compiles and links, but doesn't copy it anywhere. diff --git a/src/mongo/tools/mongoebench_main.cpp b/src/mongo/tools/mongoebench_main.cpp deleted file mode 100644 index 5d6c290b116..00000000000 --- a/src/mongo/tools/mongoebench_main.cpp +++ /dev/null @@ -1,168 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault - -#include "mongo/platform/basic.h" - -#include - -#include "mongo/base/init.h" -#include "mongo/db/dbdirectclient.h" -#include "mongo/db/service_context.h" -#include "mongo/embedded/embedded.h" -#include "mongo/embedded/embedded_options.h" -#include "mongo/embedded/embedded_options_helpers.h" -#include "mongo/scripting/bson_template_evaluator.h" -#include "mongo/shell/bench.h" -#include "mongo/tools/mongoebench_options.h" -#include "mongo/util/exit.h" -#include "mongo/util/log.h" -#include "mongo/util/options_parser/option_section.h" -#include "mongo/util/signal_handlers.h" -#include "mongo/util/text.h" - -namespace mongo { -namespace { - -/** - * DBDirectClientWithOwnOpCtx is a version of DBDirectClient that owns its own OperationContext. - * - * Since benchRun originally existed only in the mongo shell and was used with only - * DBClientConnections, there isn't a part of the BenchRunConfig or BenchRunWorker interfaces that - * is aware of having an OperationContext. In particular, the mongo shell lacks a ServiceContext and - * therefore also lacks the rest of the Client and OperationContext hierarchy. We shove an - * OperationContext onto the DBDirectClient to work around this limitation for mongoebench to work. - */ -class DBDirectClientWithOwnOpCtx : public DBDirectClient { -public: - DBDirectClientWithOwnOpCtx() : DBDirectClient(nullptr) { - Client::initThreadIfNotAlready(); - _opCtx = cc().makeOperationContext(); - setOpCtx(_opCtx.get()); - } - -private: - ServiceContext::UniqueOperationContext _opCtx; -}; - -MONGO_INITIALIZER_WITH_PREREQUISITES(SignalProcessingStartup, ("ThreadNameInitializer")) -(InitializerContext*) { - // Make sure we call this as soon as possible but before any other threads are started. Before - // embedded::initialize is too early and after is too late. So instead we hook in during the - // global initialization at the right place. - startSignalProcessingThread(); - return Status::OK(); -} - -int mongoeBenchMain(int argc, char* argv[], char** envp) { - ServiceContext* serviceContext = nullptr; - - registerShutdownTask([&]() { - if (serviceContext) { - embedded::shutdown(serviceContext); - } - }); - - setupSignalHandlers(); - - log() << "MongoDB embedded benchRun application, for testing purposes only"; - - try { - optionenvironment::OptionSection startupOptions("Options"); - uassertStatusOK(embedded::addOptions(&startupOptions)); - uassertStatusOK(addMongoeBenchOptions(&startupOptions)); - uassertStatusOK( - embedded_integration_helpers::parseCommandLineOptions(argc, argv, startupOptions)); - serviceContext = embedded::initialize(nullptr); - } catch (const std::exception& ex) { - error() << ex.what(); - return EXIT_BADOPTIONS; - } - - // If a "pre" section was present in the benchRun config file, then we run its operations once - // before running the operations from the "ops" section. - if (mongoeBenchGlobalParams.preConfig) { - auto conn = mongoeBenchGlobalParams.preConfig->createConnection(); - boost::optional lsid; - - BsonTemplateEvaluator bsonTemplateEvaluator(mongoeBenchGlobalParams.preConfig->randomSeed); - BenchRunStats stats; - BenchRunOp::State state(&bsonTemplateEvaluator, &stats); - - for (auto&& op : mongoeBenchGlobalParams.preConfig->ops) { - op.executeOnce(conn.get(), lsid, *mongoeBenchGlobalParams.preConfig, &state); - } - } - - // If an "ops" section was present in the benchRun config file, then we repeatedly run its - // operations across the configured number of threads for the configured number of seconds. - if (mongoeBenchGlobalParams.opsConfig) { - const double seconds = mongoeBenchGlobalParams.opsConfig->seconds; - auto runner = std::make_unique(mongoeBenchGlobalParams.opsConfig.release()); - runner->start(); - - sleepmillis(static_cast(seconds * 1000)); - - BSONObj stats = BenchRunner::finish(runner.release()); - log() << "writing stats to " << mongoeBenchGlobalParams.outputFile.string() << ": " - << stats; - - boost::filesystem::ofstream outfile(mongoeBenchGlobalParams.outputFile); - outfile << stats.jsonString() << '\n'; - } - - shutdown(EXIT_CLEAN); -} - -} // namespace - -MONGO_REGISTER_SHIM(BenchRunConfig::createConnectionImpl) -(const BenchRunConfig& config)->std::unique_ptr { - return std::unique_ptr(new DBDirectClientWithOwnOpCtx()); -} - -} // namespace mongo - -#if defined(_WIN32) -// In Windows, wmain() is an alternate entry point for main(), and receives the same parameters as -// main() but encoded in Windows Unicode (UTF-16); "wide" 16-bit wchar_t characters. The -// WindowsCommandLine object converts these wide character strings to a UTF-8 coded equivalent and -// makes them available through the argv() and envp() members. This enables mongoeBenchMain() to -// process UTF-8 encoded arguments and environment variables without regard to platform. -int wmain(int argc, wchar_t* argvW[], wchar_t* envpW[]) { - mongo::WindowsCommandLine wcl(argc, argvW, envpW); - return mongo::mongoeBenchMain(argc, wcl.argv(), wcl.envp()); -} -#else -int main(int argc, char* argv[], char** envp) { - return mongo::mongoeBenchMain(argc, argv, envp); -} -#endif diff --git a/src/mongo/tools/mongoebench_options.cpp b/src/mongo/tools/mongoebench_options.cpp deleted file mode 100644 index 2c9421e93b7..00000000000 --- a/src/mongo/tools/mongoebench_options.cpp +++ /dev/null @@ -1,163 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/basic.h" - -#include "mongo/tools/mongoebench_options.h" - -#include -#include -#include -#include - -#include "mongo/base/status.h" -#include "mongo/db/storage/storage_options.h" -#include "mongo/platform/random.h" -#include "mongo/shell/bench.h" -#include "mongo/util/mongoutils/str.h" -#include "mongo/util/options_parser/startup_options.h" - -namespace mongo { - -MongoeBenchGlobalParams mongoeBenchGlobalParams; - -Status addMongoeBenchOptions(moe::OptionSection* options) { - options->addOptionChaining("help", "help", moe::Switch, "show this usage information"); - - options - ->addOptionChaining( - "benchRunConfigFile", "benchRunConfigFile", moe::String, "config file for benchRun") - .hidden() - .positional(1, 1); - - options->addOptionChaining("seed", "seed", moe::Long, "random seed to use"); - - options - ->addOptionChaining( - "threads", "threads,t", moe::Unsigned, "number of benchRun worker threads") - .setDefault(moe::Value(1U)); - - options->addOptionChaining("time", "time,s", moe::Double, "seconds to run benchRun for") - .setDefault(moe::Value(1.0)); - - options->addOptionChaining("output", - "output,o", - moe::String, - "output file for benchRun stats (defaults to /perf.json)"); - - return Status::OK(); -} - -void printMongoeBenchHelp(std::ostream* out) { - *out << "Usage: mongoebench [options]" << std::endl; - *out << moe::startupOptions.helpString(); - *out << std::flush; -} - -bool handlePreValidationMongoeBenchOptions(const moe::Environment& params) { - if (params.count("help")) { - printMongoeBenchHelp(&std::cout); - return false; - } - return true; -} - -namespace { - -BSONObj getBsonFromJsonFile(const std::string& filename) { - std::ifstream infile(filename.c_str()); - std::string data((std::istreambuf_iterator(infile)), std::istreambuf_iterator()); - return fromjson(data); -} - -boost::filesystem::path kDefaultOutputFile("perf.json"); - -} // namespace - -Status storeMongoeBenchOptions(const moe::Environment& params, - const std::vector& args) { - if (!params.count("benchRunConfigFile")) { - return {ErrorCodes::BadValue, "No benchRun config file was specified"}; - } - - BSONObj config = getBsonFromJsonFile(params["benchRunConfigFile"].as()); - for (auto&& elem : config) { - const auto fieldName = elem.fieldNameStringData(); - if (fieldName == "pre") { - mongoeBenchGlobalParams.preConfig.reset( - BenchRunConfig::createFromBson(elem.wrap("ops"))); - } else if (fieldName == "ops") { - mongoeBenchGlobalParams.opsConfig.reset(BenchRunConfig::createFromBson(elem.wrap())); - } else { - return {ErrorCodes::BadValue, - str::stream() << "Unrecognized key in benchRun config file: " << fieldName}; - } - } - - int64_t seed = params.count("seed") ? static_cast(params["seed"].as()) - : SecureRandom::create()->nextInt64(); - - if (mongoeBenchGlobalParams.preConfig) { - mongoeBenchGlobalParams.preConfig->randomSeed = seed; - } - - if (mongoeBenchGlobalParams.opsConfig) { - mongoeBenchGlobalParams.opsConfig->randomSeed = seed; - - if (params.count("threads")) { - mongoeBenchGlobalParams.opsConfig->parallel = params["threads"].as(); - } - - if (params.count("time")) { - mongoeBenchGlobalParams.opsConfig->seconds = params["time"].as(); - } - } - - if (params.count("output")) { - mongoeBenchGlobalParams.outputFile = - boost::filesystem::path(params["output"].as()); - } else { - boost::filesystem::path dbpath(storageGlobalParams.dbpath); - mongoeBenchGlobalParams.outputFile = dbpath / kDefaultOutputFile; - } - - mongoeBenchGlobalParams.outputFile = mongoeBenchGlobalParams.outputFile.lexically_normal(); - auto parentPath = mongoeBenchGlobalParams.outputFile.parent_path(); - if (!parentPath.empty() && !boost::filesystem::exists(parentPath)) { - return {ErrorCodes::NonExistentPath, - str::stream() << "Directory containing output file must already exist, but " - << parentPath.string() - << " wasn't found"}; - } - - return Status::OK(); -} - -} // namespace mongo diff --git a/src/mongo/tools/mongoebench_options.h b/src/mongo/tools/mongoebench_options.h deleted file mode 100644 index 9824b389677..00000000000 --- a/src/mongo/tools/mongoebench_options.h +++ /dev/null @@ -1,77 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include "mongo/base/status.h" - -namespace mongo { - -class BenchRunConfig; - -namespace optionenvironment { - -class OptionSection; -class Environment; - -} // namespace optionenvironment - -namespace moe = mongo::optionenvironment; - -struct MongoeBenchGlobalParams { - std::unique_ptr preConfig; - std::unique_ptr opsConfig; - boost::filesystem::path outputFile; -}; - -extern MongoeBenchGlobalParams mongoeBenchGlobalParams; - -Status addMongoeBenchOptions(moe::OptionSection* options); - -void printMongoeBenchHelp(std::ostream* out); - -/** - * Handle options that should come before validation, such as "help". - * - * Returns false if an option was found that implies we should prematurely exit with success. - */ -bool handlePreValidationMongoeBenchOptions(const moe::Environment& params); - -Status storeMongoeBenchOptions(const moe::Environment& params, - const std::vector& args); - -} // namespace mongo diff --git a/src/mongo/tools/mongoebench_options_init.cpp b/src/mongo/tools/mongoebench_options_init.cpp deleted file mode 100644 index 6ca28a95f51..00000000000 --- a/src/mongo/tools/mongoebench_options_init.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/tools/mongoebench_options.h" - -#include "mongo/util/options_parser/startup_option_init.h" -#include "mongo/util/options_parser/startup_options.h" -#include "mongo/util/quick_exit.h" - -namespace mongo { -namespace { - -MONGO_GENERAL_STARTUP_OPTIONS_REGISTER(MongoeBenchOptions)(InitializerContext* context) { - return addMongoeBenchOptions(&moe::startupOptions); -} - -GlobalInitializerRegisterer mongoeBenchOptionsStore( - "MongoeBenchOptions_Store", - {"BeginStartupOptionStorage", "EmbeddedOptions_Store"}, - {"EndStartupOptionStorage"}, - [](InitializerContext* context) { - if (!handlePreValidationMongoeBenchOptions(moe::startupOptionsParsed)) { - quickExit(EXIT_SUCCESS); - } - return storeMongoeBenchOptions(moe::startupOptionsParsed, context->args()); - }); - -} // namespace -} // namespace mongo diff --git a/src/mongo/util/dns_query_android-impl.h b/src/mongo/util/dns_query_android-impl.h deleted file mode 100644 index a1e1c2f9f1d..00000000000 --- a/src/mongo/util/dns_query_android-impl.h +++ /dev/null @@ -1,84 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#ifndef MONGO_UTIL_DNS_QUERY_PLATFORM_INCLUDE_WHITELIST -#error Do not include the DNS Query platform implementation headers. Please use "mongo/util/dns_query.h" instead. -#endif - -#include -#include -#include - -#include "mongo/util/assert_util.h" - -namespace mongo { -namespace dns { -namespace { - -enum class DNSQueryClass { kInternet }; - -enum class DNSQueryType { kSRV, kTXT, kAddress }; - -[[noreturn]] void throwNotSupported() { - uasserted(ErrorCodes::InternalErrorNotSupported, "srv_nsearch not supported on android"); -} - -class ResourceRecord { -public: - explicit ResourceRecord() = default; - - std::vector txtEntry() const { - throwNotSupported(); - } - - std::string addressEntry() const { - throwNotSupported(); - } - - SRVHostEntry srvHostEntry() const { - throwNotSupported(); - } -}; - -using DNSResponse = std::vector; - -class DNSQueryState { -public: - DNSResponse lookup(const std::string&, const DNSQueryClass, const DNSQueryType) { - throwNotSupported(); - } - - DNSQueryState() { - throwNotSupported(); - } -}; -} // namespace -} // namespace dns -} // namespace mongo diff --git a/src/mongo/util/processinfo_android.cpp b/src/mongo/util/processinfo_android.cpp deleted file mode 100644 index 308265f573e..00000000000 --- a/src/mongo/util/processinfo_android.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/util/processinfo_linux.cpp" diff --git a/src/mongo/util/processinfo_iOS-sim.cpp b/src/mongo/util/processinfo_iOS-sim.cpp deleted file mode 100644 index 9c8f450f659..00000000000 --- a/src/mongo/util/processinfo_iOS-sim.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/util/processinfo_osx.cpp" diff --git a/src/mongo/util/processinfo_iOS.cpp b/src/mongo/util/processinfo_iOS.cpp deleted file mode 100644 index 9c8f450f659..00000000000 --- a/src/mongo/util/processinfo_iOS.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/util/processinfo_osx.cpp" diff --git a/src/mongo/util/processinfo_tvOS-sim.cpp b/src/mongo/util/processinfo_tvOS-sim.cpp deleted file mode 100644 index 9c8f450f659..00000000000 --- a/src/mongo/util/processinfo_tvOS-sim.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/util/processinfo_osx.cpp" diff --git a/src/mongo/util/processinfo_tvOS.cpp b/src/mongo/util/processinfo_tvOS.cpp deleted file mode 100644 index 9c8f450f659..00000000000 --- a/src/mongo/util/processinfo_tvOS.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/util/processinfo_osx.cpp" diff --git a/src/mongo/util/processinfo_watchOS-sim.cpp b/src/mongo/util/processinfo_watchOS-sim.cpp deleted file mode 100644 index 9c8f450f659..00000000000 --- a/src/mongo/util/processinfo_watchOS-sim.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/util/processinfo_osx.cpp" diff --git a/src/mongo/util/processinfo_watchOS.cpp b/src/mongo/util/processinfo_watchOS.cpp deleted file mode 100644 index 9c8f450f659..00000000000 --- a/src/mongo/util/processinfo_watchOS.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/util/processinfo_osx.cpp" diff --git a/src/third_party/scripts/mongo-perf_get_sources.sh b/src/third_party/scripts/mongo-perf_get_sources.sh deleted file mode 100755 index b1f5cc60115..00000000000 --- a/src/third_party/scripts/mongo-perf_get_sources.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# This script downloads the mongodb/mongo-perf repository and generates mongoebench-compatible JSON -# config files equivalent to the JavaScript test cases. -# -# Turn on strict error checking, like perl use 'strict'. -set -xeuo pipefail -IFS=$'\n\t' - -if [ "$#" -ne 0 ]; then - echo "This script does not take any arguments" - exit 1 -fi - -# We add the current working directory to the PATH because that is where the mongo shell may have -# been installed. The benchrun.py script is going to run the mongo shell binary that's on the PATH. -PATH=$PATH:$(pwd) - -# The mongo shell processes spawned by the benchrun.py script will attempt to connect to a mongod, -# so we just error out if we find that one isn't already running. -mongo --eval 'db.adminCommand({ping: 1})' && rc=$? || rc=$? -if [ "$rc" -ne 0 ]; then - echo "This script requires a mongod to be running on port 27017" - exit 2 -fi - -NAME=mongo-perf -SRC_ROOT=$(mktemp -d /tmp/$NAME.XXXXXX) -trap "rm -rf $SRC_ROOT" EXIT -DEST_DIR=$(git rev-parse --show-toplevel)/benchrun_embedded/testcases - -git clone --branch=master https://github.com/mongodb/mongo-perf.git $SRC_ROOT - -pushd $SRC_ROOT - -# We pin to a particular commit of the mongodb/mongo-perf repository to make it clear what version -# of the JavaScript test cases we are running. -git checkout 7070ac74dd35fde2f59af01b155191382357ed1d - -# We use Python to get the number of CPUs in a platform-agnostic way. -NUM_CPUS=$(python -c 'import multiprocessing; print(multiprocessing.cpu_count())') - -# Generating the JSON config files sequentially takes ~6 minutes due to how certain JavaScript test -# cases build up very large documents only to eventually realize upon trying to serialize them out -# to a file that they are too big. We use `xargs -P` to speed up generating the JSON config files. -# -# We don't generate JSON config files for tests that are tagged with "capped" or "where" because -# they aren't supported by embedded. -# -# We generate JSON config files for tests that are tagged with "aggregation_identityview" or -# "query_identityview" while using --readCmd=true because the find command is necessary to read from -# a view. We use --readCmd=false for all other tests to match what etc/perf.yml does. -find testcases -type f -print0 | xargs -0 -I% -n1 -P$NUM_CPUS \ - python2 benchrun.py --testfiles % \ - --threads 1 \ - --excludeFilter capped \ - --excludeFilter where \ - --generateMongoeBenchConfigFiles mongoebench/ \ - --readCmd false \ - --writeCmd true \ - --excludeFilter aggregation_identityview \ - --excludeFilter query_identityview - -find testcases -type f -print0 | xargs -0 -I% -n1 -P$NUM_CPUS \ - python2 benchrun.py --testfiles % \ - --threads 1 \ - --excludeFilter capped \ - --excludeFilter where \ - --generateMongoeBenchConfigFiles mongoebench/ \ - --readCmd true \ - --writeCmd true \ - --includeFilter aggregation_identityview query_identityview - -popd - -test -d $DEST_DIR && rm -r $DEST_DIR -mkdir -p $(dirname $DEST_DIR) - -mv $SRC_ROOT/mongoebench $DEST_DIR -- cgit v1.2.1