-
Notifications
You must be signed in to change notification settings - Fork 158
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
CompressionType #152
Comments
The compression type must be already supported in RocksDB, so you should first support this in RocksDB. |
Yes, I know. It is supported in RocksDB now and installed it on my machine. But should I rewrite it with rust language? |
You just need to add them in https://github.com/pingcap/rust-rocksdb/blob/master/librocksdb_sys/crocksdb/crocksdb/c.h#L949 and https://github.com/pingcap/rust-rocksdb/blob/master/librocksdb_sys/src/lib.rs#L87 if RocksDB supports it. |
Thanks, but how can I build the TiKV with the new storage engine RocksDB supporting new compression type ? |
you can build rocksdb dynamically, use your own rust-rocksdb in https://github.com/pingcap/tikv/blob/master/Cargo.toml#L78 then run |
Thanks, I see. Should I also put the source code of rocksdb which I have modified in my own rust-rocksdb repository? And put where? |
TiKV only needs linking your RocksDB lib dynamically, it doesn't care the source. BTW, if you want to link your own RocksDB statically, you can update https://github.com/pingcap/rust-rocksdb/blob/master/librocksdb_sys/build.sh#L127 |
Thanks, I see. Now, i have used tidb-ansible to deploy a TiDB cluster(including TiDB server, PD server and TiKV server), should I install my own RocksDB on each node? |
|
Thanks, but why don't rocksdb for TiKV use JEMALLOC when compiling? |
/cc @BusyJay |
Allocation will be taken over by rustc when building a binary, so link to jemalloc is unnecessary. |
Thanks, Jay Lee. Can use the librocksdb_sys/build.sh other than build.rs written in librocksdb_sys/Cargo.toml when compiling rust-rocksdb? @BusyJay |
I don't get it. Do you mean you want to use librocksdb_sys/build.sh to build a native rocksdb library? I think it should work but it's recommended to follow the instruction in rocksdb repository instead. |
Thanks, I now have built the tikv link rocksdb dynamically supporting a new compression type. I used the rocksdb5.7.0 though the code in https://github.com/pingcap/rust-rocksdb/blob/master/librocksdb_sys/crocksdb/c.cc#L40 only support 5.7.3+, but I changed the 3 to 0, and tikv built successfully. What problem will it happen or come across using rocksdb5.7.0?thanks |
I remember that 5.7.3+ fixes some bugs, but I think it doesn't matter in your test. But If you want to use in production, I suggest using a newer one. |
Thanks, I have integrated a new compression which is supported by rocksdb5.7.0 into tikv-v1.0.1, but now I use tikv-v1.0.0, it come across this error when compilation, it's the file "tikv/src/config.rs" Compiling tikv v1.0.0 (file:///home/dzeng/tidb/build-tidb/deps/tikv) |
TiKV doesn't use the latest rust RocksDB, we will update it later. Now you can complement the missing args by yourself. |
The default compression of tidb is snappy,right? So, if I wanna use another compression type, should I set the parameter related to compression in tidb-ansible/conf/tikv.yml before deploying tidb? |
No, the default is lz4 and zstd for different levels. You must update with your own type before deploying. |
Thanks, it's in tidb-ansible/conf/tikv.yml to update? |
yes, you must also put your tikv-server in the resource/bin |
If I put the my built tikv-server in tidb-ansible/downloads, will it work? Must I put it under tidb-ansible/resource/bin? Thanks. |
tidb-ansible/resource/bin then run rolling update. |
I tried to put my built tikv-server,tikv-ctl,tikv-fail into tidb-v1.0.1.tar.gz which replaced the original tikv*,and then deploy, at last, I can also get the same tikv-* binary under the deploy directory (just need to copy the share_lib *.so to preper directory). |
I wiil also put the built tikv binaries to tidb-ansible/resources/bin to replace the original binary. Thanks. |
What's the meaning of the compression-per-level?How can I use the specific compression type in rocksdb defaultcf? |
you must first know rocksdb konws your compression, and then you can set the compression name for the level you want to compress. |
Yes, I have let rocksdb know it, and tikv-server, tikv-ctl have also linked to the dynamical linking library of the compression. |
Now I have let rocksdb know the new compression, but tikv doesn't know it. The new tikv binary has been able to linked to the dynamical linking library of the new compression. How can I let tikv know it when useing tidb-ansible to depoly the cluster? Should I also modify some code in tidb-ansible?Thanks. |
Maybe this is a bug for us. If the user doesn't want to use compression, we can't use it for the snapshot SST too. |
Thanks,
Then I re-built tikv. |
The default parameter of rocksdb: max_bytes_for_level_multiplier = 10, then how about the value of max_bytes_for_level_multiplier in rocksdb for tikv? |
We use the same default as rocksdb for tikv. |
Can you please tell me how you run the sysbench benchmark?
|
Sorry, I don't know exactly how that benchmark run, feel free to open an issue there, I think you can get an answer there. |
Can you please tell me how to check that the data is really compressed by lz4 or zstd or any other compression library in tidb? |
You can check it in rocksdb's LOG file. |
In the log of rocksdb used in tikv, there are some following messages, So can I make sure that my compression has been integrated into tikv? |
How to understand the sentence "the tidb server is stateless"? |
Besides, when the tikv cluster is running, we can see that the tikv-server process is using sfx0 and css0 character device for csszlib compression, as well as libcssz.so, librocksdb.so and so on. |
"stateless" means tidb-server keep no persistent data and you can add as many as you want.
Sorry, what do you want to say? Can you explain more clearly? |
I mean that the csszlib compression really works for compressing data, which is handled by the hardware, the character device sfx0 and css0. |
Can we close this issue now? @zengqingfu1442 |
Now I can integrate my compression into tikv-v1.0.2, but when I use the same method to integrate my compression into tikv-v1.0.5, it failed. Is there any suggestions about the errors? Thanks. error[E0061]: this function takes 0 parameters but 1 parameter was supplied error[E0599]: no associated item named error[E0599]: no associated item named error[E0061]: this function takes 0 parameters but 1 parameter was supplied error[E0061]: this function takes 0 parameters but 1 parameter was supplied error[E0599]: no method named error: aborting due to 6 previous errors error: Could not compile To learn more, run the command again with --verbose. |
We upgrade RocksDB version now. |
|
We don't support dynamic linking RocksDB now, rust-rocksdb will link RocksDB statically itself. As I said above, you can add your changes at https://github.com/pingcap/rust-rocksdb/tree/master/librocksdb_sys/rocksdb directly, then rust-rocksdb will compile and link it automatically. /cc @BusyJay |
Now I can integrate my compression into your used rocksdb-5.8.7 at https://github.com/pingcap/rust-rocksdb/tree/master/librocksdb_sys/rocksdb, but when I put the rocksdb under rust-rocksdb/librocksdb_sys and then = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test0.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test1.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test10.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test11.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test12.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test13.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test14.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test15.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test2.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test3.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test4.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test5.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test6.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test7.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test8.rust-cgu.o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.test9.rust-cgu.o" "-o" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/test-0ff9cffe471a7518.crate.allocator.rust-cgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps" "-L" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/build/librocksdb_sys-4017653e8b1568c4/out/build" "-L" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/build/librocksdb_sys-4017653e8b1568c4/out" "-L" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/build/bzip2-sys-185c4b847ab6e9c3/out" "-L" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/build/libz-sys-3229c174bc0fdbf9/out/lib" "-L" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/build/lz4-sys-88d6d70c663268b4/out" "-L" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/build/snappy-sys-73a1604664d92f84/out/build" "-L" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/build/zstd-sys-bce74bb6931f7809/out" "-L" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/libbyteorder-d8e24fb2567c46da.rlib" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/libtempdir-1b62bc638e04fbe4.rlib" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/libcrc-ec9ec9c4acc8ebc7.rlib" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/librand-01e396faece4661e.rlib" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/librocksdb-15853619758bf25c.rlib" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/liblibrocksdb_sys-f27c48a190b17db2.rlib" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/libbzip2_sys-261b0a7fafd34b51.rlib" "/home/dzeng/tikv-v1.0.5/rust-rocksdb/target/debug/deps/liblibc-358a6a97c1fa421b.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-6245c8679edb0632.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-13a38f6ff5c555a2.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-07d97ec288432093.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-fa858cff1c179ad5.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-f1d6ab1572dda01f.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-5f25e79d42fb3337.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-908ca35c4b5eb851.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-46041e6493fca4e6.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-5083eb9d4145f818.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-84783d1968d0025f.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-7b76b705776632dd.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-27ae42d059b7591a.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-31df71e4c5d464da.rlib" "/opt/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-598fb63ce2fee417.rlib" "-Wl,-Bdynamic" "-l" "stdc++" "-l" "util" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util" error: aborting due to previous error error: Could not compile To learn more, run the command again with --verbose. |
Seems like it can't find your custom compression implementation, where do you put the implementation of the above function? |
I have defined the CSSZlib_Compress and CSSZlib_Uncompress function in util/css.h and implemetation in util/css.cc. And there isn't any compilation error when only compiling the rocksdb-5.8.7. |
Can you write a test using the |
Yes, it works fine. |
I learned that the rust-rocksdb integrate rocksdb into tikv by calling C API in rocksdb. When compiling rust-rocksdb, what's the detailed process of compiling rocksdb in rust-rocksdb? Can you help me explain more clearly?Thanks. |
/cc @BusyJay |
How add a new compression type such as gzip or openssl for rust-rocksdb?And then how to build it for the TiKV storage engine?Thanks.
The text was updated successfully, but these errors were encountered: