【发布时间】:2014-12-22 10:08:25
【问题描述】:
我需要增加 Mongo 中 BSON 对象的最大大小。由于 BSON 对象的大小不能直接配置,我试图通过更改源中的常量并重新编译来做到这一点。
问题是任何试图改变 const int BSONObjMaxUserSize = 16 * 1024 * 1024;到 16 in this file 以外的任何内容都会在 boost 库进行编译时导致崩溃。
将 BSONObjMaxUserSize 保留为 16 可以完美编译,但将其更改为其他任何值都会失败。我已经尝试了很多选项(8,32,甚至 7 个很好的衡量标准。)
我在 2.6.6 稳定版中遇到过这种情况。
In file included from src/third_party/boost/boost/type_traits/type_with_alignment.hpp:19:0,
from src/third_party/boost/boost/smart_ptr/make_shared.hpp:17,
from src/third_party/boost/boost/make_shared.hpp:15,
from src/third_party/boost/boost/smart_ptr.hpp:28,
from src/mongo/pch.h:50,
from src/mongo/db/dur_commitjob.cpp:31:
src/third_party/boost/boost/static_assert.hpp:124:85: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false>'
sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >)>\
^
src/mongo/db/dur_commitjob.cpp:147:9: note: in expansion of macro 'BOOST_STATIC_ASSERT'
BOOST_STATIC_ASSERT( sizeof(void*)==4 || UncommittedBytesLimit > BSONObjMaxInternalSize * 6 );
^
src/third_party/boost/boost/static_assert.hpp:124:86: error: template argument 1 is invalid
sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >)>\
^
src/mongo/db/dur_commitjob.cpp:147:9: note: in expansion of macro 'BOOST_STATIC_ASSERT'
BOOST_STATIC_ASSERT( sizeof(void*)==4 || UncommittedBytesLimit > BSONObjMaxInternalSize * 6 );
^
src/mongo/db/dur_commitjob.cpp:147:102: error: invalid type in declaration before ';' token
BOOST_STATIC_ASSERT( sizeof(void*)==4 || UncommittedBytesLimit > BSONObjMaxInternalSize * 6 );
^
In file included from src/third_party/boost/boost/filesystem/v3/path_traits.hpp:23:0,
from src/third_party/boost/boost/filesystem/v3/path.hpp:25,
from src/third_party/boost/boost/filesystem/path.hpp:31,
from src/mongo/util/paths.h:21,
from src/mongo/db/storage/durable_mapped_file.h:35,
from src/mongo/db/dur.h:34,
from src/mongo/db/dur_commitjob.h:34,
from src/mongo/db/dur_commitjob.cpp:33:
src/third_party/boost/boost/system/error_code.hpp:214:36: error: 'boost::system::posix_category' defined but not used [-Werror=unused-variable]
static const error_category & posix_category = generic_category();
^
src/third_party/boost/boost/system/error_code.hpp:215:36: error: 'boost::system::errno_ecat' defined but not used [-Werror=unused-variable]
static const error_category & errno_ecat = generic_category();
^
src/third_party/boost/boost/system/error_code.hpp:216:36: error: 'boost::system::native_ecat' defined but not used [-Werror=unused-variable]
static const error_category & native_ecat = system_category();
^
cc1plus: all warnings being treated as errors
scons: *** [build/linux2/normal/mongo/db/dur_commitjob.o] Error 1
scons: building terminated because of errors.
【问题讨论】:
-
为什么需要更改最大 BSON 大小(以及您要更改为什么)?通常,接近当前 16MB 限制的文档也与性能不佳的架构设计相关(例如,具有无限增长的数组)。如果您需要存储大型二进制数据,有一个很有用的GridFS 约定。
-
从消息来看,
UncommittedBytesLimit设置为什么?你有没有改变它?