我需要增加Mongo中BSON对象的最大大小。由于BSON对象大小不能直接配置,我试图通过更改源中的常量并重新编译来实现此目的。
问题是任何尝试改变const int BSONObjMaxUserSize = 16 * 1024 * 1024;除了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.
答案 0 :(得分:0)
这不是问题:
更改了builder.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 -j 8
干净地编译。这是我的系统信息:
操作系统版本
/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
gcc版
/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