Bug #83566 CREATE FUNCTION at bootstrap attempts to evaluate non-resolved expressions
Submitted: 27 Oct 2016 8:35 Modified: 5 Apr 2017 12:43
Reporter: Marko Mäkelä Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Dictionary Severity:S3 (Non-critical)
Version:8.0.1 OS:Any
Assigned to: CPU Architecture:Any

[27 Oct 2016 8:35] Marko Mäkelä
Description:
Server bootstrap is invoking Item_func_get_system_var::val_int() without having resolved the expression in advance. The first such call occurs during the execution of the following statement:

CREATE DEFINER='mysql.sys'@'localhost' FUNCTION ps_thread_stack ...

How to repeat:
Add an assertion, and observe a crash during to bootstrap, in ./mtr main.1st

diff --git a/sql/item_func.cc b/sql/item_func.cc
index 03644cf..f3f5c1d 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -7644,6 +7644,7 @@ do { \
 longlong Item_func_get_system_var::val_int()
 {
   THD *thd= current_thd;
+  DBUG_ASSERT(fixed);
 
   if (cache_present && thd->query_id == used_query_id)
   {

Suggested fix:
Add the assertion, and fix any assertion failures.
[5 Apr 2017 12:43] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.2 release, and here's the changelog entry:

An assertion was raised when a create function at server bootstrap
attempted to evaluate non-resolved expressions.