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
17 changes: 16 additions & 1 deletion src/mysql/videx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,28 @@ DISABLE_MISSING_PROFILE_WARNING()
ADD_DEFINITIONS(-DMYSQL_SERVER)
ADD_DEFINITIONS(-DMUTEX_FUTEX)

find_library(CURL_LIBRARY
NAMES curl
PATHS /usr/lib/x86_64-linux-gnu
NO_DEFAULT_PATH
)

if (NOT TARGET CURL::libcurl)
add_library(CURL::libcurl UNKNOWN IMPORTED GLOBAL)
set_target_properties(CURL::libcurl PROPERTIES
IMPORTED_LOCATION "${CURL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/extra/curl/${CURL_VERSION_DIR}/include"
)
endif ()

INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/sql/auth
${CMAKE_SOURCE_DIR}/extra/rapidjson/include
${CMAKE_SOURCE_DIR}/extra/curl/curl-8.1.2/include
${CMAKE_SOURCE_DIR}/extra/curl/${CURL_VERSION_DIR}/include
)


IF (WITH_VIDEX_STORAGE_ENGINE AND NOT WITHOUT_VIDEX_STORAGE_ENGINE)
# Check if the dynamic library is explicitly specified
IF (PLUGIN_VIDEX STREQUAL "DYNAMIC")
Expand Down
25 changes: 18 additions & 7 deletions src/mysql/videx/ha_videx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,14 @@ int ask_from_videx_http(VidexJsonItem &request, VidexStringMap &res_json, THD* t
curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);

trace_http.add_utf8("request", request_str.c_str());
auto start_time = std::chrono::high_resolution_clock::now();
res_code = curl_easy_perform(curl);
auto end_time = std::chrono::high_resolution_clock::now();
ulong duration = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count();

if (res_code != CURLE_OK) {
trace_http.add("success", false)
.add("elapsed_time", duration)
.add_utf8("reason", "res_code != CURLE_OK")
.add_utf8("detail", curl_easy_strerror(res_code));
trace_http.end();
Expand All @@ -123,18 +128,20 @@ int ask_from_videx_http(VidexJsonItem &request, VidexStringMap &res_json, THD* t
if (error) {
std::cout << "!__!__!__!__!__! JSON parse error: " << message << '\n';
trace_http.add("success", false)
.add("elapsed_time", duration)
.add_utf8("reason", "res_json.HasParseError")
.add_utf8("detail", readBuffer.c_str());
trace_http.end();
return 1;
} else {
if (message == "OK") {
trace_http.add("success", true).add_utf8("detail", readBuffer.c_str());
trace_http.add("success", true).add("elapsed_time", duration).add_utf8("detail", readBuffer.c_str());
trace_http.end();
std::cout << "access videx_server success: " << host_ip << std::endl;
return 0;
} else {
trace_http.add("success", false)
.add("elapsed_time", duration)
.add_utf8("reason", "msg != OK")
.add_utf8("detail", readBuffer.c_str());
trace_http.end();
Expand All @@ -145,6 +152,7 @@ int ask_from_videx_http(VidexJsonItem &request, VidexStringMap &res_json, THD* t
}
}
trace_http.add("success", false)
.add("elapsed_time", -1)
.add_utf8("reason", "curl = false");
trace_http.end();
std::cout << "access videx_server failed curl = false: " << host_ip << std::endl;
Expand Down Expand Up @@ -266,7 +274,7 @@ static int videx_init_func(void *p) {
HTON_SUPPORTS_SECONDARY_ENGINE | // Supports secondary storage engine
// HTON_SUPPORTS_TABLE_ENCRYPTION | // Supports table encryption (commented out)
// HTON_SUPPORTS_ONLINE_BACKUPS | // Supports online backups (commented out)
HTON_SUPPORTS_COMPRESSED_COLUMNS | // Supports compressed columns
// HTON_SUPPORTS_COMPRESSED_COLUMNS | // Supports compressed columns
HTON_SUPPORTS_GENERATED_INVISIBLE_PK; // Supports generated invisible primary keys

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

ha_rows ha_videx::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param,
uint n_ranges, uint *bufsz,
uint *flags,
Cost_estimate *cost) {
//ha_rows ha_videx::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
// void *seq_init_param,
// uint n_ranges, uint *bufsz,
// uint *flags,
// Cost_estimate *cost) {
ha_rows ha_videx::multi_range_read_info_const(
uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges,
uint *bufsz, uint *flags, bool *force_default_mrr, Cost_estimate *cost){
videx_log_ins.markHaFuncPassby(FUNC_FILE_LINE);
/* See comments in ha_myisam::multi_range_read_info_const */
m_ds_mrr.init(table);
Expand Down
17 changes: 10 additions & 7 deletions src/mysql/videx/ha_videx.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,13 @@ class ha_videx : public handler {
/** Initialize multi range read and get information.
@see ha_myisam::multi_range_read_info_const
@see DsMrr_impl::dsmrr_info_const */
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param, uint n_ranges,
uint *bufsz, uint *flags,
Cost_estimate *cost) override;
// ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
// void *seq_init_param, uint n_ranges,
// uint *bufsz, uint *flags,
// Cost_estimate *cost) override;
virtual ha_rows multi_range_read_info_const(
uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges,
uint *bufsz, uint *flags, bool *force_default_mrr, Cost_estimate *cost) override;

/** Initialize multi range read and get information.
@see DsMrr_impl::dsmrr_info */
Expand Down Expand Up @@ -345,9 +348,9 @@ uint max_supported_key_part_length(
*/
int index_last(uchar *buf) override;

bool has_gap_locks() const noexcept override {
videx_log_ins.markPassbyUnexpected(FUNC_FILE_LINE);
return true; }
// bool has_gap_locks() const noexcept override {
// videx_log_ins.markPassbyUnexpected(FUNC_FILE_LINE);
// return true; }

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