From a18d1cc7778633a9d05f46082e7ddeb8e40130ba Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 13 Aug 2019 16:26:17 +0300 Subject: [PATCH] MDEV-20315: MyRocks tests produce valgrind failures (Backport to 10.2) - Include the valgrind suppressions from the FB upstream - Use HAVE_Valgrind, not HAVE_Purify (like the rest of MariaDB code does) The call to DisownData() is now actually disabled under Valgrind --- mysql-test/valgrind.supp | 94 +++++++++++++++++++++++++++++++++++ storage/rocksdb/ha_rocksdb.cc | 4 +- 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index a8ca80e203ace..c113447b229ad 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1771,3 +1771,97 @@ obj:/usr/lib64/libcrypto.so* } + + +## +## The following is a copy of facebook/mysql-5.6 suppressions: +## + +# +# RocksDB Storage Engine suppressions start +# + +{ + Still reachable for once-per-process initializations + Memcheck:Leak + match-leak-kinds: reachable + ... + fun:_ZN7rocksdb16ThreadStatusUtil19NewColumnFamilyInfoEPKNS_2DBEPKNS_16ColumnFamilyDataERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKNS_3EnvE + fun:_ZNK7rocksdb6DBImpl21NewThreadStatusCfInfoEPNS_16ColumnFamilyDataE + fun:_ZN7rocksdb2DB4OpenERKNS_9DBOptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorINS_22ColumnFamilyDescriptorESaISD_EEPSC_IPNS_18ColumnFamilyHandleESaISJ_EEPPS0_ + fun:_ZN7rocksdb13TransactionDB4OpenERKNS_9DBOptionsERKNS_20TransactionDBOptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorINS_22ColumnFamilyDescriptorESaISG_EEPSF_IPNS_18ColumnFamilyHandleESaISM_EEPPS0_ + fun:_ZN7myrocksL17rocksdb_init_funcEPv +} + + +{ + Still reachable for once-per-process initializations + Memcheck:Leak + match-leak-kinds: reachable + ... + fun:_ZN7rocksdb19ThreadStatusUpdater14RegisterThreadENS_12ThreadStatus10ThreadTypeEm + fun:_ZN7rocksdb16ThreadStatusUtil14RegisterThreadEPKNS_3EnvENS_12ThreadStatus10ThreadTypeE + fun:_ZN7rocksdb14ThreadPoolImpl4Impl15BGThreadWrapperEPv + fun:_ZNSt12_Bind_simpleIFPFPvS0_EPN7rocksdb16BGThreadMetadataEEE9_M_invokeIILm0EEEES0_St12_Index_tupleIIXspT_EEE + ... +} + +{ + Still reachable for once-per-process initializations + Memcheck:Leak + match-leak-kinds: reachable + ... + fun:_ZN7rocksdb14ThreadLocalPtr14InitSingletonsEv + fun:_ZN7rocksdb3Env7DefaultEv + fun:_ZN7rocksdb9DBOptionsC1Ev + ... + fun:_ZN7myrocksL27rdb_init_rocksdb_db_optionsEv +} + +{ + Still reachable for once-per-process initializations + Memcheck:Leak + match-leak-kinds: reachable + ... + fun:_ZN7rocksdb12_GLOBAL__N_18PosixEnv* + fun:_ZN7rocksdb3Env7DefaultEv + fun:_ZN7rocksdb9DBOptionsC1Ev + ... + fun:_ZN7myrocksL27rdb_init_rocksdb_db_optionsEv +} + +{ + Still reachable for thread local storage initialization (SetHandle) + Memcheck:Leak + match-leak-kinds: reachable + ... + fun:_ZNSt13unordered_mapIjPFvPvESt4hashIjESt8equal_toIjESaISt4pairIKjS2_EEEixERS8_ + fun:_ZN7rocksdb14ThreadLocalPtr10StaticMeta10SetHandlerEjPFvPvE + fun:_ZN7rocksdb14ThreadLocalPtrC1EPFvPvE + ... +} + +{ + Still reachable for thread local storage initialization (ReclaimId) + Memcheck:Leak + match-leak-kinds: reachable + ... + fun:_ZN7rocksdb10autovectorIjLm8EE9push_backERKj + fun:_ZN7rocksdb14ThreadLocalPtr10StaticMeta9ReclaimIdEj + fun:_ZN7rocksdb14ThreadLocalPtrD1Ev + ... +} + +{ + Static initialization + Memcheck:Leak + match-leak-kinds: reachable + ... + fun:_Z41__static_initialization_and_destruction_0ii + ... +} + +## +## RocksDB Storage Engine suppressions end +## + diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 613ac0884a79f..bf9183d7dead5 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -5836,11 +5836,11 @@ static int rocksdb_done_func(void *const p) { // Disown the cache data since we're shutting down. // This results in memory leaks but it improved the shutdown time. // Don't disown when running under valgrind -#ifndef HAVE_purify +#ifndef HAVE_valgrind if (rocksdb_tbl_options->block_cache) { rocksdb_tbl_options->block_cache->DisownData(); } -#endif /* HAVE_purify */ +#endif /* HAVE_valgrind */ /* MariaDB: don't clear rocksdb_db_options and rocksdb_tbl_options.