diff options
Diffstat (limited to 'src')
32 files changed, 3 insertions, 1657 deletions
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 10f3468c918..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_android.cpp +++ /dev/null @@ -1,128 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 <memory> -#include <string> -#include <vector> - -#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/util/processinfo.h" -#include "mongo/util/procparser.h" - -namespace mongo { - -namespace { - -static const std::vector<StringData> kCpuKeys{ - "btime"_sd, "cpu"_sd, "ctxt"_sd, "processes"_sd, "procs_blocked"_sd, "procs_running"_sd}; - -static const std::vector<StringData> 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<std::string> _disks; - - // List of physical disks to collect stats from as StringData to pass to parseProcDiskStatsFile. - std::vector<StringData> _disksStringData; -}; - -} // namespace - -void installSystemMetricsCollector(FTDCController* controller) { - controller->addPeriodicCollector(std::make_unique<LinuxSystemMetricsCollector>()); -} - -} // 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 a25484a0158..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_iOS-sim.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 a25484a0158..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_iOS.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 a25484a0158..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_tvOS-sim.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 a25484a0158..00000000000 --- a/src/mongo/db/ftdc/ftdc_system_stats_tvOS.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 49baf7939e9..c5a9ed4da18 100644 --- a/src/mongo/embedded/SConscript +++ b/src/mongo/embedded/SConscript @@ -137,35 +137,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/repl/repl_set_status_commands', - '$BUILD_DIR/mongo/db/server_options', - '$BUILD_DIR/mongo/db/storage/wiredtiger/storage_wiredtiger' if get_option('wiredtiger') == 'on' else [], - '$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', - ], - AIB_COMPONENT='embedded-test', - AIB_COMPONENTS_EXTRA=[ - 'tests', - ] - ) - - env.Alias('all', mongoed) # This ensures it compiles and links, but doesn't copy it anywhere. - - hygienic = get_option('install-mode') == 'hygienic' - install_mongoed = env.Install('#/', mongoed) - if hygienic: - # TODO: remove when archive.tgz is built by hygienic - env.Alias("install-embedded-test", install_mongoed[0]) 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 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.mongodb.embedded" /> 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 0c31a224374..00000000000 --- a/src/mongo/embedded/mongoed_main.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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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/mongod_options_general_gen.h" -#include "mongo/db/mongod_options_replication_gen.h" -#include "mongo/db/server_options_general_gen.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 <yaml-cpp/yaml.h> - -namespace mongo { -namespace { - -class ServiceEntryPointMongoe : public ServiceEntryPointImpl { -public: - explicit ServiceEntryPointMongoe(ServiceContext* svcCtx) - : ServiceEntryPointImpl(svcCtx), - _sepEmbedded(std::make_unique<ServiceEntryPointEmbedded>()) {} - - DbResponse handleRequest(OperationContext* opCtx, const Message& request) final { - return _sepEmbedded->handleRequest(opCtx, request); - } - -private: - std::unique_ptr<ServiceEntryPointEmbedded> _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(addGeneralServerOptionDefinitions(&startupOptions)); - uassertStatusOK(addMongodGeneralOptions(&startupOptions)); - uassertStatusOK(addMongodReplicationOptions(&startupOptions)); - uassertStatusOK(embedded::addOptions(&startupOptions)); - uassertStatusOK( - embedded_integration_helpers::parseCommandLineOptions(argc, argv, startupOptions)); - - serviceContext = embedded::initialize(""); - - // storeMongodOptions() triggers cmdline censoring, which must happen after initializers. - uassertStatusOK(storeMongodOptions(optionenvironment::startupOptionsParsed)); - - // Override the ServiceEntryPoint with one that can support transport layers. - serviceContext->setServiceEntryPoint( - std::make_unique<ServiceEntryPointMongoe>(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 0570a338ed2..00000000000 --- a/src/mongo/platform/stack_locator_android.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 a99bbd567d4..00000000000 --- a/src/mongo/platform/stack_locator_iOS-sim.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 a99bbd567d4..00000000000 --- a/src/mongo/platform/stack_locator_iOS.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 a99bbd567d4..00000000000 --- a/src/mongo/platform/stack_locator_tvOS-sim.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 a99bbd567d4..00000000000 --- a/src/mongo/platform/stack_locator_tvOS.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 a99bbd567d4..00000000000 --- a/src/mongo/platform/stack_locator_watchOS-sim.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 a99bbd567d4..00000000000 --- a/src/mongo/platform/stack_locator_watchOS.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 9e7dfe3d3a7..765120a8f94 100644 --- a/src/mongo/shell/bench.cpp +++ b/src/mongo/shell/bench.cpp @@ -836,9 +836,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 10acd257809..6e3e8719c85 100644 --- a/src/mongo/tools/SConscript +++ b/src/mongo/tools/SConscript @@ -32,34 +32,5 @@ mongobridge = env.Program( AIB_COMPONENT='tools', ) -mongoebench = yamlEnv.Program( - target='mongoebench', - source=[ - 'mongoebench_main.cpp', - 'mongoebench_options.cpp', - 'mongoebench_options_init.cpp', - env.Idlc('mongoebench_options.idl')[0], - ], - LIBDEPS=[ - '$BUILD_DIR/mongo/db/dbdirectclient', - '$BUILD_DIR/mongo/db/storage/storage_options', - '$BUILD_DIR/mongo/db/storage/wiredtiger/storage_wiredtiger' if get_option('wiredtiger') == 'on' else [], - '$BUILD_DIR/mongo/embedded/embedded', - '$BUILD_DIR/mongo/embedded/embedded_integration_helpers', - '$BUILD_DIR/mongo/shell/benchrun', - '$BUILD_DIR/mongo/util/signal_handlers', - ], - AIB_COMPONENT="embedded-test", - AIB_COMPONENTS_EXTRA=[ - "tests", - "benchmarks", - ], -) - -# TODO: remove this when hygienic is driving all tarball creation -install_mongoebench = env.Install("#/", mongoebench) -env.Alias("install-embedded-test", [install_mongoebench[0]]) install_mongobridge = env.Install("#/", mongobridge) env.Alias("install-tools", [install_mongobridge[0]]) - -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 74f81264289..00000000000 --- a/src/mongo/tools/mongoebench_main.cpp +++ /dev/null @@ -1,172 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 <boost/filesystem.hpp> - -#include "mongo/base/init.h" -#include "mongo/base/shim.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/tools/mongoebench_options_gen.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), _threadClient(getGlobalServiceContext()) { - _opCtx = cc().makeOperationContext(); - setOpCtx(_opCtx.get()); - } - -private: - ThreadClient _threadClient; - 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<LogicalSessionIdToClient> lsid; - - PseudoRandom rng(mongoeBenchGlobalParams.preConfig->randomSeed); - BsonTemplateEvaluator bsonTemplateEvaluator(mongoeBenchGlobalParams.preConfig->randomSeed); - BenchRunStats stats; - BenchRunOp::State state(&rng, &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<BenchRunner>(mongoeBenchGlobalParams.opsConfig.release()); - runner->start(); - - sleepmillis(static_cast<long long>(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); -} - -std::unique_ptr<DBClientBase> benchRunConfigCreateConnectionImplProvider(const BenchRunConfig&) { - return std::unique_ptr<DBClientBase>(new DBDirectClientWithOwnOpCtx()); -} - -auto benchRunConfigCreateConnectionImplRegistration = MONGO_WEAK_FUNCTION_REGISTRATION( - BenchRunConfig::createConnectionImpl, benchRunConfigCreateConnectionImplProvider); -} // 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 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 f2982ee028a..00000000000 --- a/src/mongo/tools/mongoebench_options.cpp +++ /dev/null @@ -1,134 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 <algorithm> -#include <fstream> -#include <iostream> -#include <iterator> - -#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/options_parser/startup_options.h" -#include "mongo/util/str.h" - -namespace mongo { - -MongoeBenchGlobalParams mongoeBenchGlobalParams; - -void printMongoeBenchHelp(std::ostream* out) { - *out << "Usage: mongoebench <config file> [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<char>(infile)), std::istreambuf_iterator<char>()); - return fromjson(data); -} - -boost::filesystem::path kDefaultOutputFile("perf.json"); - -} // namespace - -Status storeMongoeBenchOptions(const moe::Environment& params, - const std::vector<std::string>& args) { - if (!params.count("benchRunConfigFile")) { - return {ErrorCodes::BadValue, "No benchRun config file was specified"}; - } - - BSONObj config = getBsonFromJsonFile(params["benchRunConfigFile"].as<std::string>()); - 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<int64_t>(params["seed"].as<long>()) - : SecureRandom().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<unsigned>(); - } - - if (params.count("time")) { - mongoeBenchGlobalParams.opsConfig->seconds = params["time"].as<double>(); - } - } - - if (params.count("output")) { - mongoeBenchGlobalParams.outputFile = - boost::filesystem::path(params["output"].as<std::string>()); - } 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 fabd676d8b2..00000000000 --- a/src/mongo/tools/mongoebench_options.h +++ /dev/null @@ -1,76 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 <boost/filesystem.hpp> -#include <cstdint> -#include <iosfwd> -#include <memory> -#include <string> -#include <vector> - -#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<BenchRunConfig> preConfig; - std::unique_ptr<BenchRunConfig> 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<std::string>& args); - -} // namespace mongo diff --git a/src/mongo/tools/mongoebench_options.idl b/src/mongo/tools/mongoebench_options.idl deleted file mode 100644 index b86795f8790..00000000000 --- a/src/mongo/tools/mongoebench_options.idl +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2019-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 -# <http://www.mongodb.com/licensing/server-side-public-license>. -# -# 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. -# - -global: - cpp_namespace: "mongo" - configs: - source: [ cli, ini ] - initializer: - register: addMongoeBenchOptions - -configs: - help: - description: 'Show this usage information' - arg_vartype: Switch - - benchRunConfigFile: - description: 'Config file for benchRun' - arg_vartype: String - hidden: true - positional: 1 - - seed: - description: 'Random seed to use' - arg_vartype: Long - - threads: - description: 'Number of benchRun worker threads' - single_name: t - arg_vartype: Unsigned - default: { expr: '1U' } - - time: - description: 'Seconds to run benchRun for' - single_name: s - arg_vartype: Double - default: 1.0 - - output: - description: 'Output file for benchRun stats (defaults to <dbPath>/perf.json)' - single_name: o - arg_vartype: String diff --git a/src/mongo/tools/mongoebench_options_init.cpp b/src/mongo/tools/mongoebench_options_init.cpp deleted file mode 100644 index 4ed8f4d75c5..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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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", - [](InitializerContext* context) { - if (!handlePreValidationMongoeBenchOptions(moe::startupOptionsParsed)) { - quickExit(EXIT_SUCCESS); - } - return storeMongoeBenchOptions(moe::startupOptionsParsed, context->args()); - }, - DeinitializerFunction(nullptr), - {"BeginStartupOptionStorage", "EmbeddedOptions_Store"}, - {"EndStartupOptionStorage"}); - -} // 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 3b2860424e6..00000000000 --- a/src/mongo/util/dns_query_android-impl.h +++ /dev/null @@ -1,83 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 <stdexcept> -#include <string> -#include <vector> - -#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<std::string> txtEntry() const { - throwNotSupported(); - } - - std::string addressEntry() const { - throwNotSupported(); - } - - SRVHostEntry srvHostEntry() const { - throwNotSupported(); - } -}; - -using DNSResponse = std::vector<ResourceRecord>; - -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 0adf5ae2a2d..00000000000 --- a/src/mongo/util/processinfo_android.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 9c6f9a6d1f3..00000000000 --- a/src/mongo/util/processinfo_iOS-sim.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 9c6f9a6d1f3..00000000000 --- a/src/mongo/util/processinfo_iOS.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 9c6f9a6d1f3..00000000000 --- a/src/mongo/util/processinfo_tvOS-sim.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 9c6f9a6d1f3..00000000000 --- a/src/mongo/util/processinfo_tvOS.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 9c6f9a6d1f3..00000000000 --- a/src/mongo/util/processinfo_watchOS-sim.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 9c6f9a6d1f3..00000000000 --- a/src/mongo/util/processinfo_watchOS.cpp +++ /dev/null @@ -1,30 +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 - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * 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 |