Skip to content

Commit d8288b3

Browse files
committed
Merge remote-tracking branch 'mergetrees/merge-myrocks' into 10.2-mariarocks
2 parents ae0a490 + cfb59f3 commit d8288b3

File tree

137 files changed

+6106
-3222
lines changed

Some content is hidden

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

137 files changed

+6106
-3222
lines changed

mysql-test/include/have_rocksdb.opt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
--loose-enable-rocksdb_index_file_map
88
--loose-enable-rocksdb_dbstats
99
--loose-enable-rocksdb_cfstats
10+
--loose-enable-rocksdb_lock_info
11+
--loose-enable-rocksdb_trx

sql/field.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8734,7 +8734,6 @@ double Field_enum::val_real(void)
87348734

87358735
longlong Field_enum::val_int(void)
87368736
{
8737-
ASSERT_COLUMN_MARKED_FOR_READ;
87388737
return read_lowendian(ptr, packlength);
87398738
}
87408739

sql/handler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5403,7 +5403,7 @@ int handler::compare_key(key_range *range)
54035403
This is used by index condition pushdown implementation.
54045404
*/
54055405

5406-
int handler::compare_key2(key_range *range)
5406+
int handler::compare_key2(key_range *range) const
54075407
{
54085408
int cmp;
54095409
if (!range)

sql/handler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3168,7 +3168,7 @@ class handler :public Sql_alloc
31683168
virtual int read_range_next();
31693169
void set_end_range(const key_range *end_key);
31703170
int compare_key(key_range *range);
3171-
int compare_key2(key_range *range);
3171+
int compare_key2(key_range *range) const;
31723172
virtual int ft_init() { return HA_ERR_WRONG_COMMAND; }
31733173
void ft_end() { ft_handler=NULL; }
31743174
virtual FT_INFO *ft_init_ext(uint flags, uint inx,String *key)

storage/rocksdb/CMakeLists.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ ENDIF()
66

77
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
88

9+
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
10+
IF(HAVE_SCHED_GETCPU)
11+
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1)
12+
ENDIF()
13+
914
# get a list of rocksdb library source files
1015
# run with env -i to avoid passing variables
1116
EXECUTE_PROCESS(
@@ -78,32 +83,26 @@ ENDIF()
7883
SET(rocksdb_static_libs )
7984
IF (NOT "$ENV{WITH_SNAPPY}" STREQUAL "")
8085
SET(rocksdb_static_libs ${rocksdb_static_libs}
81-
$ENV{WITH_SNAPPY}/lib/libsnappy${PIC_EXT}.a)
86+
$ENV{WITH_SNAPPY}/libsnappy${PIC_EXT}.a)
8287
ADD_DEFINITIONS(-DSNAPPY)
83-
ELSE()
84-
SET(rocksdb_static_libs ${rocksdb_static_libs} snappy)
8588
ENDIF()
8689

8790
IF (NOT "$ENV{WITH_LZ4}" STREQUAL "")
8891
SET(rocksdb_static_libs ${rocksdb_static_libs}
89-
$ENV{WITH_LZ4}/lib/liblz4${PIC_EXT}.a)
92+
$ENV{WITH_LZ4}/liblz4${PIC_EXT}.a)
9093
ADD_DEFINITIONS(-DLZ4)
91-
ELSE()
92-
SET(rocksdb_static_libs ${rocksdb_static_libs} lz4)
9394
ENDIF()
9495

9596
IF (NOT "$ENV{WITH_BZ2}" STREQUAL "")
9697
SET(rocksdb_static_libs ${rocksdb_static_libs}
97-
$ENV{WITH_BZ2}/lib/libbz2${PIC_EXT}.a)
98+
$ENV{WITH_BZ2}/libbz2${PIC_EXT}.a)
9899
ADD_DEFINITIONS(-DBZIP2)
99-
ELSE()
100-
SET(rocksdb_static_libs ${rocksdb_static_libs} bz2)
101100
ENDIF()
102101

103102
# link ZSTD only if instructed
104103
IF (NOT "$ENV{WITH_ZSTD}" STREQUAL "")
105104
SET(rocksdb_static_libs ${rocksdb_static_libs}
106-
$ENV{WITH_ZSTD}/lib/libzstd${PIC_EXT}.a)
105+
$ENV{WITH_ZSTD}/libzstd${PIC_EXT}.a)
107106
ADD_DEFINITIONS(-DZSTD)
108107
ENDIF()
109108

storage/rocksdb/event_listener.cc

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extract_index_stats(
4141
) {
4242
std::vector<Rdb_index_stats> ret;
4343
for (auto fn : files) {
44-
auto it = props.find(fn);
44+
const auto it = props.find(fn);
4545
DBUG_ASSERT(it != props.end());
4646
std::vector<Rdb_index_stats> stats;
4747
Rdb_tbl_prop_coll::read_stats_from_tbl_props(it->second, &stats);
@@ -50,6 +50,19 @@ extract_index_stats(
5050
return ret;
5151
}
5252

53+
void Rdb_event_listener::update_index_stats(
54+
const rocksdb::TableProperties& props
55+
) {
56+
DBUG_ASSERT(m_ddl_manager != nullptr);
57+
const auto tbl_props =
58+
std::make_shared<const rocksdb::TableProperties>(props);
59+
60+
std::vector<Rdb_index_stats> stats;
61+
Rdb_tbl_prop_coll::read_stats_from_tbl_props(tbl_props, &stats);
62+
63+
m_ddl_manager->adjust_stats(stats);
64+
}
65+
5366
void Rdb_event_listener::OnCompactionCompleted(
5467
rocksdb::DB *db,
5568
const rocksdb::CompactionJobInfo& ci
@@ -69,14 +82,14 @@ void Rdb_event_listener::OnFlushCompleted(
6982
const rocksdb::FlushJobInfo& flush_job_info
7083
) {
7184
DBUG_ASSERT(db != nullptr);
72-
DBUG_ASSERT(m_ddl_manager != nullptr);
73-
74-
auto tbl_props = std::make_shared<const rocksdb::TableProperties>(
75-
flush_job_info.table_properties);
76-
77-
std::vector<Rdb_index_stats> stats;
78-
Rdb_tbl_prop_coll::read_stats_from_tbl_props(tbl_props, &stats);
79-
m_ddl_manager->adjust_stats(stats);
85+
update_index_stats(flush_job_info.table_properties);
8086
}
8187

88+
void Rdb_event_listener::OnExternalFileIngested(
89+
rocksdb::DB* db,
90+
const rocksdb::ExternalFileIngestionInfo& info
91+
) {
92+
DBUG_ASSERT(db != nullptr);
93+
update_index_stats(info.table_properties);
94+
}
8295
} // namespace myrocks

storage/rocksdb/event_listener.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,26 @@ class Rdb_ddl_manager;
2424
class Rdb_event_listener : public rocksdb::EventListener
2525
{
2626
public:
27-
explicit Rdb_event_listener(Rdb_ddl_manager* ddl_manager) :
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) :
2831
m_ddl_manager(ddl_manager) {
2932
}
3033

3134
void OnCompactionCompleted(
32-
rocksdb::DB *db, const rocksdb::CompactionJobInfo& ci) override;
35+
rocksdb::DB* db, const rocksdb::CompactionJobInfo& ci) override;
3336
void OnFlushCompleted(
3437
rocksdb::DB* db, const rocksdb::FlushJobInfo& flush_job_info) override;
38+
void OnExternalFileIngested(
39+
rocksdb::DB* db, const rocksdb::ExternalFileIngestionInfo& ingestion_info)
40+
override;
3541

3642
private:
3743
Rdb_ddl_manager* m_ddl_manager;
44+
45+
void update_index_stats(
46+
const rocksdb::TableProperties& props);
3847
};
3948

4049
} // namespace myrocks

0 commit comments

Comments
 (0)