summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2016-04-22 14:42:28 -0400
committerGeert Bosch <geert@mongodb.com>2016-04-22 14:58:59 -0400
commit8e13345122986b242811ebee1c0908a4fc01640c (patch)
tree6c0121f0f01e0cf827d3204da4fa912daf726ec3
parentdea2cdd594648d2409bc05f620f7854971d20470 (diff)
downloadmongo-8e13345122986b242811ebee1c0908a4fc01640c.tar.gz
SERVER-1393: Include decimal support under control of server parameter
-rw-r--r--SConstruct11
-rw-r--r--buildscripts/resmokeconfig/suites/decimal.yml1
-rw-r--r--etc/evergreen.yml63
-rw-r--r--src/mongo/SConscript9
-rw-r--r--src/mongo/bson/bsonelement.h2
-rw-r--r--src/mongo/bson/bsontypes.cpp4
-rw-r--r--src/mongo/bson/bsontypes.h4
-rw-r--r--src/mongo/config.h.in3
-rw-r--r--src/mongo/db/matcher/expression_leaf.cpp2
-rw-r--r--src/mongo/db/pipeline/expression_test.cpp2
-rw-r--r--src/mongo/platform/SConscript4
-rw-r--r--src/mongo/platform/decimal128.h10
-rw-r--r--src/mongo/rpc/object_check.cpp9
-rw-r--r--src/mongo/rpc/object_check.h9
-rw-r--r--src/third_party/IntelRDFPMathLib20U1/SConscript11
-rw-r--r--src/third_party/SConscript39
16 files changed, 88 insertions, 95 deletions
diff --git a/SConstruct b/SConstruct
index dfd70fbc517..a5e5e3f4092 100644
--- a/SConstruct
+++ b/SConstruct
@@ -444,14 +444,6 @@ add_option('cache-dir',
help='Specify the directory to use for caching objects if --cache is in use',
)
-add_option("experimental-decimal-support",
- choices=['on', 'off'],
- default='off',
- const='on',
- help="Enable experimental decimal128 type support",
- nargs='?',
-)
-
add_option("cxx-std",
choices=["11", "14"],
default="11",
@@ -1511,9 +1503,6 @@ if get_option('wiredtiger') == 'on':
wiredtiger = True
env.SetConfigHeaderDefine("MONGO_CONFIG_WIREDTIGER_ENABLED")
-if get_option('experimental-decimal-support') == 'on':
- env.SetConfigHeaderDefine("MONGO_CONFIG_EXPERIMENTAL_DECIMAL_SUPPORT")
-
icuEnabled = False
if get_option('icu') == 'on':
icuEnabled = True
diff --git a/buildscripts/resmokeconfig/suites/decimal.yml b/buildscripts/resmokeconfig/suites/decimal.yml
index 62cb11ecab2..e0da0a96358 100644
--- a/buildscripts/resmokeconfig/suites/decimal.yml
+++ b/buildscripts/resmokeconfig/suites/decimal.yml
@@ -17,3 +17,4 @@ executor:
mongod_options:
set_parameters:
enableTestCommands: 1
+ enableBSON1_1: 1
diff --git a/etc/evergreen.yml b/etc/evergreen.yml
index 920a9c09de5..3e327cddc20 100644
--- a/etc/evergreen.yml
+++ b/etc/evergreen.yml
@@ -1775,7 +1775,7 @@ tasks:
run_multiple_jobs: true
- <<: *task_template
- name: jsDecimalCore
+ name: jsCore_decimal
commands:
- func: "do setup"
- func: "run tests"
@@ -1784,7 +1784,7 @@ tasks:
run_multiple_jobs: true
- <<: *task_template
- name: jsDecimalCore_WT
+ name: jsCore_decimal_WT
commands:
- func: "do setup"
- func: "run tests"
@@ -2314,6 +2314,8 @@ buildvariants:
- name: jsCore_op_query_WT
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -2446,6 +2448,8 @@ buildvariants:
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -2682,6 +2686,8 @@ buildvariants:
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -2789,6 +2795,8 @@ buildvariants:
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -2973,6 +2981,8 @@ buildvariants:
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -3032,32 +3042,6 @@ buildvariants:
distros:
- rhel55-test
-- name: linux-64-decimal
- display_name: Linux (Decimal Enabled)
- modules: ~
- run_on:
- - rhel55
- batchtime: 1440 # 1 day
- expansions:
- gitvars: LD_LIBRARY_PATH=/opt/openssl/lib64 #needed to workaround the old openSSL on rhel55 builders.
- gorootvars: GOROOT=/opt/go PATH="/opt/go/bin:$PATH"
- push_path: linux
- push_bucket: downloads.mongodb.org
- push_name: linux
- push_arch: x86_64-decimal
- compile_flags: -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/v2/bin/gcc CXX=/opt/mongodbtoolchain/v2/bin/g++ --release --experimental-decimal-support=on
- num_jobs_available: $(grep -c ^processor /proc/cpuinfo)
- tasks:
- - name: compile
- distros:
- - rhel55
- - name: dbtest
- - name: dbtest_WT
- - name: jsCore
- - name: jsDecimalCore
- - name: jsDecimalCore_WT
- - name: unittests
-
###########################################
# Windows buildvariants #
###########################################
@@ -3108,6 +3092,8 @@ buildvariants:
- name: jsCore_WT
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -3208,6 +3194,8 @@ buildvariants:
- name: jsCore_WT
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -3307,6 +3295,8 @@ buildvariants:
- name: jsCore_WT
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -3595,6 +3585,8 @@ buildvariants:
- name: jsCore_WT
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -3694,6 +3686,8 @@ buildvariants:
- name: jsCore_WT
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -3786,6 +3780,8 @@ buildvariants:
- name: jsCore_WT
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -3863,6 +3859,8 @@ buildvariants:
- name: jsCore_WT
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: mmap
- name: mongosTest
- name: replicasets
@@ -4043,6 +4041,8 @@ buildvariants:
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_minimum_batch_size_WT
- name: jsCore_op_query
- name: jsCore_op_query_WT
@@ -4217,6 +4217,8 @@ buildvariants:
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -4325,6 +4327,8 @@ buildvariants:
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -4433,6 +4437,8 @@ buildvariants:
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal
+ - name: jsCore_decimal_WT
- name: jsCore_small_oplog
- name: jsCore_small_oplog_WT
- name: jsCore_small_oplog_rs
@@ -4563,6 +4569,7 @@ buildvariants:
# - name: jsCore_auth
# - name: jsCore_compatibility
- name: jsCore_compatibility_WT
+ - name: jsCore_decimal_WT
# - name: jsCore_minimum_batch_size_WT
# - name: jsCore_op_query
- name: jsCore_op_query_WT
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 5939c9ec499..3fb79a82781 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -85,6 +85,7 @@ baseSource=[
'logger/ramlog.cpp',
'logger/rotatable_file_manager.cpp',
'logger/rotatable_file_writer.cpp',
+ 'platform/decimal128.cpp',
'platform/random.cpp',
'platform/strnlen.cpp',
'util/allocator.cpp',
@@ -114,16 +115,11 @@ baseLibDeps=[
'$BUILD_DIR/third_party/murmurhash3/murmurhash3',
'$BUILD_DIR/third_party/shim_boost',
'$BUILD_DIR/third_party/shim_pcrecpp',
+ '$BUILD_DIR/third_party/shim_intel_decimal128',
'util/debugger',
'util/quick_exit',
]
-if GetOption('experimental-decimal-support') == 'on':
- baseSource.append('platform/decimal128.cpp')
- baseLibDeps.append('$BUILD_DIR/third_party/shim_intel_decimal128')
-else:
- baseSource.append('platform/decimal128_dummy.cpp')
-
env.Library(
target='base',
source=baseSource,
@@ -209,7 +205,6 @@ env.Alias('generated-sources', generatedVersionFile)
config_header_substs = (
('@mongo_config_byte_order@', 'MONGO_CONFIG_BYTE_ORDER'),
('@mongo_config_debug_build@', 'MONGO_CONFIG_DEBUG_BUILD'),
- ('@mongo_config_experimental_decimal_support@', 'MONGO_CONFIG_EXPERIMENTAL_DECIMAL_SUPPORT'),
('@mongo_config_have_thread_local@', 'MONGO_CONFIG_HAVE_THREAD_LOCAL'),
('@mongo_config_have___declspec_thread@', 'MONGO_CONFIG_HAVE___DECLSPEC_THREAD'),
('@mongo_config_have___thread@', 'MONGO_CONFIG_HAVE___THREAD'),
diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h
index 5391e622b0e..b3e8c3caf98 100644
--- a/src/mongo/bson/bsonelement.h
+++ b/src/mongo/bson/bsonelement.h
@@ -674,9 +674,7 @@ inline bool BSONElement::isNumber() const {
switch (type()) {
case NumberLong:
case NumberDouble:
-#ifdef MONGO_CONFIG_EXPERIMENTAL_DECIMAL_SUPPORT
case NumberDecimal:
-#endif
case NumberInt:
return true;
default:
diff --git a/src/mongo/bson/bsontypes.cpp b/src/mongo/bson/bsontypes.cpp
index e1348b94f06..44d3f74d2dd 100644
--- a/src/mongo/bson/bsontypes.cpp
+++ b/src/mongo/bson/bsontypes.cpp
@@ -34,6 +34,8 @@
namespace mongo {
+bool enableBSON1_1 = false;
+
const char kMaxKeyData[] = {7, 0, 0, 0, static_cast<char>(MaxKey), 0, 0};
const BSONObj kMaxBSONKey(kMaxKeyData);
@@ -115,9 +117,7 @@ bool isValidBSONType(int type) {
case NumberInt:
case bsonTimestamp:
case NumberLong:
-#ifdef MONGO_CONFIG_EXPERIMENTAL_DECIMAL_SUPPORT
case NumberDecimal:
-#endif
case MaxKey:
return true;
default:
diff --git a/src/mongo/bson/bsontypes.h b/src/mongo/bson/bsontypes.h
index 3686ae8240e..6fb3c0a2564 100644
--- a/src/mongo/bson/bsontypes.h
+++ b/src/mongo/bson/bsontypes.h
@@ -53,6 +53,10 @@ extern const BSONObj kMinBSONKey;
*/
enum class BSONVersion { kV1_0, kV1_1, kLatest = kV1_1 };
+// Flag that determines whether we should accept decimal types in object validation, and default
+// to KeyString V1 indexes on non-MMAP storage engines. Set by enableBSON1_1 server parameter.
+extern bool enableBSON1_1;
+
/**
the complete list of valid BSON types
see also bsonspec.org
diff --git a/src/mongo/config.h.in b/src/mongo/config.h.in
index e3274e09615..6607cad1689 100644
--- a/src/mongo/config.h.in
+++ b/src/mongo/config.h.in
@@ -34,9 +34,6 @@
// Define if building a debug build
@mongo_config_debug_build@
-// Defined if experimental decimal support is enabled
-@mongo_config_experimental_decimal_support@
-
// Defined if thread_local storage class is available
@mongo_config_have_thread_local@
diff --git a/src/mongo/db/matcher/expression_leaf.cpp b/src/mongo/db/matcher/expression_leaf.cpp
index 501a7cc4943..bcc22bc18f7 100644
--- a/src/mongo/db/matcher/expression_leaf.cpp
+++ b/src/mongo/db/matcher/expression_leaf.cpp
@@ -426,9 +426,7 @@ const std::unordered_map<std::string, BSONType> TypeMatchExpression::typeAliasMa
{typeName(NumberInt), NumberInt},
{typeName(bsonTimestamp), bsonTimestamp},
{typeName(NumberLong), NumberLong},
-#ifdef MONGO_CONFIG_EXPERIMENTAL_DECIMAL_SUPPORT
{typeName(NumberDecimal), NumberDecimal},
-#endif
{typeName(MaxKey), MaxKey},
{typeName(MinKey), MinKey}};
diff --git a/src/mongo/db/pipeline/expression_test.cpp b/src/mongo/db/pipeline/expression_test.cpp
index 22f5b6aa498..d4b566e2bb4 100644
--- a/src/mongo/db/pipeline/expression_test.cpp
+++ b/src/mongo/db/pipeline/expression_test.cpp
@@ -4589,11 +4589,9 @@ TEST(ExpressionTypeTest, WithIntValue) {
assertExpectedResults("$type", {{{Value(1)}, Value("int")}});
}
-#ifdef MONGO_CONFIG_EXPERIMENTAL_DECIMAL_SUPPORT
TEST(ExpressionTypeTest, WithDecimalValue) {
assertExpectedResults("$type", {{{Value(Decimal128(0.3))}, Value("decimal")}});
}
-#endif
TEST(ExpressionTypeTest, WithLongValue) {
assertExpectedResults("$type", {{{Value(1LL)}, Value("long")}});
diff --git a/src/mongo/platform/SConscript b/src/mongo/platform/SConscript
index 59bdff21e9c..6f74069ce3d 100644
--- a/src/mongo/platform/SConscript
+++ b/src/mongo/platform/SConscript
@@ -27,6 +27,4 @@ env.CppUnitTest('endian_test', 'endian_test.cpp')
env.CppUnitTest('process_id_test', 'process_id_test.cpp', LIBDEPS=['platform'])
env.CppUnitTest('random_test', 'random_test.cpp', LIBDEPS=['$BUILD_DIR/mongo/base'])
env.CppUnitTest('stack_locator_test', 'stack_locator_test.cpp', LIBDEPS=['platform'])
-
-if GetOption('experimental-decimal-support') == 'on':
- env.CppUnitTest('decimal128_test', 'decimal128_test.cpp', LIBDEPS=['$BUILD_DIR/mongo/base'])
+env.CppUnitTest('decimal128_test', 'decimal128_test.cpp', LIBDEPS=['$BUILD_DIR/mongo/base'])
diff --git a/src/mongo/platform/decimal128.h b/src/mongo/platform/decimal128.h
index 7e6d72a0459..22dadb5c7c3 100644
--- a/src/mongo/platform/decimal128.h
+++ b/src/mongo/platform/decimal128.h
@@ -49,13 +49,13 @@ namespace mongo {
class Decimal128 {
public:
/**
- * This boolean is used as a master switch to enable and disable decimal support
- * and is set by the build flag --experimental-decimal-support.
+ * This boolean is used as a master switch to enable and disable decimal support.
+ * TODO(SERVER-23553): Remove once s390 decimal support is working
*/
-#ifdef MONGO_CONFIG_EXPERIMENTAL_DECIMAL_SUPPORT
- static const bool enabled = true;
-#else
+#if defined(__s390x__)
static const bool enabled = false;
+#else
+ static const bool enabled = true;
#endif
/**
diff --git a/src/mongo/rpc/object_check.cpp b/src/mongo/rpc/object_check.cpp
index 1bf6a1099cc..c542e94b8f9 100644
--- a/src/mongo/rpc/object_check.cpp
+++ b/src/mongo/rpc/object_check.cpp
@@ -33,12 +33,17 @@
#include "mongo/base/status.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/server_options.h"
-
+#include "mongo/db/server_parameters.h"
namespace mongo {
+ExportedServerParameter<bool, ServerParameterType::kStartupOnly> enableBSON1_1Parameter(
+ ServerParameterSet::getGlobal(), "enableBSON1_1", &enableBSON1_1);
+
+BSONVersion Validator<BSONObj>::validateVersion() {
+ return enableBSON1_1 ? BSONVersion::kV1_1 : BSONVersion::kV1_0;
+}
Status Validator<BSONObj>::validateStore(const BSONObj& toStore) {
return Status::OK();
}
-
} // namespace mongo
diff --git a/src/mongo/rpc/object_check.h b/src/mongo/rpc/object_check.h
index da427edf8a9..8d58baa203b 100644
--- a/src/mongo/rpc/object_check.h
+++ b/src/mongo/rpc/object_check.h
@@ -29,6 +29,7 @@
#pragma once
#include "mongo/base/data_type_validated.h"
+#include "mongo/bson/bsontypes.h"
#include "mongo/bson/bson_validate.h"
#include "mongo/db/server_options.h"
@@ -43,10 +44,14 @@ class Status;
*/
template <>
struct Validator<BSONObj> {
+ static BSONVersion validateVersion();
+
inline static Status validateLoad(const char* ptr, size_t length) {
- return serverGlobalParams.objcheck ? validateBSON(ptr, length) : Status::OK();
+ return serverGlobalParams.objcheck
+ ? validateBSON(ptr, length, enableBSON1_1 ? BSONVersion::kV1_1 : BSONVersion::kV1_0)
+ : Status::OK();
}
+
static Status validateStore(const BSONObj& toStore);
};
-
} // namespace mongo
diff --git a/src/third_party/IntelRDFPMathLib20U1/SConscript b/src/third_party/IntelRDFPMathLib20U1/SConscript
index 2666eb99f3e..fbf36cdcfac 100644
--- a/src/third_party/IntelRDFPMathLib20U1/SConscript
+++ b/src/third_party/IntelRDFPMathLib20U1/SConscript
@@ -328,10 +328,9 @@ if env.TargetOSIs('windows'):
for to_remove in ['-Werror', '-Wall', '-W']:
removeIfPresent(env['CCFLAGS'], to_remove)
-if GetOption('experimental-decimal-support') == 'on':
- env.Library(
- target='intel_decimal128',
- source=source_files,
- LIBS=libs,
- )
+env.Library(
+ target='intel_decimal128',
+ source=source_files,
+ LIBS=libs,
+)
diff --git a/src/third_party/SConscript b/src/third_party/SConscript
index 5ef4a01fa2b..d965c7ab90c 100644
--- a/src/third_party/SConscript
+++ b/src/third_party/SConscript
@@ -346,26 +346,25 @@ asioEnv.Library(
'shim_asio.cpp'
])
-if get_option("experimental-decimal-support") == "on":
- if use_system_version_of_library("intel_decimal128"):
- intelDecimal128Env = env.Clone(
- SYSLIBDEPS=[
- env['LIBDEPS_INTEL_DECIMAL128_SYSLIBDEP'],
- ])
- else:
- intelDecimal128Env = env.Clone()
- intelDecimal128Env.InjectThirdPartyIncludePaths(libraries=['intel_decimal128'])
- intelDecimal128Env.SConscript('IntelRDFPMathLib20U1/SConscript', exports={ 'env' : intelDecimal128Env })
- intelDecimal128Env = intelDecimal128Env.Clone(
- LIBDEPS=[
- 'IntelRDFPMathLib20U1/intel_decimal128',
- ])
-
- intelDecimal128Env.Library(
- target="shim_intel_decimal128",
- source=[
- 'shim_intel_decimal128.cpp'
- ])
+if use_system_version_of_library("intel_decimal128"):
+ intelDecimal128Env = env.Clone(
+ SYSLIBDEPS=[
+ env['LIBDEPS_INTEL_DECIMAL128_SYSLIBDEP'],
+ ])
+else:
+ intelDecimal128Env = env.Clone()
+ intelDecimal128Env.InjectThirdPartyIncludePaths(libraries=['intel_decimal128'])
+ intelDecimal128Env.SConscript('IntelRDFPMathLib20U1/SConscript', exports={ 'env' : intelDecimal128Env })
+ intelDecimal128Env = intelDecimal128Env.Clone(
+ LIBDEPS=[
+ 'IntelRDFPMathLib20U1/intel_decimal128',
+ ])
+
+intelDecimal128Env.Library(
+ target="shim_intel_decimal128",
+ source=[
+ 'shim_intel_decimal128.cpp'
+ ])
if icuEnabled:
if use_system_version_of_library('icu'):