Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions storage/rocksdb/properties_collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void Rdb_tbl_prop_coll::read_stats_from_tbl_props(
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);
rdb_netstr_append_uint16(&ret, INDEX_STATS_VERSION_WITH_NAME);
for (const auto &i : stats) {
rdb_netstr_append_uint32(&ret, i.m_gl_index_id.cf_id);
rdb_netstr_append_uint32(&ret, i.m_gl_index_id.index_id);
Expand All @@ -380,6 +380,8 @@ std::string Rdb_index_stats::materialize(
for (const auto &num_keys : i.m_distinct_keys_per_prefix) {
rdb_netstr_append_uint64(&ret, num_keys);
}
rdb_netstr_append_uint16(&ret, i.m_name.size());
ret.append(i.m_name.data(), i.m_name.size());
}

return std::string((char *)ret.ptr(), ret.length());
Expand All @@ -406,7 +408,7 @@ int Rdb_index_stats::unmaterialize(const std::string &s,
Rdb_index_stats stats;
// Make sure version is within supported range.
if (version < INDEX_STATS_VERSION_INITIAL ||
version > INDEX_STATS_VERSION_ENTRY_TYPES) {
version > INDEX_STATS_VERSION_WITH_NAME) {
// NO_LINT_DEBUG
sql_print_error(
"Index stats version %d was outside of supported range. "
Expand Down Expand Up @@ -448,6 +450,11 @@ int Rdb_index_stats::unmaterialize(const std::string &s,
for (std::size_t i = 0; i < stats.m_distinct_keys_per_prefix.size(); i++) {
stats.m_distinct_keys_per_prefix[i] = rdb_netbuf_read_uint64(&p);
}
if (version >= INDEX_STATS_VERSION_WITH_NAME) {
size_t namelen = rdb_netbuf_read_uint16(&p);
stats.m_name.assign((const char*)p, namelen);
p += namelen;
}
ret->push_back(stats);
}
return HA_EXIT_SUCCESS;
Expand Down
1 change: 1 addition & 0 deletions storage/rocksdb/properties_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct Rdb_index_stats {
enum {
INDEX_STATS_VERSION_INITIAL = 1,
INDEX_STATS_VERSION_ENTRY_TYPES = 2,
INDEX_STATS_VERSION_WITH_NAME = 3,
};
GL_INDEX_ID m_gl_index_id;
int64_t m_data_size, m_rows, m_actual_disk_size;
Expand Down