Skip to content

Commit bae9fb5

Browse files
committed
MDEV-24909 JSON functions don't respect KILL QUERY / max_statement_time limit
preallocate the string in json_nice() to avoid reallocs on every 1-character append()
1 parent 3add51b commit bae9fb5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sql/item_jsonfunc.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ static int json_nice(json_engine_t *je, String *nice_js,
139139

140140
nice_js->length(0);
141141
nice_js->set_charset(je->s.cs);
142+
nice_js->alloc(je->s.str_end - je->s.c_str + 32);
143+
142144
DBUG_ASSERT(mode != Item_func_json_format::DETAILED ||
143145
(tab_size >= 0 && tab_size <= TAB_SIZE_LIMIT));
144146

0 commit comments

Comments
 (0)