Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法编译安装,已下载lib包 #2

Open
chinyajie opened this issue Aug 13, 2018 · 13 comments
Open

无法编译安装,已下载lib包 #2

chinyajie opened this issue Aug 13, 2018 · 13 comments

Comments

@chinyajie
Copy link

chinyajie commented Aug 13, 2018

您好,我在网上找到了terarkdb的视频演讲和ppt,然后尝试安装,我之前有过源码安装myrocks的经历,但是在安装terarkdb过程中依然被困住了。我分别尝试使用centos6.3(gcc4.8.2)和centos6.9(gcc4.8.2)安装,都遇到了同样的问题。

我按照官方文档 https://github.com/Terark/mysql-on-terarkdb/wiki/Installation 安装,其中因为是centos使用的是yum。但是在cmake的时候出现一下错误(两台电脑都是一样的错误)。
image

-- Library fbmysqlclient depends on OSLIBS -lpthread;m;rt;/usr/lib64/libssl.so;/usr/lib64/libcrypto.so;dl
-- Googletest was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.
-- If you are inside a firewall, you may need to use an https proxy: export https_proxy=http://example.com:80
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;/usr/lib64/libssl.so;/usr/lib64/libcrypto.so;dl;crypt;-Wl,--whole-archive;/root/terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0/lib_static/libterark-zip-rocksdb-r.a;/root/terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0/lib_static/libterark-zbs-r.a;/root/terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0/lib_static/libterark-fsa-r.a;/root/terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0/lib_static/libterark-core-r.a;-Wl,--no-whole-archive;-lcrypto;/root/mysql-on-terarkdb/mysql-5.6/bld/storage/rocksdb/librocksdb_se.a;-ldl;-lgomp;-lz;-lrt;aio
RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at scripts/CMakeLists.txt:293 (IF):
if given arguments:

"NOT" "lib" "STREQUAL" "general" "AND" "NOT" "LIBS" "MATCHES" "-l/root/terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0/lib_static/libterark-zip-rocksdb-r.a "

Regular expression
"-l/root/terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0/lib_static/libterark-zip-rocksdb-r.a
" cannot compile
Call Stack (most recent call first):
scripts/CMakeLists.txt:313 (EXTRACT_LINK_LIBRARIES)

-- Configuring incomplete, errors occurred!
See also "/root/mysql-on-terarkdb/mysql-5.6/bld/CMakeFiles/CMakeOutput.log".
See also "/root/mysql-on-terarkdb/mysql-5.6/bld/CMakeFiles/CMakeError.log".

然后我尝试在编译的时候线不引入静态库。事实上我是单独再次下载你们提供的mysql5.6和terark-zip-rocksdb,以及之前的官网的静态库。然后我按照安装facebook版本的myrocks的方法顺利的安装了mysql5.6。等到该启动的时候,我想应该至少在这个时候引入动态库了,但是还是失败了,显示but dynamic libterark-zip-rocksdb is not loaded,并没有按照命令加载.so


mkdir terark-tempdir
sudo chown -R mysql:mysql terark-tempdir
sudo env \
  LD_LIBRARY_PATH=/root/terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0/lib:$LD_LIBRARY_PATH \
  LD_PRELOAD=libterark-zip-rocksdb-r.so \
  TerarkZipTable_localTempDir=$PWD/terark-tempdir \
  bin/mysqld

image


2018-08-13 10:27:05 15785 [Warning] The option innodb (skip-innodb) is deprecated and will be removed in a future release
2018-08-13 10:27:05 15785 [Note] Plugin 'InnoDB' is disabled.
2018-08-13 10:27:05 15785 [Note] Plugin 'FEDERATED' is disabled.
2018-08-13 10:27:05 15785 [Note] RocksDB: 2 column families found
2018-08-13 10:27:05 15785 [Note] RocksDB: Column Families at start:
2018-08-13 10:27:05 15785 [Note] cf=default
2018-08-13 10:27:05 15785 [Note] write_buffer_size=67108864
2018-08-13 10:27:05 15785 [Note] target_file_size_base=67108864
2018-08-13 10:27:05 15785 [Note] cf=system
2018-08-13 10:27:05 15785 [Note] write_buffer_size=67108864
2018-08-13 10:27:05 15785 [Note] target_file_size_base=67108864
2018-08-13 10:27:05 15785 [ERROR] RocksDB: Error opening instance, Status Code: 4, Status: Invalid argument: env TerarkZipTable_localTempDir is defined, but dynamic libterark-zip-rocksdb is not loaded
2018-08-13 10:27:05 15785 [ERROR] Plugin 'ROCKSDB' init function returned error.
2018-08-13 10:27:05 15785 [ERROR] Plugin 'ROCKSDB' registration as a STORAGE ENGINE failed.
2018-08-13 10:27:05 15785 [ERROR] Unknown/unsupported storage engine: rocksdb
2018-08-13 10:27:05 15785 [ERROR] Aborting

2018-08-13 10:27:05 15785 [Note] Binlog end
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'partition'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'rpl_semi_sync_slave'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'rpl_semi_sync_master'
2018-08-13 10:27:05 15785 [Note] unregister_replicator OK
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_DOCSTORE_FIELDS'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_FILE_STATUS'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2018-08-13 10:27:05 15785 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'

我做了最后的尝试,打算在init的时候就把so加到env

sudo env \
  LD_LIBRARY_PATH=/root/terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-0/lib:$LD_LIBRARY_PATH \
  LD_PRELOAD=libterark-zip-rocksdb-r.so \
  TerarkZipTable_localTempDir=$PWD/terark-tempdir \
  scripts/mysql_install_db --defaults-file=/etc/my.cnf

但是显示libterark-zip-rocksdb-r.so 文件里面有 undefined symbol: _ZN7rocksdb5Arena13kMinBlockSizeE

请你们帮帮我,我花了一个下午也没能安装上

@chinyajie
Copy link
Author

我用 1Ubuntu6.04.3 gcc5,也是一样的问题。。。

@rockeet
Copy link
Member

rockeet commented Aug 13, 2018

RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at scripts/CMakeLists.txt:293 (IF):

这个错误是 CMake 的 bug,CMake 把路径名当作正则表达式做某种匹配,你需要把下载的 terark 库所在的目录改名,目录 的全路径中不能包含 +

另外,编译 myrocks 时,rocksdb 需要动态链接,万一出现

undefined symbol: _ZN7rocksdb5Arena13kMinBlockSizeE

需要在 LD_PRELOAD 中再加上 librocksdb.so

@chinyajie
Copy link
Author

@rockeet 非常感谢您的回复。
修改了lib包的名字(去掉加号)后就可以cmake了。但是make的时候又出错了,很多文件的名字路径竟然是/home/leipeng/这应该是lib包里面的静态库文件中的,dan'shi'wo'yi但是我已经export WITH_TERARKDB,不知道为什么报错

image

@rockeet
Copy link
Member

rockeet commented Aug 13, 2018

这个看样子是没找到 rocksdb 的库,先早点休息,我明天仔细看看

@chinyajie
Copy link
Author

@rockeet 谢谢了,晚安

@chinyajie
Copy link
Author

@rockeet 您昨天提到的缺少rocksdb库是原生rocksdb库吗?我尝试拿rocksdb原生代码make shared_lib,然后讲生成的.so文件拷贝到了/usr/lib下面,但是没有用,报错与上图一致。

@rockeet
Copy link
Member

rockeet commented Aug 14, 2018

自己编译确实会比较麻烦,让用户更容易自己从源码编译,我们也正在解决。

所以你最好还是 安装编译好的版本

@chinyajie
Copy link
Author

@rockeet 因为我是想学习你们修改rocksdb引擎的方法,所以比较期待能通过源码安装大致看看需要修改哪些内容,看看调用逻辑,如果直接用编译好的版本就学不到那么多东西了。如果我直接尝试源码安装那你们的rocksdb修改版(而不是mysql)是不是更简单一点。如果仅仅源码安装你们修改的rocksdb,是不是只下载rocksdb、terark-zip-rocksdb就可以了,官网的lib包还需要吗。打扰了!

@rockeet
Copy link
Member

rockeet commented Aug 14, 2018

如果只是想学习的话,可以看我们对 rocksdb 的修改,我们对 rocksdb 的修改主要是为了适配我们的核心算法,适配层的代码在terark-zip-rocksdb,核心算法目前暂未开源。

@chinyajie
Copy link
Author

@rockeet 看完了你们适配部分的代码,确实没有开源核心算法😓。不过看了你们公布的测试效果,对于频繁的非连续读访问确实很有用。有个疑问是ppt里面讲到不同于rocksdb的按块压缩对每块datablock的buf分别压缩的方法,你们是整个sst压缩;但是后面又提到读取的时候可以通过索引准确的读出需要的单条数据,这里似乎又暗示压缩后的最小解压单位是一个value。那么是不是说你们虽然是一次性对整个sst进行压缩,但是其实压缩的时候还是一个value压成一个连续的string,然后记录偏移位置或者说压缩后的长度的呢?谢谢!

@rockeet
Copy link
Member

rockeet commented Aug 17, 2018

对,压缩时以 SST 为单位,解压时以单条 Value 为单位。
偏移、长度当然也需要存储,我们使用自己一种独创的整数压缩的算法。

@chinyajie
Copy link
Author

@rockeet 哦哦,但是我还是有一点不太理解。压缩时以sst为单位的优势是怎么提现的呢?因为你们为了建索引真正压缩的最小粒度是一个value值,而rocksdb原生的是一个block,实际压缩单位似乎比你们的还大,解压后虽然读的数据比较多,但单丛压缩效果讲rocksdb似乎能更好才对。还有一个问题是我看你们修改了rocksdb中buildtable的代码,多了一个迭代器,扫两次sst,多出的一次是为了之后压缩key还是value吗,和全局压缩的概念有关吗?

@rockeet
Copy link
Member

rockeet commented Aug 17, 2018

rocksdb 压缩的单位是 Block,比我们的压缩单位(SST)要小,rocksdb 解压的单位也是 Block,比我们解压单位(Value)要大。我们是自创的全局压缩,rocksdb是传统的分块+通用流式压缩(gzip,snappy,zstd...)

我们的压缩算法需要两遍扫描,虽然如此,我们在工程上仍然尽量减少两遍扫描的必要性:TerarkDB-SST-的创建过程

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants