-
Notifications
You must be signed in to change notification settings - Fork 61
Development Processes
This document describes two things:
- git
- cmake >= 2.8.10
- zlib development files
- gcc and g++ >= 4.8.2
- scons
To begin, clone percona/PerconaFT, percona/jemalloc and percona/percona-server-mongodb:
git clone [email protected]:percona/PerconaFT
git clone [email protected]:percona/jemalloc
git clone [email protected]:percona/percona-server-mongodb
Alternatively, use:
git clone https://github.com/percona/PerconaFT.git
git clone https://github.com/percona/jemalloc.git
git clone https://github.com/percona/percona-server-mongodb.git
Now select the relevant git branch or git tag for each repo. Note: Most git branches are expected to be in flux and possibly unstable. Stable builds can be created from Release and Release Candidate tags that should match across the above repositories. To create one of these stable builds check out the most recent stable tag for each repo, for example:
cd percona-server-mongodb
git checkout tokumxse-1.0.0-rc.4
cd ..
cd PerconaFT
git checkout tokumxse-1.0.0-rc.4
cd ..
cd jemalloc
git checkout tokumxse-1.0.0-rc.4
cd ..
First, create a symlink for jemalloc
inside the fractal tree directory tree.
cd PerconaFT
ln -s $PWD/../jemalloc third_party/
cd ..
Now create the build environment for the fractal tree. You can create either a debug or release version. Once the respective build directory is assembled by cmake, you can run make install
to build. Note: We want to "install" the resultant binaries somewhere specific using the CMAKE_INSTALL_PREFIX argument.
-
For a debug build:
cd PerconaFT mkdir dbg cd dbg cmake \ -D CMAKE_BUILD_TYPE=Debug \ -D USE_VALGRIND=ON \ -D TOKU_DEBUG_PARANOID=ON \ -D BUILD_TESTING=OFF \ -D CMAKE_INSTALL_PREFIX=$PWD/install \ .. make install
-
For a release build:
cd PerconaFT mkdir opt cd opt cmake \ -D CMAKE_BUILD_TYPE=Release \ -D USE_VALGRIND=OFF \ -D TOKU_DEBUG_PARANOID=OFF \ -D BUILD_TESTING=OFF \ -D CMAKE_INSTALL_PREFIX=$PWD/install \ .. make install
###Symlink the Fractal Tree
Next, make a symlink from inside the percona-server-mongodb
repo to our chosen "install directory" where the recently built PerconaFT
libraries live:
-
For a debug build:
cd percona-server-mongodb ln -s $PWD/../PerconaFT/dbg/install src/third_party/tokuft
-
For a release build:
cd percona-server-mongodb ln -s $PWD/../PerconaFT/opt/install src/third_party/tokuft
Finally, invoke scons
from inside the percona-server-mongodb repo with the following options;
NOTE: For TokuMX-SE release candidates 4 and lower need to use this SCons line to build:
scons --extrapath=$PWD/src/third_party/tokuft --tokuft --allocator=jemalloc mongod mongos mongo
NOTE: Mongo has removed the above option for adding extra directories for linking and header inclusion. The new API, used for newer TokuMX-SE release candidates, requires different arguments. You need to use this SCons line to build:
scons CPPPATH=$PWD/src/third_party/tokuft/include LIBPATH=$PWD/src/third_party/tokuft/lib --tokuft --allocator=jemalloc mongod mongos mongo
NOTE: To build any version of Percona Server for MongoDB use --PerconaFT
argument instead of --tokuft
used for previous versions:
scons CPPPATH=$PWD/src/third_party/tokuft/include LIBPATH=$PWD/src/third_party/tokuft/lib --PerconaFT --allocator=jemalloc mongod mongos mongo
NOTE: To build Percona Server for MongoDB with audit logging support add --audit
argument to scons
command line:
scons CPPPATH=$PWD/src/third_party/tokuft/include LIBPATH=$PWD/src/third_party/tokuft/lib --PerconaFT --audit --allocator=jemalloc mongod mongos mongo
If you like, you can add --dbg=[on|off] --opt=[on|off]
or -jN
to scons
. --mute
is also quite nice.
You can run some C++ unit tests with scons:
scons --extrapath=$PWD/src/third_party/tokuft --tokuft --allocator=jemalloc smokeCppUnittests
You can also run some javascript tests with smoke.py
once mongod
, mongos
, and mongo
are built:
python buildscripts/smoke.py --storageEngine=PerconaFT jsCore
Apart from jsCore
you can also run other suites, refer to this map for all of them.
Upstream MongoDB manages multi-version development by maintaining separate branches for each stable minor version (v2.4
, v2.6
, v3.0
), as well as an active development branch (master
), and they cherry-pick
any changes that need to hit multiple branches. We do the same for master
and v3.0
. About once a day, check for upstream changes (on branches master
and v3.0
), and if there are some, go ahead and merge them to percona-server-mongodb
:
-
If you haven't set it up already, create an
upstream
remote in your git checkout ofpercona-server-mongodb
:git remote add upstream https://github.com/mongodb/mongo
-
Fetch new commits from upstream:
git fetch upstream
-
Make sure your
master
andv3.0
branches are up to date:git checkout master git pull git checkout v3.0 git pull
-
Into each branch, merge the corresponding upstream branch:
git checkout master git merge upstream/master git checkout v3.0 git merge upstream/v3.0
-
Try building. If they've removed or added part of the API, you should notice with a failed compile. You can also watch the
src/mongo/db/storage
directory for interesting looking changes that might break things.Additionally, there's a mechanism that makes sure that the "assert ids" are unique. You may see a build fail with a message like this:
DUPLICATE IDS: 28610 ./src/mongo/db/storage/tokuft/tokuft_init.cpp:75:fassertFailedNoTrace(28610); ./src/mongo/db/repl/replication_coordinator_impl.cpp:2275:fassert(28610, cbh.getStatus()); next id to use:28620
In this case, this means that upstream, they've added a new assert id that conflicts with one we had already. To avoid conflicts, we should change ours, so in the above example, you'd go to
tokuft_init.cpp
and change28610
to28620
. Then commit the change on eithermaster
orv3.0
, and make sure you cherry-pick it to the other branch as well. For example, this particular conflict was fixed by this commit onmaster
and this commit onv3.0
.