summaryrefslogtreecommitdiff
path: root/storage/rocksdb/properties_collector.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2019-06-15 21:29:46 +0300
committerSergei Petrunia <psergey@askmonty.org>2019-06-15 21:29:46 +0300
commit5173e396ffce706954f7302e9854126aadab4c54 (patch)
tree71f366008bbffd6cb6cf07f614fefdee5b82e8da /storage/rocksdb/properties_collector.cc
parentfaa4d8f8c6c12c09541c4733773ac700c5e643cf (diff)
downloadmariadb-git-5173e396ffce706954f7302e9854126aadab4c54.tar.gz
Copy of
commit dcd9379eb5707bc7514a2ff4d9127790356505cb Author: Manuel Ung <mung@fb.com> Date: Fri Jun 14 10:38:17 2019 -0700 Skip valgrind for rocksdb.force_shutdown Summary: This test does unclean shutdown, and leaks memory. Squash with: D15749084 Reviewed By: hermanlee Differential Revision: D15828957 fbshipit-source-id: 30541455d74
Diffstat (limited to 'storage/rocksdb/properties_collector.cc')
-rw-r--r--storage/rocksdb/properties_collector.cc96
1 files changed, 52 insertions, 44 deletions
diff --git a/storage/rocksdb/properties_collector.cc b/storage/rocksdb/properties_collector.cc
index 84a5c4d4b1b..823b38de5bb 100644
--- a/storage/rocksdb/properties_collector.cc
+++ b/storage/rocksdb/properties_collector.cc
@@ -43,12 +43,19 @@ my_bool rocksdb_compaction_sequential_deletes_count_sd = false;
Rdb_tbl_prop_coll::Rdb_tbl_prop_coll(Rdb_ddl_manager *const ddl_manager,
const Rdb_compact_params &params,
- const uint32_t &cf_id,
- const uint8_t &table_stats_sampling_pct)
- : m_cf_id(cf_id), m_ddl_manager(ddl_manager), m_last_stats(nullptr),
- m_rows(0l), m_window_pos(0l), m_deleted_rows(0l), m_max_deleted_rows(0l),
- m_file_size(0), m_params(params),
- m_cardinality_collector(table_stats_sampling_pct), m_recorded(false) {
+ const uint32_t cf_id,
+ const uint8_t table_stats_sampling_pct)
+ : m_cf_id(cf_id),
+ m_ddl_manager(ddl_manager),
+ m_last_stats(nullptr),
+ m_rows(0l),
+ m_window_pos(0l),
+ m_deleted_rows(0l),
+ m_max_deleted_rows(0l),
+ m_file_size(0),
+ m_params(params),
+ m_cardinality_collector(table_stats_sampling_pct),
+ m_recorded(false) {
DBUG_ASSERT(ddl_manager != nullptr);
m_deleted_rows_window.resize(m_params.m_window, false);
@@ -142,35 +149,36 @@ Rdb_index_stats *Rdb_tbl_prop_coll::AccessStats(const rocksdb::Slice &key) {
void Rdb_tbl_prop_coll::CollectStatsForRow(const rocksdb::Slice &key,
const rocksdb::Slice &value,
const rocksdb::EntryType &type,
- const uint64_t &file_size) {
+ const uint64_t file_size) {
auto stats = AccessStats(key);
stats->m_data_size += key.size() + value.size();
// Incrementing per-index entry-type statistics
switch (type) {
- case rocksdb::kEntryPut:
- stats->m_rows++;
- break;
- case rocksdb::kEntryDelete:
- stats->m_entry_deletes++;
- break;
- case rocksdb::kEntrySingleDelete:
- stats->m_entry_single_deletes++;
- break;
- case rocksdb::kEntryMerge:
- stats->m_entry_merges++;
- break;
- case rocksdb::kEntryOther:
- stats->m_entry_others++;
- break;
- default:
- // NO_LINT_DEBUG
- sql_print_error("RocksDB: Unexpected entry type found: %u. "
- "This should not happen so aborting the system.",
- type);
- abort();
- break;
+ case rocksdb::kEntryPut:
+ stats->m_rows++;
+ break;
+ case rocksdb::kEntryDelete:
+ stats->m_entry_deletes++;
+ break;
+ case rocksdb::kEntrySingleDelete:
+ stats->m_entry_single_deletes++;
+ break;
+ case rocksdb::kEntryMerge:
+ stats->m_entry_merges++;
+ break;
+ case rocksdb::kEntryOther:
+ stats->m_entry_others++;
+ break;
+ default:
+ // NO_LINT_DEBUG
+ sql_print_error(
+ "RocksDB: Unexpected entry type found: %u. "
+ "This should not happen so aborting the system.",
+ type);
+ abort();
+ break;
}
stats->m_actual_disk_size += file_size - m_file_size;
@@ -186,8 +194,8 @@ const char *Rdb_tbl_prop_coll::INDEXSTATS_KEY = "__indexstats__";
/*
This function is called by RocksDB to compute properties to store in sst file
*/
-rocksdb::Status
-Rdb_tbl_prop_coll::Finish(rocksdb::UserCollectedProperties *const properties) {
+rocksdb::Status Rdb_tbl_prop_coll::Finish(
+ rocksdb::UserCollectedProperties *const properties) {
uint64_t num_sst_entry_put = 0;
uint64_t num_sst_entry_delete = 0;
uint64_t num_sst_entry_singledelete = 0;
@@ -243,8 +251,8 @@ bool Rdb_tbl_prop_coll::NeedCompact() const {
/*
Returns the same as above, but in human-readable way for logging
*/
-rocksdb::UserCollectedProperties
-Rdb_tbl_prop_coll::GetReadableProperties() const {
+rocksdb::UserCollectedProperties Rdb_tbl_prop_coll::GetReadableProperties()
+ const {
std::string s;
#ifdef DBUG_OFF
s.append("[...");
@@ -315,8 +323,8 @@ void Rdb_tbl_prop_coll::read_stats_from_tbl_props(
/*
Serializes an array of Rdb_index_stats into a network string.
*/
-std::string
-Rdb_index_stats::materialize(const std::vector<Rdb_index_stats> &stats) {
+std::string Rdb_index_stats::materialize(
+ const std::vector<Rdb_index_stats> &stats) {
String ret;
rdb_netstr_append_uint16(&ret, INDEX_STATS_VERSION_ENTRY_TYPES);
for (const auto &i : stats) {
@@ -362,9 +370,10 @@ int Rdb_index_stats::unmaterialize(const std::string &s,
if (version < INDEX_STATS_VERSION_INITIAL ||
version > INDEX_STATS_VERSION_ENTRY_TYPES) {
// NO_LINT_DEBUG
- sql_print_error("Index stats version %d was outside of supported range. "
- "This should not happen so aborting the system.",
- version);
+ sql_print_error(
+ "Index stats version %d was outside of supported range. "
+ "This should not happen so aborting the system.",
+ version);
abort();
}
@@ -393,8 +402,7 @@ int Rdb_index_stats::unmaterialize(const std::string &s,
stats.m_entry_merges = rdb_netbuf_read_uint64(&p);
stats.m_entry_others = rdb_netbuf_read_uint64(&p);
}
- if (p +
- stats.m_distinct_keys_per_prefix.size() *
+ if (p + stats.m_distinct_keys_per_prefix.size() *
sizeof(stats.m_distinct_keys_per_prefix[0]) >
p2) {
return HA_EXIT_FAILURE;
@@ -411,8 +419,8 @@ int Rdb_index_stats::unmaterialize(const std::string &s,
Merges one Rdb_index_stats into another. Can be used to come up with the stats
for the index based on stats for each sst
*/
-void Rdb_index_stats::merge(const Rdb_index_stats &s, const bool &increment,
- const int64_t &estimated_data_len) {
+void Rdb_index_stats::merge(const Rdb_index_stats &s, const bool increment,
+ const int64_t estimated_data_len) {
std::size_t i;
DBUG_ASSERT(estimated_data_len >= 0);
@@ -456,7 +464,7 @@ void Rdb_index_stats::merge(const Rdb_index_stats &s, const bool &increment,
}
}
-Rdb_tbl_card_coll::Rdb_tbl_card_coll(const uint8_t &table_stats_sampling_pct)
+Rdb_tbl_card_coll::Rdb_tbl_card_coll(const uint8_t table_stats_sampling_pct)
: m_table_stats_sampling_pct(table_stats_sampling_pct),
m_seed(time(nullptr)) {}
@@ -527,4 +535,4 @@ void Rdb_tbl_card_coll::AdjustStats(Rdb_index_stats *stats) {
}
}
-} // namespace myrocks
+} // namespace myrocks