diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-07-02 19:11:42 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-07-02 19:11:42 +0200 |
commit | 8cb1a5d431fcfb1cc87c915f8e41137ab234b894 (patch) | |
tree | e6a7fda6763ff8bb50fd06d268c9e4d1b7fd551a | |
parent | d194dbe434562dfe0619c474c0b5be37a51751fb (diff) | |
download | mariadb-git-8cb1a5d431fcfb1cc87c915f8e41137ab234b894.tar.gz |
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()
-rw-r--r-- | sql/item_jsonfunc.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 4e2a048bf84..2525b465935 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -139,6 +139,8 @@ static int json_nice(json_engine_t *je, String *nice_js, nice_js->length(0); nice_js->set_charset(je->s.cs); + nice_js->alloc(je->s.str_end - je->s.c_str + 32); + DBUG_ASSERT(mode != Item_func_json_format::DETAILED || (tab_size >= 0 && tab_size <= TAB_SIZE_LIMIT)); |