bytedance / terarkdb

A RocksDB compatible KV storage engine with better performance
Apache License 2.0
2.04k stars 203 forks source link

error when trying to modify code to force use terarkzip without binding code modifications #238

Open hiqsociety opened 2 years ago

hiqsociety commented 2 years ago

tried to force terarkzip table as default but it's not compiled.

i edited the options/options.cc file to force it to use terarkzip as default coz it's difficult to write binding for the programming language i'm using.

[ 91%] Linking CXX executable cache_bench
[ 92%] Linking CXX executable column_aware_encoding_exp
/usr/bin/ld: libterarkdb.a(options.cc.o): in function `terarkdb::ColumnFamilyOptions::ColumnFamilyOptions()':
/go/src/github.com/terarkdb/options/options.cc:130: undefined reference to `terarkdb::NewTerarkZipTableFactory(terarkdb::TerarkZipTableOptions const&, std::shared_ptr<terarkdb::TableFactory>)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/hash_table_bench.dir/build.make:95: hash_table_bench] Error 1
make[1]: *** [CMakeFiles/Makefile2:303: CMakeFiles/hash_table_bench.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: libterarkdb.a(options.cc.o): in function `terarkdb::ColumnFamilyOptions::ColumnFamilyOptions()':
/go/src/github.com/terarkdb/options/options.cc:130: undefined reference to `terarkdb::NewTerarkZipTableFactory(terarkdb::TerarkZipTableOptions const&, std::shared_ptr<terarkdb::TableFactory>)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/cache_bench.dir/build.make:95: cache_bench] Error 1
make[1]: *** [CMakeFiles/Makefile2:373: CMakeFiles/cache_bench.dir/all] Error 2
[ 92%] Linking CXX executable memtablerep_bench
/usr/bin/ld: libterarkdb.a(options.cc.o): in function `terarkdb::ColumnFamilyOptions::ColumnFamilyOptions()':
/go/src/github.com/terarkdb/options/options.cc:130: undefined reference to `terarkdb::NewTerarkZipTableFactory(terarkdb::TerarkZipTableOptions const&, std::shared_ptr<terarkdb::TableFactory>)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/column_aware_encoding_exp.dir/build.make:95: column_aware_encoding_exp] Error 1
make[1]: *** [CMakeFiles/Makefile2:267: CMakeFiles/column_aware_encoding_exp.dir/all] Error 2
/usr/bin/ld: libterarkdb.a(options.cc.o): in function `terarkdb::ColumnFamilyOptions::ColumnFamilyOptions()':
/go/src/github.com/terarkdb/options/options.cc:130: undefined reference to `terarkdb::NewTerarkZipTableFactory(terarkdb::TerarkZipTableOptions const&, std::shared_ptr<terarkdb::TableFactory>)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/memtablerep_bench.dir/build.make:95: memtablerep_bench] Error 1
make[1]: *** [CMakeFiles/Makefile2:409: CMakeFiles/memtablerep_bench.dir/all] Error 2
/*
ColumnFamilyOptions::ColumnFamilyOptions()
    : compression(Snappy_Supported() ? kSnappyCompression : kNoCompression),
      table_factory(
          std::shared_ptr<TableFactory>(new BlockBasedTableFactory())) {}
*/

ColumnFamilyOptions::ColumnFamilyOptions()
    : compression(Snappy_Supported() ? kSnappyCompression : kNoCompression),
      table_factory(
          std::shared_ptr<TableFactory>(new BlockBasedTableFactory())) {
  terarkdb::TerarkZipTableOptions tzt_options;
i edited the options/options.cc file as previously mentioned to force it to use terarkzip as default coz it's difficult to write binding for the programming language i'm using.
  tzt_options.localTempDir = "/tmp";
  tzt_options.indexNestLevel = 3;
  tzt_options.sampleRatio = 0.01;
  tzt_options.terarkZipMinLevel = 2; // Start using TerarkZipTable from level 2
  // reset table...
  table_factory.reset(
        NewTerarkZipTableFactory(tzt_options, table_factory));
}
yapple commented 2 years ago

can you provide your Cmake options?

hiqsociety commented 2 years ago

i used the standard

WITH_TESTS=OFF WITH_ZNS=OFF ./build.sh

i edited the options/options.cc file as previously mentioned to force it to use terarkzip as default coz it's difficult to write binding for the programming language i'm using.

below cmake


MESSAGE("[terarkdb] cmake install prefix: ${CMAKE_INSTALL_PREFIX}")
SET(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
SET(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}/bin)

if (TERARK_INCLUDE_PREFIX)
  SET(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include/${TERARK_INCLUDE_PREFIX})
else()
  SET(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include)
endif()

# Enable or disable flags
option(WITH_COVERAGE "build with gcov support" OFF)
option(WITH_JEMALLOC "build with JeMalloc" ON)
option(WITH_SNAPPY "build with SNAPPY" ON)
option(WITH_LZ4 "build with lz4" ON)
option(WITH_ZLIB "build with zlib" ON)
option(WITH_ZSTD "build with zstd" ON)
option(WITH_BZ2 "build with bzip2" ON)
option(WITH_WINDOWS_UTF8_FILENAMES "use UTF8 as characterset for opening files, regardles of the system code page" OFF)
option(WITH_BYTEDANCE_METRICS "build with bytedance internal metrics" OFF)
option(WITH_ASAN "build with ASAN" OFF)
option(WITH_GFLAGS "build with GFlags" ON)
include(CMakeDependentOption)
# Tests are excluded from Release builds
CMAKE_DEPENDENT_OPTION(WITH_TESTS "build with tests" ON "CMAKE_BUILD_TYPE STREQUAL Debug" OFF)
option(WITH_TOOLS "build with tools" OFF)
option(WITH_TERARK_ZIP "build with TerarkZipTable support" ON)
option(WITH_ZENFS "build with experimental zenfs" OFF)
option(WITH_DIAGNOSE_CACHE "build with diagnosable cache support" OFF)
option(WITH_BOOSTLIB "build with boost, if WITH_TERARK_ZIP is ON, this will also set to ON" OFF)
option(WITH_TERARKDB_NAMESPACE "namespace" "terarkdb")
hiqsociety commented 2 years ago

hi, any updates on this?