facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
28.52k stars 6.3k forks source link

Microbenchmark is not compatible with 1.6.x Google benchmark #9489

Open kloczek opened 2 years ago

kloczek commented 2 years ago

gcc 12.0.0 from fedora rawhide

[ 99%] Building CXX object microbench/CMakeFiles/db_basic_bench.dir/db_basic_bench.cc.o
cd /home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/x86_64-redhat-linux-gnu/microbench && /usr/bin/g++ -DGFLAGS=1 -DHAVE_PCLMUL -DHAVE_SSE42 -DLZ4 -DNUMA -DOS_LINUX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_LIB_IO_POSIX -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PLATFORM_POSIX -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL -DZLIB -DZSTD -I//include -I/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2 -I/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/include -I/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/third-party/folly -isystem /home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/third-party/gtest-1.8.1/fused-src -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -W -Wextra -Wall -pthread -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing -fno-omit-frame-pointer -momit-leaf-frame-pointer -march=native -fno-builtin-memcmp -DNDEBUG -std=gnu++11 -MD -MT microbench/CMakeFiles/db_basic_bench.dir/db_basic_bench.cc.o -MF CMakeFiles/db_basic_bench.dir/db_basic_bench.cc.o.d -o CMakeFiles/db_basic_bench.dir/db_basic_bench.cc.o -c /home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc
[100%] Built target ribbon_bench
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::DBPut(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:264:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  264 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:267:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  267 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:285:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  285 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::ManualCompaction(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:348:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  348 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:351:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  351 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:392:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  392 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::ManualFlush(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:468:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  468 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:471:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  471 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:490:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  490 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::DBGet(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:543:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  543 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:546:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  546 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:597:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  597 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::SimpleGetWithPerfContext(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:642:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  642 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:645:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  645 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:750:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  750 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::IteratorSeek(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:858:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  858 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:861:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  861 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:906:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  906 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::IteratorNext(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:952:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  952 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:955:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
  955 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1000:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1000 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::IteratorNextWithPerfContext(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1026:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1026 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1029:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1029 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1101:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1101 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::IteratorPrev(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1120:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1120 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1123:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1123 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1168:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1168 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc: In function ‘void rocksdb::PrefixSeek(benchmark::State&)’:
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1213:33: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1213 |   auto rnd = Random(301 + state.thread_index);
      |                           ~~~~~~^~~~~~~~~~~~
      |                                             ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1216:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1216 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
/home/tkloczko/rpmbuild/BUILD/rocksdb-6.28.2/microbench/db_basic_bench.cc:1260:13: error: invalid use of member function ‘int benchmark::State::thread_index() const’ (did you forget the ‘()’ ?)
 1260 |   if (state.thread_index == 0) {
      |       ~~~~~~^~~~~~~~~~~~
      |                         ()
make[2]: *** [microbench/CMakeFiles/db_basic_bench.dir/build.make:79: microbench/CMakeFiles/db_basic_bench.dir/db_basic_bench.cc.o] Error 1
hx235 commented 2 years ago

I guess somehow you are using the latest google benchmark/benchmark. h in the build since that header recently changed from public const int thread_index; to int thread_index() const { return thread_index_; } according to their PR while RocksDB hasn't picked that up.

Would you be able to utilize make or cmake build system instead of building directly with g++ to make sure library version is correct? For example, in your rocksdb folder do make db_basic_bench or make -jN db_basic_bench (where N is the number of cores if you want to parallelize the build)? See https://github.com/facebook/rocksdb/blob/main/INSTALL.md#compilation for more info on building with make or cmake.

kloczek commented 2 years ago

I'm using google benchmark 1.6.1and I'm building rocksdb using cmake.

hx235 commented 2 years ago

1.6.1

Is there any chance you could install/use a 1.5.5 version as a quick fix if you don't necessarily need to use 16.1? 1.5.5 version works fine with me.

kloczek commented 2 years ago

All other packages in my diseo have no problems with that version. So .. looks like rocksdb is not ready yet for that version of the google benchmark? (if yess feesl free to change subject of this issue ticket)

hx235 commented 2 years ago

Yeah and there isn’t any immediate plan to make change on Rocksdb side. But I tried to clarify things a bit here https://github.com/facebook/rocksdb/pull/9505

Is there anything else I can help you with before closing the issue?

kloczek commented 2 years ago

Does it mean that you are not going to adapt rocksdb code to be able use it with latest google benchmark? 🤔

hx235 commented 2 years ago

We might in the future - I was just saying there isn’t an intermediate plan. The INSTALL file change is there for more clarity right now.

(And I changed the issue title.)

jay-zhuang commented 2 years ago

Thanks @hx235 for calcifying it in the doc. Yeah, unfortunately it's because Google benchmark introduced a non-backward compatible change in 1.6.0: https://github.com/google/benchmark/commit/dc1a97174d5b84b1ce6720f1c98f85e6031b4723 and some platforms (like ubuntu-20.04) are not yet upgraded to the 1.6.x version, which blocks us from upgrading. We will upgrade once most of the platforms are having the 1.6.x google benchmark.

By default, micro-benchmark is disabled, unless you explicitly enable that by -DWITH_BENCHMARK=1. So if you do want to run mico-benchmark, currently you have to use google benchmark <= 1.5.5.

kloczek commented 2 years ago

Just tested 7.0.1 and looks like issue still is around .. 🤔

jay-zhuang commented 2 years ago

Just tested 7.0.1 and looks like issue still is around .. 🤔

It's because a non-backward compatible change from google benchmark. If we upgrade, then it will break the build for the user with 1.5.x. And for example Ubuntu 20.0 is still using google benchmark 1.5.0 version.