Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-72273

Allow for dynamic loose build mode to prevent relinking

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Build

      When I make a modification to src/mongo/db/db_raii.cpp, and recompile the server, it generates 245 "compile tasks" and takes about 2 minutes. It seems like a change to one cpp file should not require all this extra work, especially since I'm using dynamic linking. Here's a sample of the tasks generated:

      (env) ~/code/mongo$ ninja -j200 -v -f debug.ninja install-devcore
      [1/245 (  0%) 28.073s] rm -f build/debug/mongo/db/db_raii.dyn.o; export CCACHE_NOCPP2='1';export CCACHE_PREFIX='/home/matthewsaltz/code/mongo/build/scons/icecream/debug/run-icecc.sh';export PATH='/opt/mongodbtoolchain/v4/bin:/usr/local/bin:/opt/bin:/bin:/usr/bin';/opt/mongodbtoolchain/v4/bin/ccache /opt/mongodbtoolchain/v4/bin/g++ @build/debug/mongo/db/db_raii.dyn.o.rsp
      [2/245 (  0%) 29.422s] rm -f build/debug/mongo/db/libshard_role.so; export CCACHE_NOCPP2='1';export CCACHE_PREFIX='/home/matthewsaltz/code/mongo/build/scons/icecream/debug/run-icecc.sh';export PATH='/opt/mongodbtoolchain/v4/bin:/usr/local/bin:/opt/bin:/bin:/usr/bin';/usr/bin/icerun /opt/mongodbtoolchain/v4/bin/g++ @build/debug/mongo/db/libshard_role.so.rsp
      [3/245 (  1%) 29.431s] rm -f build/install/lib/libshard_role.so; ln build/debug/mongo/db/libshard_role.so build/install/lib/libshard_role.so || install build/debug/mongo/db/libshard_role.so build/install/lib/libshard_role.so
      [4/245 (  1%) 30.438s] rm -f build/debug/mongo/db/stats/liblatency_server_stats.so; export CCACHE_NOCPP2='1';export CCACHE_PREFIX='/home/matthewsaltz/code/mongo/build/scons/icecream/debug/run-icecc.sh';export PATH='/opt/mongodbtoolchain/v4/bin:/usr/local/bin:/opt/bin:/bin:/usr/bin';/usr/bin/icerun /opt/mongodbtoolchain/v4/bin/g++ @build/debug/mongo/db/stats/liblatency_server_stats.so.rsp
      [5/245 (  2%) 30.441s] rm -f build/install/lib/liblatency_server_stats.so; ln build/debug/mongo/db/stats/liblatency_server_stats.so build/install/lib/liblatency_server_stats.so || install build/debug/mongo/db/stats/liblatency_server_stats.so build/install/lib/liblatency_server_stats.so
      [6/245 (  2%) 30.452s] rm -f build/debug/mongo/db/storage/liboplog_cap_maintainer_thread.so; export CCACHE_NOCPP2='1';export CCACHE_PREFIX='/home/matthewsaltz/code/mongo/build/scons/icecream/debug/run-icecc.sh';export PATH='/opt/mongodbtoolchain/v4/bin:/usr/local/bin:/opt/bin:/bin:/usr/bin';/usr/bin/icerun /opt/mongodbtoolchain/v4/bin/g++ @build/debug/mongo/db/storage/liboplog_cap_maintainer_thread.so.rsp
      [7/245 (  2%) 30.455s] rm -f build/install/lib/liboplog_cap_maintainer_thread.so; ln build/debug/mongo/db/storage/liboplog_cap_maintainer_thread.so build/install/lib/liboplog_cap_maintainer_thread.so || install build/debug/mongo/db/storage/liboplog_cap_maintainer_thread.so build/install/lib/liboplog_cap_maintainer_thread.so
      [8/245 (  3%) 30.465s] rm -f build/debug/mongo/db/repl/libreplication_consistency_markers_impl.so; export CCACHE_NOCPP2='1';export CCACHE_PREFIX='/home/matthewsaltz/code/mongo/build/scons/icecream/debug/run-icecc.sh';export PATH='/opt/mongodbtoolchain/v4/bin:/usr/local/bin:/opt/bin:/bin:/usr/bin';/usr/bin/icerun /opt/mongodbtoolchain/v4/bin/g++ @build/debug/mongo/db/repl/libreplication_consistency_markers_impl.so.rsp
      [9/245 (  3%) 30.469s] rm -f build/install/lib/libreplication_consistency_markers_impl.so; ln build/debug/mongo/db/repl/libreplication_consistency_markers_impl.so build/install/lib/libreplication_consistency_markers_impl.so || install build/debug/mongo/db/repl/libreplication_consistency_markers_impl.so build/install/lib/libreplication_consistency_markers_impl.so
      [10/245 (  4%) 30.520s] rm -f build/debug/mongo/db/catalog/libvalidate_state.so; export CCACHE_NOCPP2='1';export CCACHE_PREFIX='/home/matthewsaltz/code/mongo/build/scons/icecream/debug/run-icecc.sh';export PATH='/opt/mongodbtoolchain/v4/bin:/usr/local/bin:/opt/bin:/bin:/usr/bin';/usr/bin/icerun /opt/mongodbtoolchain/v4/bin/g++ @build/debug/mongo/db/catalog/libvalidate_state.so.rsp
      [11/245 (  4%) 30.524s] rm -f build/install/lib/libvalidate_state.so; ln build/debug/mongo/db/catalog/libvalidate_state.so build/install/lib/libvalidate_state.so || install build/debug/mongo/db/catalog/libvalidate_state.so build/install/lib/libvalidate_state.so
      

      Here's the function I used to build debug.ninja:

         function buildninjaicdebug() {
             python ./buildscripts/scons.py  \
                 --variables-files=etc/scons/mongodbtoolchain_stable_gcc.vars \
                 MONGO_VERSION=$(git describe --abbrev=0 | tail -c+2) \
                 --ssl --dbg --opt=off --link-model=dynamic \
                 VARIANT_DIR=debug \
                 --ninja generate-ninja ICECC=icecc CCACHE=ccache NINJA_PREFIX=debug
         }
      

      For a full repro this should do it:

             python ./buildscripts/scons.py  \
                 --variables-files=etc/scons/mongodbtoolchain_stable_gcc.vars \
                 MONGO_VERSION=$(git describe --abbrev=0 | tail -c+2) \
                 --ssl --dbg --opt=off --link-model=dynamic \
                 VARIANT_DIR=debug \
                 --ninja generate-ninja ICECC=icecc CCACHE=ccache NINJA_PREFIX=debug
             ninja -j200 -f debug.ninja install-devcore
             touch src/mongo/db/db_raii.cpp
             ninja -j200 -f debug.ninja install-devcore
      

        1. dynamic_mongod_ninja_db_raii_j1.log
          92 kB
          Daniel Gottlieb
        2. dynamic_mongod_ninja_db_raii_j300.log
          92 kB
          Daniel Gottlieb

            Assignee:
            Unassigned Unassigned
            Reporter:
            matthew.saltz@mongodb.com Matthew Saltz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated: