Build Issue
- Follow steps in wiki, error happens.
port/port_posix.cc:31:10: fatal error: terark/util/fast_getcpu.hpp: No such file or directory
#include <terark/util/fast_getcpu.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
- Besides, the
MADV_COLDflag for madvise seems not available in linux kernel version 5.4.0-120-generic. Which version is the appropriate kernel version? Or any other depedencies?
- fast_getcpu.hpp
Fixed, please update
<ToplingDBDir>/sidepulgin/topling-zip:
cd sideplugin/topling-zip
git pull
- MADV_COLD Fixed, when MADV_COLD is not defined, we issue a warning.
cd sideplugin/cspp-memtab
git pull
Upstream RocksDB code has drawback when user code pinning snapshot for long time: MemTable will be pinned by such snapshots, we have observed in MyTopling(forked from MyRocks), this will cause very high memory usage, dozens of MemTables can not be released, but these MemTables are rarely accessed, so we use madvise(MADV_COLD) on CSPP's memory block.
This is another advantage of CSPPMemTable compared to RocksDB's builtin MemTable, because CSPPMemTable has only one large chunk of memory.
Another issue which may be caused by newly introduced code:
src/terark/util/sortable_strvec.cpp: In function ‘void terark::byte_swap_in(terark::uint128_t&, mpl_::true_)’:
src/terark/util/sortable_strvec.cpp:1183:6: error: ‘__builtin_bswap128’ was not declared in this scope; did you mean ‘__builtin_bswap32’?
1183 | x = __builtin_bswap128(x);
| ^~~~~~~~~~~~~~~~~~
| __builtin_bswap32
# cc1plus 3.30 0.24
make[1]: *** [build/Linux-x86_64-g++-9.4-bmi2-0/rls/src/terark/util/sortable_strvec.o] Error 1
make: *** [sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-zbs-g++-9.4-r.so] Error 2
__builtin_bswap128 requires newer compiler(gcc11+), fixed with a workaround.
this is in repo topling-zip
- The boost library has been installed in my host. But when build db_bench:
ln -fs librocksdb.so.7.6.0 librocksdb.so
CCLD db_bench
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘boost::fibers::context::terminate()’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-zbs-g++-9.4-r.so:undefined reference to ‘boost::fibers::context::active()’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘boost::fibers::context::active_pp()’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘boost::fibers::scheduler::schedule(boost::fibers::context*)’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘jump_fcontext’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘boost::fibers::context::~context()’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-zbs-g++-9.4-r.so:undefined reference to ‘boost::fibers::scheduler::yield(boost::fibers::context*)’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘boost::fibers::fiber::join()’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘typeinfo for boost::fibers::context’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘boost::fibers::scheduler::suspend()’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘make_fcontext’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘boost::context::stack_traits::default_size()’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘ontop_fcontext’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘boost::fibers::fiber::start_()’
sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-core-g++-9.4-r.so:undefined reference to ‘boost::fibers::context::schedule(boost::fibers::context*)’
collect2: error: ld returned 1 exit status
Makefile:1491: recipe for target 'db_bench' failed
make: *** [db_bench] Error 1
This is caused by previous failed compilation was not gracefully cleaned, following instructions:
rm -rf sideplugin/topling-zip/build/*/lib*
rm `find sideplugin/topling-zip -name '*.done'`
make DEBUG_LEVEL=0 db_bench -j`nproc`
- Build successed. And segment fault happenes when run dbbench
~/toplingdb# ./db_bench -json lcompact_community.yaml -num 10000000 -disable_wal=true -value_size 2000 -benchmarks=fillrandom,readrandom -batch_size=10
WARN: MADV_POPULATE_READ requires kernel 5.14+, fallback to mlock
Set seed to 1660284118930594 because --seed was 0
Initializing RocksDB Options from the specified file
Initializing RocksDB Options from command-line flags
Integrated BlobDB: blob cache disabled
RocksDB: version 7.6.0
Date: Fri Aug 12 14:01:59 2022
CPU: 24 * Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
CPUCache: 15360 KB
Keys: 16 bytes each (+ 0 bytes user-defined timestamp)
Values: 2000 bytes each (1000 bytes after compression)
Entries: 10000000
Prefix: 0 bytes
Keys per prefix: 0
RawSize: 19226.1 MB (estimated)
FileSize: 9689.3 MB (estimated)
Write rate: 0 bytes/second
Read rate: 0 ops/second
Compression: Snappy
Compression sampling rate: 0
Memtablerep: CSPPMemTabFactory
Perf Level: 1
------------------------------------------------
Initializing RocksDB Options from the specified file
Initializing RocksDB Options from command-line flags
Integrated BlobDB: blob cache disabled
free(): invalid pointer
Received signal 6 (Aborted)
#0 /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x7f97262b1e87] ?? ??:0
#1 /lib/x86_64-linux-gnu/libc.so.6(abort+0x141) [0x7f97262b37f1] ?? ??:0
#2 /lib/x86_64-linux-gnu/libc.so.6(+0x89837) [0x7f97262fc837] ?? ??:0
#3 /lib/x86_64-linux-gnu/libc.so.6(+0x908ba) [0x7f97263038ba] ?? ??:0
#4 /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4dc) [0x7f972630adec] ?? ??:0
#5 /lib/x86_64-linux-gnu/libc.so.6(fclose+0xae) [0x7f97262f12ae] ?? ??:0
#6 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb19PosixSequentialFileD1Ev+0x25) [0x7f9728e12b55] ?? ??:0
#7 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb19PosixSequentialFileD0Ev+0x9) [0x7f9728e12b89] ?? ??:0
#8 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb16ReadFileToStringEPNS_10FileSystemERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPS7_+0x119) [0x7f9728dfbba9] ?? ??:0
#9 /root/toplingdb/librocksdb.so.7.6(_ZNK7rocksdb6DBImpl29GetDbIdentityFromIdentityFileEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xe9) [0x7f9728c2b039] ?? ??:0
#10 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb6DBImpl5NewDBEPSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EE+0x29a) [0x7f9728c9074a] ?? ??:0
#11 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb6DBImpl7RecoverERKSt6vectorINS_22ColumnFamilyDescriptorESaIS2_EEbbbPmPNS0_15RecoveryContextE+0x112e) [0x7f9728c9da7e] ?? ??:0
#12 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb6DBImpl4OpenERKNS_9DBOptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorINS_22ColumnFamilyDescriptorESaISD_EEPSC_IPNS_18ColumnFamilyHandleESaISJ_EEPPNS_2DBEbb+0x79d) [0x7f9728c93f2d] ?? ??:0
#13 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb2DB4OpenERKNS_9DBOptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorINS_22ColumnFamilyDescriptorESaISD_EEPSC_IPNS_18ColumnFamilyHandleESaISJ_EEPPS0_+0x22) [0x7f9728c961c2] ?? ??:0
#14 /root/toplingdb/librocksdb.so.7.6(+0x466385) [0x7f972893b385] ?? ??:0
#15 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb13PluginFactoryIPNS_10DB_MultiCFEE13AcquirePluginERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN8nlohmann10basic_jsonIN6terark10JsonStrMapESt6vectorS9_blmdSaNSC_14adl_serializerESG_IhSaIhEEEERKNS_14SidePluginRepoE+0x6a) [0x7f9728a932aa] ?? ??:0
#16 /root/toplingdb/librocksdb.so.7.6(+0x600a06) [0x7f9728ad5a06] ?? ??:0
#17 /root/toplingdb/librocksdb.so.7.6(+0x600f44) [0x7f9728ad5f44] ?? ??:0
#18 /root/toplingdb/librocksdb.so.7.6(+0x6013cf) [0x7f9728ad63cf] ?? ??:0
#19 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb14SidePluginRepo6OpenDBERKN8nlohmann10basic_jsonIN6terark10JsonStrMapESt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS1_14adl_serializerES5_IhSaIhEEEEPPNS_10DB_MultiCFE+0x1e) [0x7f9728ad648e] ?? ??:0
#20 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb14SidePluginRepo6OpenDBEPPNS_10DB_MultiCFE+0x3e) [0x7f9728ad64ee] ?? ??:0
#21 ./db_bench(+0x48b69) [0x5638d9f5fb69] ?? ??:0
#22 ./db_bench(+0x4e12b) [0x5638d9f6512b] ?? ??:0
#23 ./db_bench(+0x6682c) [0x5638d9f7d82c] ?? ??:0
#24 ./db_bench(+0x2b1dd) [0x5638d9f421dd] ?? ??:0
#25 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f9726294c87] ?? ??:0
#26 ./db_bench(+0x2a39a) [0x5638d9f4139a] ?? ??:0
- And my configuration is lcompact_community.yaml. We only modify
document_rootandpath
It's weird, does your path exists?
Did you try default path /dev/shm/strings?
Is it another rocksdb in your system include path(such as /usr/include)?
- The path
/root/toplingdb_dataexists. - And I tried to use default path and re-run. The error changed.
~/toplingdb# ./db_bench -json lcompact_community.yaml -num 10000000 -disable_wal=true -value_size 2000 -benchmarks=fillrandom,readrandom -batch_size=10
WARN: MADV_POPULATE_READ requires kernel 5.14+, fallback to mlock
Set seed to 1660290759794853 because --seed was 0
Initializing RocksDB Options from the specified file
Initializing RocksDB Options from command-line flags
Integrated BlobDB: blob cache disabled
RocksDB: version 7.6.0
Date: Fri Aug 12 15:52:39 2022
CPU: 24 * Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
CPUCache: 15360 KB
Keys: 16 bytes each (+ 0 bytes user-defined timestamp)
Values: 2000 bytes each (1000 bytes after compression)
Entries: 10000000
Prefix: 0 bytes
Keys per prefix: 0
RawSize: 19226.1 MB (estimated)
FileSize: 9689.3 MB (estimated)
Write rate: 0 bytes/second
Read rate: 0 ops/second
Compression: Snappy
Compression sampling rate: 0
Memtablerep: CSPPMemTabFactory
Perf Level: 1
------------------------------------------------
Initializing RocksDB Options from the specified file
Initializing RocksDB Options from command-line flags
Integrated BlobDB: blob cache disabled
DB path: [/dev/shm/strings]
Received signal 4 (Illegal instruction)
#0 sideplugin/topling-zip/build/Linux-x86_64-g++-9.4-bmi2-0/lib_shared/libterark-fsa-g++-9.4-r.so(_ZN6terark12MainPatricia19insert_multi_writerENS_13basic_fstringIcEEPvPNS_8Patricia11WriterTokenE+0xef) [0x7f052b84501f] ?? ??:0
#1 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb10CSPPMemTab5Token9insert_kvEN6terark13basic_fstringIcEENS_5SliceE+0x5a) [0x7f052e49668a] ?? ??:0
#2 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb10CSPPMemTab14InsertKeyValueERKNS_5SliceES3_+0x64) [0x7f052e498614] ?? ??:0
#3 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb8MemTable3AddEmNS_9ValueTypeERKNS_5SliceES4_PKNS_18ProtectionInfoKVOSImEEbPNS_23MemTablePostProcessInfoEPPv+0x651) [0x7f052e8becd1] ?? ??:0
#4 /root/toplingdb/librocksdb.so.7.6(+0x8f30e4) [0x7f052e9670e4] ?? ??:0
#5 /root/toplingdb/librocksdb.so.7.6(+0x8f468f) [0x7f052e96868f] ?? ??:0
#6 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb18WriteBatchInternal7IterateEPKNS_10WriteBatchEPNS1_7HandlerEmm+0x684) [0x7f052e962284] ?? ??:0
#7 /root/toplingdb/librocksdb.so.7.6(_ZNK7rocksdb10WriteBatch7IterateEPNS0_7HandlerE+0x8a) [0x7f052e962d8a] ?? ??:0
#8 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb18WriteBatchInternal10InsertIntoERNS_11WriteThread10WriteGroupEmPNS_21ColumnFamilyMemTablesEPNS_14FlushSchedulerEPNS_20TrimHistorySchedulerEbmPNS_2DBEbbb+0x19f) [0x7f052e96349f] ?? ??:0
#9 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb6DBImpl9WriteImplERKNS_12WriteOptionsEPNS_10WriteBatchEPNS_13WriteCallbackEPmmbS8_mPNS_18PreReleaseCallbackEPNS_20PostMemTableCallbackE+0x10c6) [0x7f052e85eae6] ?? ??:0
#10 /root/toplingdb/librocksdb.so.7.6(_ZN7rocksdb6DBImpl5WriteERKNS_12WriteOptionsEPNS_10WriteBatchE+0x6f) [0x7f052e85fd8f] ?? ??:0
#11 ./db_bench(+0x6bd7d) [0x563ccc840d7d] ?? ??:0
#12 ./db_bench(+0x4be07) [0x563ccc820e07] ?? ??:0
#13 /root/toplingdb/librocksdb.so.7.6(+0x92445b) [0x7f052e99845b] ?? ??:0
#14 /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db) [0x7f052da566db] ?? ??:0
#15 /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f052bf3361f] ?? ??:0
illegal instruction (core dumped)
- There is no another rocksdb in our system include path.
I noticed your CPU is E5-2620 v2 which is older than haswell, you need to recompile topling-zip with CPU=-march=native:
cd sideplugin/topling-zip
make clean
cd ..
make -j`nproc` DEBUG_LEVEL=0 CPU=-march=native db_bench
We assume the CPU is at least haswell and didn't use CPU=-march=native for compatible to which compiling on very newer CPU and run on haswell. On older CPU, explicitly set CPU=-march=native is required.
Build and run successfully. Thanks~