Skip to content

Commit 7468ccf

Browse files
committed
Copy of
commit d1bb19b8f751875472211312c8e810143a7ba4b6 Author: Manuel Ung <mung@fb.com> Date: Fri Feb 3 11:50:34 2017 -0800 Add cardinality stats to information schema Summary: This adds cardinality stats to the INFORMATION_SCHEMA.ROCKSDB_INDEX_FILE_MAP table. This is the only missing user collected properties from SST files that we don't expose, which is useful for debugging cardinality bugs. Reviewed By: hermanlee Differential Revision: D4509156 fbshipit-source-id: 2d3918a
1 parent cfb59f3 commit 7468ccf

File tree

82 files changed

+9307
-10589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+9307
-10589
lines changed

storage/rocksdb/event_listener.cc

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include <vector>
2323

2424
/* MySQL includes */
25-
#include <mysql/plugin.h>
2625
#include <my_global.h>
26+
#include <mysql/plugin.h>
2727

2828
/* MyRocks includes */
2929
#include "./ha_rocksdb.h"
@@ -33,10 +33,8 @@
3333
namespace myrocks {
3434

3535
static std::vector<Rdb_index_stats>
36-
extract_index_stats(
37-
const std::vector<std::string>& files,
38-
const rocksdb::TablePropertiesCollection& props
39-
) {
36+
extract_index_stats(const std::vector<std::string> &files,
37+
const rocksdb::TablePropertiesCollection &props) {
4038
std::vector<Rdb_index_stats> ret;
4139
for (auto fn : files) {
4240
const auto it = props.find(fn);
@@ -49,11 +47,10 @@ extract_index_stats(
4947
}
5048

5149
void Rdb_event_listener::update_index_stats(
52-
const rocksdb::TableProperties& props
53-
) {
50+
const rocksdb::TableProperties &props) {
5451
DBUG_ASSERT(m_ddl_manager != nullptr);
5552
const auto tbl_props =
56-
std::make_shared<const rocksdb::TableProperties>(props);
53+
std::make_shared<const rocksdb::TableProperties>(props);
5754

5855
std::vector<Rdb_index_stats> stats;
5956
Rdb_tbl_prop_coll::read_stats_from_tbl_props(tbl_props, &stats);
@@ -62,32 +59,26 @@ void Rdb_event_listener::update_index_stats(
6259
}
6360

6461
void Rdb_event_listener::OnCompactionCompleted(
65-
rocksdb::DB *db,
66-
const rocksdb::CompactionJobInfo& ci
67-
) {
62+
rocksdb::DB *db, const rocksdb::CompactionJobInfo &ci) {
6863
DBUG_ASSERT(db != nullptr);
6964
DBUG_ASSERT(m_ddl_manager != nullptr);
7065

7166
if (ci.status.ok()) {
7267
m_ddl_manager->adjust_stats(
73-
extract_index_stats(ci.output_files, ci.table_properties),
74-
extract_index_stats(ci.input_files, ci.table_properties));
68+
extract_index_stats(ci.output_files, ci.table_properties),
69+
extract_index_stats(ci.input_files, ci.table_properties));
7570
}
7671
}
7772

7873
void Rdb_event_listener::OnFlushCompleted(
79-
rocksdb::DB* db,
80-
const rocksdb::FlushJobInfo& flush_job_info
81-
) {
74+
rocksdb::DB *db, const rocksdb::FlushJobInfo &flush_job_info) {
8275
DBUG_ASSERT(db != nullptr);
8376
update_index_stats(flush_job_info.table_properties);
8477
}
8578

8679
void Rdb_event_listener::OnExternalFileIngested(
87-
rocksdb::DB* db,
88-
const rocksdb::ExternalFileIngestionInfo& info
89-
) {
80+
rocksdb::DB *db, const rocksdb::ExternalFileIngestionInfo &info) {
9081
DBUG_ASSERT(db != nullptr);
9182
update_index_stats(info.table_properties);
9283
}
93-
} // namespace myrocks
84+
} // namespace myrocks

storage/rocksdb/event_listener.h

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,26 @@ namespace myrocks {
2121

2222
class Rdb_ddl_manager;
2323

24-
class Rdb_event_listener : public rocksdb::EventListener
25-
{
26-
public:
27-
Rdb_event_listener(const Rdb_event_listener&) = delete;
28-
Rdb_event_listener& operator=(const Rdb_event_listener&) = delete;
29-
30-
explicit Rdb_event_listener(Rdb_ddl_manager* const ddl_manager) :
31-
m_ddl_manager(ddl_manager) {
32-
}
33-
34-
void OnCompactionCompleted(
35-
rocksdb::DB* db, const rocksdb::CompactionJobInfo& ci) override;
36-
void OnFlushCompleted(
37-
rocksdb::DB* db, const rocksdb::FlushJobInfo& flush_job_info) override;
24+
class Rdb_event_listener : public rocksdb::EventListener {
25+
public:
26+
Rdb_event_listener(const Rdb_event_listener &) = delete;
27+
Rdb_event_listener &operator=(const Rdb_event_listener &) = delete;
28+
29+
explicit Rdb_event_listener(Rdb_ddl_manager *const ddl_manager)
30+
: m_ddl_manager(ddl_manager) {}
31+
32+
void OnCompactionCompleted(rocksdb::DB *db,
33+
const rocksdb::CompactionJobInfo &ci) override;
34+
void OnFlushCompleted(rocksdb::DB *db,
35+
const rocksdb::FlushJobInfo &flush_job_info) override;
3836
void OnExternalFileIngested(
39-
rocksdb::DB* db, const rocksdb::ExternalFileIngestionInfo& ingestion_info)
40-
override;
37+
rocksdb::DB *db,
38+
const rocksdb::ExternalFileIngestionInfo &ingestion_info) override;
4139

42-
private:
43-
Rdb_ddl_manager* m_ddl_manager;
40+
private:
41+
Rdb_ddl_manager *m_ddl_manager;
4442

45-
void update_index_stats(
46-
const rocksdb::TableProperties& props);
43+
void update_index_stats(const rocksdb::TableProperties &props);
4744
};
4845

49-
} // namespace myrocks
46+
} // namespace myrocks

0 commit comments

Comments
 (0)