mongodb-partners/mongo-rocks

error while building mongo with mongo-rocks

khezen opened this issue · 3 comments

Hi,

I am running the following script on debian stretch

MONGO_VERSION=3.6.2
ROCKSDB_VERSION=5.9.2
# misc
echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" > /etc/apt/sources.list.d/unstable.list \
&&  apt-get update \
&&  apt-get install -y \
    build-essential \
    git \
    binutils \
    python \
    scons \
    libssl-dev \
    gcc-5 \
    libbz2-dev \
    libsnappy-dev \
    zlib1g-dev \
    wget \
    git \
    binutils
# RocksDB
git clone https://github.com/facebook/rocksdb.git
cd rocksdb &&  git checkout tags/v$ROCKSDB_VERSION \
&&  USE_RTTI=1 CFLAGS="-fPIC" CXXFLAGS="-flto -Os -s" make -j$(nproc) static_lib \
&&  make install
# MongoDB
git clone https://github.com/mongodb-partners/mongo-rocks.git /mongo-rocks \
&&  cd /mongo-rocks && git checkout tags/r$MONGO_VERSION
git clone https://github.com/mongodb/mongo.git /mongo
apt-get install -y python-dev
wget https://bootstrap.pypa.io/get-pip.py \
python get-pip.py
cd /mongo && git checkout tags/r$MONGO_VERSION \
&&  mkdir -p src/mongo/db/modules/ \
&&  ln -sf /mongo-rocks src/mongo/db/modules/rocks \
&&  pip install -r buildscripts/requirements.txt \
&&  CXXFLAGS="-flto -Os -s" scons CPPPATH=/usr/local/include LIBPATH=/usr/local/lib -j$(nproc) --disable-warnings-as-errors --release --prefix=/usr --opt core --ssl install
strip /usr/bin/mongoperf \
&&  strip /usr/bin/mongo \
&&  strip /usr/bin/mongod \
&&  strip /usr/bin/mongos
# mongotools
GO_VERSION=1.9.1
wget https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz -P /usr/local \
&&  tar -C /usr/local -xzf /usr/local/go$GO_VERSION.linux-amd64.tar.gz \
&&  export PATH=$PATH:/usr/local/go/bin
git clone https://github.com/mongodb/mongo-tools /mongo-tools \
&&  cd /mongo-tools && git checkout tags/r$MONGO_VERSION
TOOLS_PKG='github.com/mongodb/mongo-tools'
rm -rf .gopath/ \
&&  mkdir -p .gopath/src/"$(dirname "${TOOLS_PKG}")" \
&&  ln -sf `pwd` .gopath/src/$TOOLS_PKG \
&&  export GOPATH=`pwd`/.gopath:`pwd`/vendor
go build -o /usr/bin/bsondump bsondump/main/bsondump.go \
&&  go build -o /usr/bin/mongoimport mongoimport/main/mongoimport.go \
&&  go build -o /usr/bin/mongoexport mongoexport/main/mongoexport.go \
&&  go build -o /usr/bin/mongodump mongodump/main/mongodump.go \
&&  go build -o /usr/bin/mongorestore mongorestore/main/mongorestore.go \
&&  go build -o /usr/bin/mongostat mongostat/main/mongostat.go \
&&  go build -o /usr/bin/mongofiles mongofiles/main/mongofiles.go \
&&  go build -o /usr/bin/mongooplog mongooplog/main/mongooplog.go \
&&  go build -o /usr/bin/mongotop mongotop/main/mongotop.go
strip /usr/bin/bsondump \
&&  strip /usr/bin/mongoimport \
&&  strip /usr/bin/mongoexport \
&&  strip /usr/bin/mongodump \
&&  strip /usr/bin/mongorestore \
&&  strip /usr/bin/mongostat \
&&  strip /usr/bin/mongofiles \
&&  strip /usr/bin/mongooplog \
&&  strip /usr/bin/mongotop

resulting in the following error on CXXFLAGS="-flto -Os -s" scons CPPPATH=/usr/local/include LIBPATH=/usr/local/lib -j$(nproc) --disable-warnings-as-errors --release --prefix=/usr --opt core --ssl install with the following trace:

09:04
g++ -o build/opt/third_party/mozjs-45/platform/x86_64/linux/build/Unified_cpp_js_src34.o -c -Woverloaded-virtual -Wno-maybe-uninitialized -std=c++14 -Wno-non-virtual-dtor -fno-omit-frame-pointer -fno-strict-aliasing -ggdb -pthread -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O2 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-const-variable -Wno-unused-but-set-variable -Wno-missing-braces -fstack-protector-strong -fno-builtin-memcmp -include js-confdefs.h -Wno-invalid-offsetof -fPIE -DIMPL_MFBT -DJS_USE_CUSTOM_ALLOCATOR -DSTATIC_JS_API=1 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DPCRE_STATIC -DNDEBUG -D_FORTIFY_SOURCE=2 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -Ibuild/opt/third_party/mozjs-45/extract/js/src -Isrc/third_party/mozjs-45/extract/js/src -Ibuild/opt/third_party/mozjs-45/extract/mfbt -Isrc/third_party/mozjs-45/extract/mfbt -Ibuild/opt/third_party/mozjs-45/extract/intl/icu/source/common -Isrc/third_party/mozjs-45/extract/intl/icu/source/common -Ibuild/opt/third_party/mozjs-45/include -Isrc/third_party/mozjs-45/include -Ibuild/opt/third_party/mozjs-45/mongo_sources -Isrc/third_party/mozjs-45/mongo_sources -Ibuild/opt/third_party/mozjs-45/platform/x86_64/linux/build -Isrc/third_party/mozjs-45/platform/x86_64/linux/build -Ibuild/opt/third_party/mozjs-45/platform/x86_64/linux/include -Isrc/third_party/mozjs-45/platform/x86_64/linux/include -Isrc/third_party/zlib-1.2.8 -I/usr/local/include src/third_party/mozjs-45/platform/x86_64/linux/build/Unified_cpp_js_src34.cpp
In file included from src/mongo/db/modules/rocks/src/rocks_engine.h:52:0,
                 from src/mongo/db/modules/rocks/src/rocks_engine.cpp:34:
src/mongo/db/modules/rocks/src/rocks_snapshot_manager.h:63:37: error: 'SnapshotName' does not name a type; did you mean 'Snapshotted'?
     void setCommittedSnapshot(const SnapshotName& name, Timestamp ts) final;
                                     ^~~~~~~~~~~~
                                     Snapshotted
src/mongo/db/modules/rocks/src/rocks_snapshot_manager.h:63:10: error: 'void mongo::RocksSnapshotManager::setCommittedSnapshot(const int&, mongo::Timestamp)' marked 'final', but is not virtual
     void setCommittedSnapshot(const SnapshotName& name, Timestamp ts) final;
          ^~~~~~~~~~~~~~~~~~~~
In file included from src/mongo/db/modules/rocks/src/rocks_snapshot_manager.h:34:0,
                 from src/mongo/db/modules/rocks/src/rocks_engine.h:52,
                 from src/mongo/db/modules/rocks/src/rocks_engine.cpp:34:
src/mongo/db/storage/snapshot_manager.h:72:18: warning: 'virtual void mongo::SnapshotManager::setCommittedSnapshot(const mongo::Timestamp&)' was hidden [-Woverloaded-virtual]
     virtual void setCommittedSnapshot(const Timestamp& timestamp) = 0;
                  ^~~~~~~~~~~~~~~~~~~~
In file included from src/mongo/db/modules/rocks/src/rocks_engine.h:52:0,
                 from src/mongo/db/modules/rocks/src/rocks_engine.cpp:34:
src/mongo/db/modules/rocks/src/rocks_snapshot_manager.h:63:10: warning:   by 'void mongo::RocksSnapshotManager::setCommittedSnapshot(const int&, mongo::Timestamp)' [-Woverloaded-virtual]
     void setCommittedSnapshot(const SnapshotName& name, Timestamp ts) final;
          ^~~~~~~~~~~~~~~~~~~~
In file included from src/mongo/db/modules/rocks/src/rocks_engine.cpp:34:0:
src/mongo/db/modules/rocks/src/rocks_engine.h:205:30: error: cannot declare field 'mongo::RocksEngine::_snapshotManager' to be of abstract type 'mongo::RocksSnapshotManager'
         RocksSnapshotManager _snapshotManager;
                              ^~~~~~~~~~~~~~~~
In file included from src/mongo/db/modules/rocks/src/rocks_engine.h:52:0,
                 from src/mongo/db/modules/rocks/src/rocks_engine.cpp:34:
src/mongo/db/modules/rocks/src/rocks_snapshot_manager.h:44:7: note:   because the following virtual functions are pure within 'mongo::RocksSnapshotManager':
 class RocksSnapshotManager final : public SnapshotManager {
       ^~~~~~~~~~~~~~~~~~~~
In file included from src/mongo/db/modules/rocks/src/rocks_snapshot_manager.h:34:0,
                 from src/mongo/db/modules/rocks/src/rocks_engine.h:52,
                 from src/mongo/db/modules/rocks/src/rocks_engine.cpp:34:
src/mongo/db/storage/snapshot_manager.h:72:18: note:     virtual void mongo::SnapshotManager::setCommittedSnapshot(const mongo::Timestamp&)
     virtual void setCommittedSnapshot(const Timestamp& timestamp) = 0;
                  ^~~~~~~~~~~~~~~~~~~~
In file included from src/mongo/db/modules/rocks/src/rocks_engine.cpp:72:0:
src/mongo/db/modules/rocks/src/rocks_recovery_unit.h:101:25: error: 'SnapshotName' was not declared in this scope
         boost::optional<SnapshotName> getMajorityCommittedSnapshot() const final;
                         ^~~~~~~~~~~~
src/mongo/db/modules/rocks/src/rocks_recovery_unit.h:101:25: note: suggested alternative: 'Snapshotted'
         boost::optional<SnapshotName> getMajorityCommittedSnapshot() const final;
                         ^~~~~~~~~~~~
                         Snapshotted
src/mongo/db/modules/rocks/src/rocks_recovery_unit.h:101:37: error: template argument 1 is invalid
         boost::optional<SnapshotName> getMajorityCommittedSnapshot() const final;
                                     ^
src/mongo/db/modules/rocks/src/rocks_recovery_unit.h:101:39: error: conflicting return type specified for 'virtual int mongo::RocksRecoveryUnit::getMajorityCommittedSnapshot() const'
         boost::optional<SnapshotName> getMajorityCommittedSnapshot() const final;
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/mongo/db/operation_context.h:39:0,
                 from src/mongo/db/storage/snapshot_manager.h:36,
                 from src/mongo/db/modules/rocks/src/rocks_snapshot_manager.h:34,
                 from src/mongo/db/modules/rocks/src/rocks_engine.h:52,
                 from src/mongo/db/modules/rocks/src/rocks_engine.cpp:34:
src/mongo/db/storage/recovery_unit.h:129:40: error:   overriding 'virtual boost::optional<mongo::Timestamp> mongo::RecoveryUnit::getMajorityCommittedSnapshot() const'
     virtual boost::optional<Timestamp> getMajorityCommittedSnapshot() const {
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
scons: *** [build/opt/mongo/db/modules/rocks/src/rocks_engine.o] Error 1
scons: building terminated because of errors.

Do you have any idea what I am missing here?

master is 4 commit ahead of r3.6.2 and I see this part of the code has been changed:

- void RocksSnapshotManager::setCommittedSnapshot(const SnapshotName& name, Timestamp ts) {
+ void RocksSnapshotManager::setCommittedSnapshot(const Timestamp& ts) {
- void setCommittedSnapshot(const SnapshotName& name, Timestamp ts) final;
+ void setCommittedSnapshot(const Timestamp& ts) final;
-    boost::optional<SnapshotName> RocksRecoveryUnit::getMajorityCommittedSnapshot() const {
+    boost::optional<Timestamp> RocksRecoveryUnit::getMajorityCommittedSnapshot() const {
         if (!_readFromMajorityCommittedSnapshot)
             return {};
-        return SnapshotName(_snapshotManager->getCommittedSnapshot().get()->name);
+        return Timestamp(_snapshotManager->getCommittedSnapshot().get()->name);
     }

r3.6.2...master

I will check if it fixes the problem. In that case it would be nice to fix the r3.6.2

building with the current mongodb-partners/mongo-rocks:master instead of mongodb-partners/mongo-rocks:r3.6.2 temporarily fixes the issue. Meanwhile do you think you can update the release r3.6.2 ?

Yes, I updated r3.6.2 to the latest version of v3.6 tag. Thanks for reporting!