Skip to content

Commit 4063c92

Browse files
committed
[feat] be compatible with MySQL 8.0.42, a temporary yet compilable version
1 parent 63aa780 commit 4063c92

File tree

3 files changed

+44
-15
lines changed

3 files changed

+44
-15
lines changed

src/mysql/videx/CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,28 @@ DISABLE_MISSING_PROFILE_WARNING()
2424
ADD_DEFINITIONS(-DMYSQL_SERVER)
2525
ADD_DEFINITIONS(-DMUTEX_FUTEX)
2626

27+
find_library(CURL_LIBRARY
28+
NAMES curl
29+
PATHS /usr/lib/x86_64-linux-gnu
30+
NO_DEFAULT_PATH
31+
)
32+
33+
if (NOT TARGET CURL::libcurl)
34+
add_library(CURL::libcurl UNKNOWN IMPORTED GLOBAL)
35+
set_target_properties(CURL::libcurl PROPERTIES
36+
IMPORTED_LOCATION "${CURL_LIBRARY}"
37+
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/extra/curl/${CURL_VERSION_DIR}/include"
38+
)
39+
endif ()
40+
2741
INCLUDE_DIRECTORIES(
2842
${CMAKE_SOURCE_DIR}/sql
2943
${CMAKE_SOURCE_DIR}/sql/auth
3044
${CMAKE_SOURCE_DIR}/extra/rapidjson/include
31-
${CMAKE_SOURCE_DIR}/extra/curl/curl-8.1.2/include
45+
${CMAKE_SOURCE_DIR}/extra/curl/${CURL_VERSION_DIR}/include
3246
)
3347

48+
3449
IF (WITH_VIDEX_STORAGE_ENGINE AND NOT WITHOUT_VIDEX_STORAGE_ENGINE)
3550
# Check if the dynamic library is explicitly specified
3651
IF (PLUGIN_VIDEX STREQUAL "DYNAMIC")

src/mysql/videx/ha_videx.cc

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,14 @@ int ask_from_videx_http(VidexJsonItem &request, VidexStringMap &res_json, THD* t
107107
curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
108108

109109
trace_http.add_utf8("request", request_str.c_str());
110+
auto start_time = std::chrono::high_resolution_clock::now();
110111
res_code = curl_easy_perform(curl);
112+
auto end_time = std::chrono::high_resolution_clock::now();
113+
ulong duration = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count();
114+
111115
if (res_code != CURLE_OK) {
112116
trace_http.add("success", false)
117+
.add("elapsed_time", duration)
113118
.add_utf8("reason", "res_code != CURLE_OK")
114119
.add_utf8("detail", curl_easy_strerror(res_code));
115120
trace_http.end();
@@ -123,18 +128,20 @@ int ask_from_videx_http(VidexJsonItem &request, VidexStringMap &res_json, THD* t
123128
if (error) {
124129
std::cout << "!__!__!__!__!__! JSON parse error: " << message << '\n';
125130
trace_http.add("success", false)
131+
.add("elapsed_time", duration)
126132
.add_utf8("reason", "res_json.HasParseError")
127133
.add_utf8("detail", readBuffer.c_str());
128134
trace_http.end();
129135
return 1;
130136
} else {
131137
if (message == "OK") {
132-
trace_http.add("success", true).add_utf8("detail", readBuffer.c_str());
138+
trace_http.add("success", true).add("elapsed_time", duration).add_utf8("detail", readBuffer.c_str());
133139
trace_http.end();
134140
std::cout << "access videx_server success: " << host_ip << std::endl;
135141
return 0;
136142
} else {
137143
trace_http.add("success", false)
144+
.add("elapsed_time", duration)
138145
.add_utf8("reason", "msg != OK")
139146
.add_utf8("detail", readBuffer.c_str());
140147
trace_http.end();
@@ -145,6 +152,7 @@ int ask_from_videx_http(VidexJsonItem &request, VidexStringMap &res_json, THD* t
145152
}
146153
}
147154
trace_http.add("success", false)
155+
.add("elapsed_time", -1)
148156
.add_utf8("reason", "curl = false");
149157
trace_http.end();
150158
std::cout << "access videx_server failed curl = false: " << host_ip << std::endl;
@@ -266,7 +274,7 @@ static int videx_init_func(void *p) {
266274
HTON_SUPPORTS_SECONDARY_ENGINE | // Supports secondary storage engine
267275
// HTON_SUPPORTS_TABLE_ENCRYPTION | // Supports table encryption (commented out)
268276
// HTON_SUPPORTS_ONLINE_BACKUPS | // Supports online backups (commented out)
269-
HTON_SUPPORTS_COMPRESSED_COLUMNS | // Supports compressed columns
277+
// HTON_SUPPORTS_COMPRESSED_COLUMNS | // Supports compressed columns
270278
HTON_SUPPORTS_GENERATED_INVISIBLE_PK; // Supports generated invisible primary keys
271279

272280
// Set the is_supported_system_table function pointer to videx_is_supported_system_table.
@@ -1109,11 +1117,14 @@ int ha_videx::multi_range_read_next(char **range_info) {
11091117
return (m_ds_mrr.dsmrr_next(range_info));
11101118
}
11111119

1112-
ha_rows ha_videx::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
1113-
void *seq_init_param,
1114-
uint n_ranges, uint *bufsz,
1115-
uint *flags,
1116-
Cost_estimate *cost) {
1120+
//ha_rows ha_videx::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
1121+
// void *seq_init_param,
1122+
// uint n_ranges, uint *bufsz,
1123+
// uint *flags,
1124+
// Cost_estimate *cost) {
1125+
ha_rows ha_videx::multi_range_read_info_const(
1126+
uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges,
1127+
uint *bufsz, uint *flags, bool *force_default_mrr, Cost_estimate *cost){
11171128
videx_log_ins.markHaFuncPassby(FUNC_FILE_LINE);
11181129
/* See comments in ha_myisam::multi_range_read_info_const */
11191130
m_ds_mrr.init(table);

src/mysql/videx/ha_videx.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,13 @@ class ha_videx : public handler {
171171
/** Initialize multi range read and get information.
172172
@see ha_myisam::multi_range_read_info_const
173173
@see DsMrr_impl::dsmrr_info_const */
174-
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
175-
void *seq_init_param, uint n_ranges,
176-
uint *bufsz, uint *flags,
177-
Cost_estimate *cost) override;
174+
// ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
175+
// void *seq_init_param, uint n_ranges,
176+
// uint *bufsz, uint *flags,
177+
// Cost_estimate *cost) override;
178+
virtual ha_rows multi_range_read_info_const(
179+
uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges,
180+
uint *bufsz, uint *flags, bool *force_default_mrr, Cost_estimate *cost) override;
178181

179182
/** Initialize multi range read and get information.
180183
@see DsMrr_impl::dsmrr_info */
@@ -345,9 +348,9 @@ uint max_supported_key_part_length(
345348
*/
346349
int index_last(uchar *buf) override;
347350

348-
bool has_gap_locks() const noexcept override {
349-
videx_log_ins.markPassbyUnexpected(FUNC_FILE_LINE);
350-
return true; }
351+
// bool has_gap_locks() const noexcept override {
352+
// videx_log_ins.markPassbyUnexpected(FUNC_FILE_LINE);
353+
// return true; }
351354

352355
/** @brief
353356
Unlike index_init(), rnd_init() can be called two consecutive times

0 commit comments

Comments
 (0)