summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2023-04-03 09:34:26 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2023-04-03 09:34:26 +0200
commit3261a78ea172a77fec113107ef35f218b9228b66 (patch)
tree4339d245eadaf1193ebc55ea5d9081fe0c5984f9
parentac5a534a4caa6c86762e721dfe7183be2fee29ca (diff)
parent0a6343909fcf8b193a1b517b3a16eabd4ae89a83 (diff)
downloadmariadb-git-3261a78ea172a77fec113107ef35f218b9228b66.tar.gz
Merge branch '10.4' into 10.5
-rw-r--r--include/m_string.h19
-rw-r--r--mysql-test/main/status.test9
-rw-r--r--mysys/my_addr_resolve.c7
-rw-r--r--sql/debug_sync.cc2
-rw-r--r--sql/sql_select.cc18
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_debug_sync.h9
6 files changed, 38 insertions, 26 deletions
diff --git a/include/m_string.h b/include/m_string.h
index 7857993bc92..1db86d1b197 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -199,9 +199,22 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
#include <mysql/plugin.h>
-#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
-#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
-#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
+#ifdef __cplusplus
+#include <type_traits>
+template<typename T> inline const char *_swl_check(T s)
+{
+ static_assert(std::is_same<T, const char (&)[sizeof(T)]>::value
+ || std::is_same<T, const char [sizeof(T)]>::value,
+ "Wrong argument for STRING_WITH_LEN()");
+ return s;
+}
+#define STRING_WITH_LEN(X) _swl_check<decltype(X)>(X), ((size_t) (sizeof(X) - 1))
+#else
+#define STRING_WITH_LEN(X) (X ""), ((size_t) (sizeof(X) - 1))
+#endif
+
+#define USTRING_WITH_LEN(X) (uchar*) STRING_WITH_LEN(X)
+#define C_STRING_WITH_LEN(X) (char *) STRING_WITH_LEN(X)
#define LEX_STRING_WITH_LEN(X) (X).str, (X).length
typedef struct st_mysql_const_lex_string LEX_CSTRING;
diff --git a/mysql-test/main/status.test b/mysql-test/main/status.test
index 221a24aedf4..ae1b90f9f7f 100644
--- a/mysql-test/main/status.test
+++ b/mysql-test/main/status.test
@@ -280,7 +280,6 @@ show status like 'Com%function';
#
connect (root, localhost, root,,test);
connection root;
-let $root_connection_id= `select connection_id()`;
--disable_warnings
create database db37908;
--enable_warnings
@@ -296,7 +295,6 @@ delimiter ;|
connect (user1,localhost,mysqltest_1,,test);
connection user1;
-let $user1_connection_id= `select connection_id()`;
--error ER_TABLEACCESS_DENIED_ERROR
select * from db37908.t1;
@@ -315,11 +313,8 @@ drop procedure proc37908;
drop function func37908;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
DROP USER mysqltest_1@localhost;
-# Wait till the sessions user1 and root are disconnected
-let $wait_condition =
- SELECT COUNT(*) = 0
- FROM information_schema.processlist
- WHERE id in ('$root_connection_id','$user1_connection_id');
+# Wait until all non-default sessions are disconnected
+let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.processlist;
--source include/wait_condition.inc
#
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index 336e419806d..3191c7f334f 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -239,10 +239,10 @@ static int addr_resolve(void *ptr, my_addr_loc *loc)
}
- /* 500 ms should be plenty of time for addr2line to issue a response. */
+ /* 5000 ms should be plenty of time for addr2line to issue a response. */
/* Read in a loop till all the output from addr2line is complete. */
while (parsed == total_bytes_read &&
- (ret= poll(&poll_fds, 1, 500)))
+ (ret= poll(&poll_fds, 1, 5000)))
{
/* error during poll */
if (ret < 0)
@@ -286,7 +286,8 @@ static int addr_resolve(void *ptr, my_addr_loc *loc)
loc->line= atoi(output + line_number_start);
/* Addr2line was unable to extract any meaningful information. */
- if (strcmp(loc->file, "??") == 0 && loc->func[0] == '?')
+ if ((strcmp(loc->file, "??") == 0 || strcmp(loc->file, "") == 0) &&
+ (loc->func[0] == '?' || loc->line == 0))
return 6;
loc->file= strip_path(loc->file);
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index b5de53be000..eec95bee1f2 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -1317,7 +1317,7 @@ uchar *debug_sync_value_ptr(THD *thd)
if (opt_debug_sync_timeout)
{
- static char on[]= "ON - current signal: '";
+ static const char on[]= "ON - current signal: '";
// Ensure exclusive access to debug_sync_global.ds_signal
mysql_mutex_lock(&debug_sync_global.ds_mutex);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 774898d8c26..9b47ebc48f4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -28263,19 +28263,19 @@ enum explainable_cmd_type
};
static
-const char * const explainable_cmd_name []=
+const LEX_CSTRING explainable_cmd_name []=
{
- "select ",
- "insert ",
- "replace ",
- "update ",
- "delete ",
+ {STRING_WITH_LEN("select ")},
+ {STRING_WITH_LEN("insert ")},
+ {STRING_WITH_LEN("replace ")},
+ {STRING_WITH_LEN("update ")},
+ {STRING_WITH_LEN("delete ")},
};
static
-char const *get_explainable_cmd_name(enum explainable_cmd_type cmd)
+const LEX_CSTRING* get_explainable_cmd_name(enum explainable_cmd_type cmd)
{
- return explainable_cmd_name[cmd];
+ return explainable_cmd_name + cmd;
}
static
@@ -28577,7 +28577,7 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
query_type);
}
if (sel_type == UPDATE_CMD || sel_type == DELETE_CMD)
- str->append(STRING_WITH_LEN(get_explainable_cmd_name(sel_type)));
+ str->append(get_explainable_cmd_name(sel_type));
if (sel_type == DELETE_CMD)
{
str->append(STRING_WITH_LEN(" from "));
diff --git a/storage/tokudb/PerconaFT/portability/toku_debug_sync.h b/storage/tokudb/PerconaFT/portability/toku_debug_sync.h
index affe3054214..ff99c99d81e 100644
--- a/storage/tokudb/PerconaFT/portability/toku_debug_sync.h
+++ b/storage/tokudb/PerconaFT/portability/toku_debug_sync.h
@@ -64,9 +64,12 @@ inline void toku_debug_sync(struct tokutxn *txn, const char *sync_point_name) {
void *client_extra;
THD *thd;
- toku_txn_get_client_id(txn, &client_id, &client_extra);
- thd = reinterpret_cast<THD *>(client_extra);
- DEBUG_SYNC(thd, sync_point_name);
+ if (debug_sync_service)
+ {
+ toku_txn_get_client_id(txn, &client_id, &client_extra);
+ thd = reinterpret_cast<THD *>(client_extra);
+ debug_sync_service(thd, sync_point_name, strlen(sync_point_name));
+ }
}
#else // defined(ENABLED_DEBUG_SYNC)