|
27 | 27 | #include "create_tmp_table.h"
|
28 | 28 | #include "sql_parse.h"
|
29 | 29 |
|
| 30 | +#ifndef DBUG_OFF |
| 31 | +int dbug_json_check_min_stack_requirement(); |
| 32 | +#endif |
| 33 | + |
30 | 34 | #define HA_ERR_JSON_TABLE (HA_ERR_LAST+1)
|
31 | 35 |
|
32 | 36 | class table_function_handlerton
|
@@ -104,13 +108,9 @@ int get_disallowed_table_deps_for_list(MEM_ROOT *mem_root,
|
104 | 108 | List_iterator<TABLE_LIST> li(*join_list);
|
105 | 109 |
|
106 | 110 | DBUG_EXECUTE_IF("json_check_min_stack_requirement",
|
107 |
| - { |
108 |
| - long arbitrary_var; |
109 |
| - long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); |
110 |
| - ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE); |
111 |
| - }); |
| 111 | + return -dbug_json_check_min_stack_requirement();); |
112 | 112 | if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
|
113 |
| - return 1; |
| 113 | + return -1; |
114 | 114 |
|
115 | 115 | while ((table= li++))
|
116 | 116 | {
|
@@ -1345,29 +1345,27 @@ void Table_function_json_table::fix_after_pullout(TABLE_LIST *sql_table,
|
1345 | 1345 | Recursively make all tables in the join_list also depend on deps.
|
1346 | 1346 | */
|
1347 | 1347 |
|
1348 |
| -static void add_extra_deps(List<TABLE_LIST> *join_list, table_map deps) |
| 1348 | +static bool add_extra_deps(List<TABLE_LIST> *join_list, table_map deps) |
1349 | 1349 | {
|
1350 | 1350 | TABLE_LIST *table;
|
1351 | 1351 | List_iterator<TABLE_LIST> li(*join_list);
|
1352 | 1352 |
|
1353 | 1353 | DBUG_EXECUTE_IF("json_check_min_stack_requirement",
|
1354 |
| - { |
1355 |
| - long arbitrary_var; |
1356 |
| - long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); |
1357 |
| - ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE); |
1358 |
| - }); |
| 1354 | + dbug_json_check_min_stack_requirement(); return true;); |
1359 | 1355 | if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
|
1360 |
| - return; |
| 1356 | + return true; |
1361 | 1357 | while ((table= li++))
|
1362 | 1358 | {
|
1363 | 1359 | table->dep_tables |= deps;
|
1364 | 1360 | NESTED_JOIN *nested_join;
|
1365 | 1361 | if ((nested_join= table->nested_join))
|
1366 | 1362 | {
|
1367 | 1363 | // set the deps inside, too
|
1368 |
| - add_extra_deps(&nested_join->join_list, deps); |
| 1364 | + if (add_extra_deps(&nested_join->join_list, deps)) |
| 1365 | + return true; |
1369 | 1366 | }
|
1370 | 1367 | }
|
| 1368 | + return false; |
1371 | 1369 | }
|
1372 | 1370 |
|
1373 | 1371 |
|
@@ -1447,11 +1445,7 @@ table_map add_table_function_dependencies(List<TABLE_LIST> *join_list,
|
1447 | 1445 | List_iterator<TABLE_LIST> li(*join_list);
|
1448 | 1446 |
|
1449 | 1447 | DBUG_EXECUTE_IF("json_check_min_stack_requirement",
|
1450 |
| - { |
1451 |
| - long arbitrary_var; |
1452 |
| - long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); |
1453 |
| - ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE); |
1454 |
| - }); |
| 1448 | + if (dbug_json_check_min_stack_requirement()) return 0;); |
1455 | 1449 | if ((res=check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)))
|
1456 | 1450 | return res;
|
1457 | 1451 |
|
|
0 commit comments