diff --git a/storage/rocksdb/properties_collector.cc b/storage/rocksdb/properties_collector.cc index bf51c73e95e3..9b17a1cc8ec5 100644 --- a/storage/rocksdb/properties_collector.cc +++ b/storage/rocksdb/properties_collector.cc @@ -364,7 +364,7 @@ void Rdb_tbl_prop_coll::read_stats_from_tbl_props( std::string Rdb_index_stats::materialize( const std::vector &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); @@ -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()); @@ -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. " @@ -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; diff --git a/storage/rocksdb/properties_collector.h b/storage/rocksdb/properties_collector.h index 7eb901caec57..74ed4ca4f821 100644 --- a/storage/rocksdb/properties_collector.h +++ b/storage/rocksdb/properties_collector.h @@ -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;