Mongodb 增加Mongo BSON对象的最大大小会导致Boost库编译错误
我需要增加Mongo中BSON对象的最大大小。由于BSON对象大小不是直接可配置的,所以我尝试通过更改源中的常量并重新编译来实现这一点 问题是,任何更改const int BSONObjMaxUserSize=16*1024*1024的尝试;当boost库开始编译时,将导致崩溃 将BSONObjMaxUserSize保留为16完全可以编译,但将其更改为任何其他类型都会失败。我尝试了很多选择(8、32、甚至7) 我在2.6.6稳定版中遇到了这种情况Mongodb 增加Mongo BSON对象的最大大小会导致Boost库编译错误,mongodb,boost,Mongodb,Boost,我需要增加Mongo中BSON对象的最大大小。由于BSON对象大小不是直接可配置的,所以我尝试通过更改源中的常量并重新编译来实现这一点 问题是,任何更改const int BSONObjMaxUserSize=16*1024*1024的尝试;当boost库开始编译时,将导致崩溃 将BSONObjMaxUserSize保留为16完全可以编译,但将其更改为任何其他类型都会失败。我尝试了很多选择(8、32、甚至7) 我在2.6.6稳定版中遇到了这种情况 In file included fro
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.
包含在src/third_party/boost/boost/type_traits/type_with_alignment.hpp:19:0的文件中,
来自src/third_party/boost/boost/smart_ptr/make_shared.hpp:17,
来自src/third_party/boost/boost/make_shared.hpp:15,
来自src/third_party/boost/boost/smart_ptr.hpp:28,
来自src/mongo/pch.h:50,
来自src/mongo/db/dur_commitjob.cpp:31:
src/third_party/boost/boost/static_assert.hpp:124:85:错误:“sizeof”对不完整类型“boost::static_assert_FAILURE”的应用无效
sizeof(::boost::STATIC_ASSERTION_FAILURE)>\
^
src/mongo/db/dur_commitjob.cpp:147:9:注意:在宏“BOOST_STATIC_ASSERT”的扩展中
BOOST_STATIC_ASSERT(sizeof(void*)==4 | | UncommittedBytesLimit>BSONObjMaxInternalSize*6);
^
src/third_party/boost/boost/static_assert.hpp:124:86:错误:模板参数1无效
sizeof(::boost::STATIC_ASSERTION_FAILURE)>\
^
src/mongo/db/dur_commitjob.cpp:147:9:注意:在宏“BOOST_STATIC_ASSERT”的扩展中
BOOST_STATIC_ASSERT(sizeof(void*)==4 | | UncommittedBytesLimit>BSONObjMaxInternalSize*6);
^
src/mongo/db/dur_commitjob.cpp:147:102:错误:在“;”之前的声明中的类型无效代币
BOOST_STATIC_ASSERT(sizeof(void*)==4 | | UncommittedBytesLimit>BSONObjMaxInternalSize*6);
^
在src/third_party/boost/boost/filesystem/v3/path_traits.hpp:23:0包含的文件中,
来自src/third_party/boost/boost/filesystem/v3/path.hpp:25,
来自src/third_party/boost/boost/filesystem/path.hpp:31,
从src/mongo/util/path.h:21,
从src/mongo/db/storage/耐久映射文件.h:35,
来自src/mongo/db/dur.h:34,
来自src/mongo/db/dur_commitjob.h:34,
来自src/mongo/db/dur_commitjob.cpp:33:
src/third_party/boost/boost/system/error_code.hpp:214:36:错误:“boost::system::posix_category”已定义但未使用[-Werror=未使用的变量]
静态常量错误_category&posix_category=generic_category();
^
src/third_party/boost/boost/system/error_code.hpp:215:36:error:'boost::system::errno_ecat'已定义但未使用[-Werror=未使用的变量]
静态常量错误类别&errno\u ecat=generic\u category();
^
src/third_party/boost/boost/system/error_code.hpp:216:36:错误:“boost::system::native_ecat”已定义但未使用[-Werror=未使用的变量]
静态常量错误_category&native_ecat=system_category();
^
cc1plus:所有警告都被视为错误
scons:**[build/linux2/normal/mongo/db/dur_commitjob.o]错误1
scons:由于错误而终止生成。
这里没有问题:
- 从github克隆的0ae940b456ceafc3a0d47
- 已更改生成器。h:
diff --git a/src/mongo/bson/util/builder.h b/src/mongo/bson/util/builder.h index ae31074..8e34aee 100644 --- a/src/mongo/bson/util/builder.h +++ b/src/mongo/bson/util/builder.h @@ -63,7 +63,7 @@ namespace mongo { update $push (append) operation various db.eval() type operations */ - const int BSONObjMaxUserSize = 16 * 1024 * 1024; + const int BSONObjMaxUserSize = 24 * 1024 * 1024; /* Sometimes we need objects slightly larger - an object in the replication local.oplog
scons-j8
干净地编译。以下是我的系统信息:
/tmp/mongo$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
/tmp/mongo$ uname -a
Linux desktop 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
/tmp/mongo$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
/tmp/mongo$ dpkg --status libboost-all-dev
Package: libboost-all-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 26
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Source: boost-defaults
Version: 1.54.0.1ubuntu1
/tmp/mongo$dpkg——状态libboost所有开发
软件包:libboostall-dev
状态:安装正常已安装
优先级:可选
章节:libdevel
安装尺寸:26
维护者:Ubuntu开发者
架构:amd64
来源:boost默认值
版本:1.54.0.1ubuntu1
为什么您需要更改最大BSON大小(以及您试图将其更改为什么)?通常,接近当前16MB限制的文档也与性能较差的模式设计(例如,具有无限增长的数组)相关。如果您需要存储大的二进制数据,有一个很有用的约定。从消息开始,
UncommittedBytesLimit
设置为什么?你有没有改变过?