Skip to content

Commit 3261a78

Browse files
committed
Merge branch '10.4' into 10.5
2 parents ac5a534 + 0a63439 commit 3261a78

File tree

6 files changed

+38
-26
lines changed

6 files changed

+38
-26
lines changed

include/m_string.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,22 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
199199

200200
#include <mysql/plugin.h>
201201

202-
#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
203-
#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
204-
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
202+
#ifdef __cplusplus
203+
#include <type_traits>
204+
template<typename T> inline const char *_swl_check(T s)
205+
{
206+
static_assert(std::is_same<T, const char (&)[sizeof(T)]>::value
207+
|| std::is_same<T, const char [sizeof(T)]>::value,
208+
"Wrong argument for STRING_WITH_LEN()");
209+
return s;
210+
}
211+
#define STRING_WITH_LEN(X) _swl_check<decltype(X)>(X), ((size_t) (sizeof(X) - 1))
212+
#else
213+
#define STRING_WITH_LEN(X) (X ""), ((size_t) (sizeof(X) - 1))
214+
#endif
215+
216+
#define USTRING_WITH_LEN(X) (uchar*) STRING_WITH_LEN(X)
217+
#define C_STRING_WITH_LEN(X) (char *) STRING_WITH_LEN(X)
205218
#define LEX_STRING_WITH_LEN(X) (X).str, (X).length
206219

207220
typedef struct st_mysql_const_lex_string LEX_CSTRING;

mysql-test/main/status.test

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ show status like 'Com%function';
280280
#
281281
connect (root, localhost, root,,test);
282282
connection root;
283-
let $root_connection_id= `select connection_id()`;
284283
--disable_warnings
285284
create database db37908;
286285
--enable_warnings
@@ -296,7 +295,6 @@ delimiter ;|
296295

297296
connect (user1,localhost,mysqltest_1,,test);
298297
connection user1;
299-
let $user1_connection_id= `select connection_id()`;
300298

301299
--error ER_TABLEACCESS_DENIED_ERROR
302300
select * from db37908.t1;
@@ -315,11 +313,8 @@ drop procedure proc37908;
315313
drop function func37908;
316314
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
317315
DROP USER mysqltest_1@localhost;
318-
# Wait till the sessions user1 and root are disconnected
319-
let $wait_condition =
320-
SELECT COUNT(*) = 0
321-
FROM information_schema.processlist
322-
WHERE id in ('$root_connection_id','$user1_connection_id');
316+
# Wait until all non-default sessions are disconnected
317+
let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.processlist;
323318
--source include/wait_condition.inc
324319

325320
#

mysys/my_addr_resolve.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,10 @@ static int addr_resolve(void *ptr, my_addr_loc *loc)
239239
}
240240

241241

242-
/* 500 ms should be plenty of time for addr2line to issue a response. */
242+
/* 5000 ms should be plenty of time for addr2line to issue a response. */
243243
/* Read in a loop till all the output from addr2line is complete. */
244244
while (parsed == total_bytes_read &&
245-
(ret= poll(&poll_fds, 1, 500)))
245+
(ret= poll(&poll_fds, 1, 5000)))
246246
{
247247
/* error during poll */
248248
if (ret < 0)
@@ -286,7 +286,8 @@ static int addr_resolve(void *ptr, my_addr_loc *loc)
286286
loc->line= atoi(output + line_number_start);
287287

288288
/* Addr2line was unable to extract any meaningful information. */
289-
if (strcmp(loc->file, "??") == 0 && loc->func[0] == '?')
289+
if ((strcmp(loc->file, "??") == 0 || strcmp(loc->file, "") == 0) &&
290+
(loc->func[0] == '?' || loc->line == 0))
290291
return 6;
291292

292293
loc->file= strip_path(loc->file);

sql/debug_sync.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ uchar *debug_sync_value_ptr(THD *thd)
13171317

13181318
if (opt_debug_sync_timeout)
13191319
{
1320-
static char on[]= "ON - current signal: '";
1320+
static const char on[]= "ON - current signal: '";
13211321

13221322
// Ensure exclusive access to debug_sync_global.ds_signal
13231323
mysql_mutex_lock(&debug_sync_global.ds_mutex);

sql/sql_select.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28263,19 +28263,19 @@ enum explainable_cmd_type
2826328263
};
2826428264

2826528265
static
28266-
const char * const explainable_cmd_name []=
28266+
const LEX_CSTRING explainable_cmd_name []=
2826728267
{
28268-
"select ",
28269-
"insert ",
28270-
"replace ",
28271-
"update ",
28272-
"delete ",
28268+
{STRING_WITH_LEN("select ")},
28269+
{STRING_WITH_LEN("insert ")},
28270+
{STRING_WITH_LEN("replace ")},
28271+
{STRING_WITH_LEN("update ")},
28272+
{STRING_WITH_LEN("delete ")},
2827328273
};
2827428274

2827528275
static
28276-
char const *get_explainable_cmd_name(enum explainable_cmd_type cmd)
28276+
const LEX_CSTRING* get_explainable_cmd_name(enum explainable_cmd_type cmd)
2827728277
{
28278-
return explainable_cmd_name[cmd];
28278+
return explainable_cmd_name + cmd;
2827928279
}
2828028280

2828128281
static
@@ -28577,7 +28577,7 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
2857728577
query_type);
2857828578
}
2857928579
if (sel_type == UPDATE_CMD || sel_type == DELETE_CMD)
28580-
str->append(STRING_WITH_LEN(get_explainable_cmd_name(sel_type)));
28580+
str->append(get_explainable_cmd_name(sel_type));
2858128581
if (sel_type == DELETE_CMD)
2858228582
{
2858328583
str->append(STRING_WITH_LEN(" from "));

storage/tokudb/PerconaFT/portability/toku_debug_sync.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ inline void toku_debug_sync(struct tokutxn *txn, const char *sync_point_name) {
6464
void *client_extra;
6565
THD *thd;
6666

67-
toku_txn_get_client_id(txn, &client_id, &client_extra);
68-
thd = reinterpret_cast<THD *>(client_extra);
69-
DEBUG_SYNC(thd, sync_point_name);
67+
if (debug_sync_service)
68+
{
69+
toku_txn_get_client_id(txn, &client_id, &client_extra);
70+
thd = reinterpret_cast<THD *>(client_extra);
71+
debug_sync_service(thd, sync_point_name, strlen(sync_point_name));
72+
}
7073
}
7174

7275
#else // defined(ENABLED_DEBUG_SYNC)

0 commit comments

Comments
 (0)