我是靠谱客的博主 明亮花瓣,最近开发中收集的这篇文章主要介绍2022-09-20 mysql列存储引擎-POC-调用自定义函数-参数赋值摘要:逻辑追踪:,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

摘要:

mysql列存储引擎-POC-调用自定义函数-参数赋值

问题上下文参考 2022-09-15 mysql列存储引擎-POC-Q2-语句范围缩小后问题定位_帝尊悟世的博客-CSDN博客

逻辑追踪:

自定义函数参数赋值:

(gdb) bt
#0
Item_func::fix_func_arg (this=0x7f847c0156d8, thd=0x7f847c010540, arg=0x7f847c015780) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/item_func.cc:263
#1
0x0000000001d5e5a2 in Item_func::fix_fields (this=0x7f847c0156d8, thd=0x7f847c010540, ref=0x7f847c014d68) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/item_func.cc:249
#2
0x0000000001d76a00 in Item_func_sp::fix_fields (this=0x7f847c0156d8, thd=0x7f847c010540, ref=0x7f847c014d68) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/item_func.cc:8860
#3
0x0000000002293b8a in setup_fields (thd=0x7f847c010540, ref_pointer_array=..., fields=..., want_privilege=1, sum_func_list=0x7f847c014090, allow_sum_func=true, column_update=false)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_base.cc:9138
#4
0x00000000023333ad in st_select_lex::prepare (this=0x7f847c013f30, thd=0x7f847c010540) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_resolver.cc:197
#5
0x00000000029d620a in Tianmu::core::optimize_select (thd=0x7f847c010540, select_options=2147748608, result=0x7f847c01de60, select_lex=0x7f847c013f30, optimize_after_tianmu=@0x7f8665d29dec: 0,
free_join=@0x7f8665d29df0: 1) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/storage/tianmu/core/engine_execute.cpp:338
#6
0x00000000029d5bc4 in Tianmu::core::Engine::HandleSelect (this=0x49f6160, thd=0x7f847c010540, lex=0x7f847c0126b8, result=@0x7f8665d29df8: 0x7f847c01de60, setup_tables_done_option=0,
res=@0x7f8665d29df4: 0, optimize_after_tianmu=@0x7f8665d29dec: 0, tianmu_free_join=@0x7f8665d29df0: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/storage/tianmu/core/engine_execute.cpp:225
#7
0x0000000002abb3b4 in Tianmu::dbhandler::TIANMU_HandleSelect (thd=0x7f847c010540, lex=0x7f847c0126b8, result=@0x7f8665d29df8: 0x7f847c01de60, setup_tables_done_option=0, res=@0x7f8665d29df4: 0,
optimize_after_tianmu=@0x7f8665d29dec: 0, tianmu_free_join=@0x7f8665d29df0: 1, with_insert=0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/storage/tianmu/handler/ha_rcengine.cpp:82
#8
0x00000000022ff727 in execute_sqlcom_select (thd=0x7f847c010540, all_tables=0x7f847c01cc18) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_parse.cc:5182
#9
0x00000000022f954f in mysql_execute_command (thd=0x7f847c010540, first_level=true) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_parse.cc:2831
#10 0x000000000230042e in mysql_parse (thd=0x7f847c010540, parser_state=0x7f8665d2af00) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_parse.cc:5621
#11 0x00000000022f6878 in dispatch_command (thd=0x7f847c010540, com_data=0x7f8665d2b660, command=COM_QUERY) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_parse.cc:1495
#12 0x00000000022f5a1b in do_command (thd=0x7f847c010540) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_parse.cc:1034
#13 0x00000000023f995b in handle_connection (arg=0x6903780) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/conn_handler/connection_handler_per_thread.cc:313
#14 0x0000000002915591 in pfs_spawn_thread (arg=0x6947e30) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/storage/perfschema/pfs.cc:2197
#15 0x00007f86b0cfeea5 in start_thread () from /lib64/libpthread.so.0
#16 0x00007f86ae222b0d in clone () from /lib64/libc.so.6

(gdb) p *(Item_field*)args[0]
$182 = {
<Item_ident> = {
<Item> = {
<Parse_tree_node> = {
_vptr.Parse_tree_node = 0x3c704d8 <vtable for Item_field+16>
},
members of Item:
is_expensive_cache = -1 '377',
rsize = 0,
str_value = {
m_ptr = 0x0,
m_length = 0,
m_charset = 0x3d8a2a0 <my_charset_bin>,
m_alloced_length = 0,
m_is_alloced = false
},
item_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x7f847c014a38 "employee_id",
m_length = 11
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
orig_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x0,
m_length = 0
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
next = 0x7f847c014a48,
max_length = 0,
marker = 0,
decimals = 0 '00',
maybe_null = 0 '00',
null_value = 0 '00',
unsigned_flag = 0 '00',
with_sum_func = 0 '00',
fixed = 0 '00',
collation = {
---Type <return> to continue, or q <return> to quit---
collation = 0x3d8a2a0 <my_charset_bin>,
derivation = DERIVATION_IMPLICIT,
repertoire = 3
},
cmp_context = 4294967295,
runtime_item = false,
derived_used = false,
with_subselect = 0 '00',
with_stored_program = 0 '00',
tables_locked_cache = false,
is_parser_item = true
},
members of Item_ident:
orig_db_name = 0x0,
orig_table_name = 0x7f847c014a30 "b",
orig_field_name = 0x7f847c014a38 "employee_id",
m_alias_of_expr = false,
context = 0x7f847c013f90,
db_name = 0x0,
table_name = 0x7f847c014a30 "b",
field_name = 0x7f847c014a38 "employee_id",
cached_field_index = 4294967295,
cached_table = 0x0,
depended_from = 0x0
},
members of Item_field:
table_ref = 0x0,
field = 0x0,
result_field = 0x0,
item_equal = 0x0,
no_const_subst = false,
have_privileges = 0,
any_privileges = false
}

初始化时的调用堆栈:

(gdb) bt
#0
Item_func::set_arguments (this=0x7f847c0156d8, list=..., context_free=true) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/item_func.cc:97
#1
0x0000000001d5e0db in Item_func::Item_func (this=0x7f847c0156d8, pos=..., opt_list=0x7f847c014bb8) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/item_func.cc:134
#2
0x0000000001d758f8 in Item_func_sp::Item_func_sp (this=0x7f847c0156d8, pos=..., db_name=..., fn_name=..., use_explicit_name=false, opt_list=0x7f847c014bb8)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/item_func.cc:8374
#3
0x0000000001d47ed7 in Create_sp_func::create (this=0x3e0aff0 <Create_sp_func::s_singleton>, thd=0x7f847c010540, db=..., name=..., use_explicit_name=false, item_list=0x7f847c014bb8)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/item_create.cc:4255
#4
0x0000000001d47a0a in Create_qfunc::create_func (this=0x3e0aff0 <Create_sp_func::s_singleton>, thd=0x7f847c010540, name=..., item_list=0x7f847c014bb8)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/item_create.cc:4187
#5
0x0000000002413c9c in PTI_function_call_generic_ident_sys::itemize (this=0x7f847c014be8, pc=0x7f8665d27630, res=0x7f847c014d38)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/parse_tree_items.h:350
#6
0x00000000024b77b2 in PTI_expr_with_alias::itemize (this=0x7f847c014ca0, pc=0x7f8665d27630, res=0x7f8665d26a08)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/parse_tree_items.cc:186
#7
0x000000000240a2bf in PT_item_list::contextualize (this=0x7f847c0149f0, pc=0x7f8665d27630) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/parse_tree_helpers.h:77
#8
0x000000000240c761 in PT_select_item_list::contextualize (this=0x7f847c0149f0, pc=0x7f8665d27630) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/parse_tree_nodes.h:190
#9
0x0000000002410ed9 in PT_select_options_and_item_list::contextualize (this=0x7f847c014d70, pc=0x7f8665d27630)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/parse_tree_nodes.h:2182
#10 0x00000000024110e1 in PT_select_part2::contextualize (this=0x7f847c015510, pc=0x7f8665d27630) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/parse_tree_nodes.h:2252
#11 0x0000000002411717 in PT_select_init2::contextualize (this=0x7f847c015578, pc=0x7f8665d27630) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/parse_tree_nodes.h:2377
#12 0x00000000024118a7 in PT_select::contextualize (this=0x7f847c015598, pc=0x7f8665d27630) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/parse_tree_nodes.h:2414
#13 0x0000000002416489 in MYSQLparse (YYTHD=0x7f847c010540) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_yacc.yy:1707
#14 0x0000000002302e46 in parse_sql (thd=0x7f847c010540, parser_state=0x7f8665d2af00, creation_ctx=0x0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_parse.cc:7178
#15 0x00000000022fffba in mysql_parse (thd=0x7f847c010540, parser_state=0x7f8665d2af00) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_parse.cc:5501
#16 0x00000000022f6878 in dispatch_command (thd=0x7f847c010540, com_data=0x7f8665d2b660, command=COM_QUERY) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_parse.cc:1495
#17 0x00000000022f5a1b in do_command (thd=0x7f847c010540) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/sql_parse.cc:1034
#18 0x00000000023f995b in handle_connection (arg=0x6903780) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/sql/conn_handler/connection_handler_per_thread.cc:313
#19 0x0000000002915591 in pfs_spawn_thread (arg=0x6947e30) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-75-128/storage/perfschema/pfs.cc:2197
#20 0x00007f86b0cfeea5 in start_thread () from /lib64/libpthread.so.0
#21 0x00007f86ae222b0d in clone () from /lib64/libc.so.6

数据:

p *(Item_field*)tmp_arg[0]

(gdb) p *(Item_field*)tmp_arg[0]
$102 = {
<Item_ident> = {
<Item> = {
<Parse_tree_node> = {
_vptr.Parse_tree_node = 0x3c65f40 <vtable for Parse_tree_node+16>
},
members of Item:
is_expensive_cache = -1 '377',
rsize = 0,
str_value = {
m_ptr = 0x0,
m_length = 0,
m_charset = 0x3d8a2a0 <my_charset_bin>,
m_alloced_length = 0,
m_is_alloced = false
},
item_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x7f847c014a38 "employee_id",
m_length = 11
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
orig_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x0,
m_length = 0
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
next = 0x7f847c014a48,
max_length = 11,
marker = 0,
decimals = 0 '00',
maybe_null = 1 '01',
null_value = 0 '00',
unsigned_flag = 0 '00',
with_sum_func = 0 '00',
fixed = 0 '00',
collation = {
---Type <return> to continue, or q <return> to quit---
collation = 0x3d922c0 <my_charset_latin1>,
derivation = DERIVATION_NUMERIC,
repertoire = 1
},
cmp_context = 4294967295,
runtime_item = false,
derived_used = false,
with_subselect = 0 '00',
with_stored_program = 0 '00',
tables_locked_cache = false,
is_parser_item = true
},
members of Item_ident:
orig_db_name = 0x0,
orig_table_name = 0x7f847c014a30 "b",
orig_field_name = 0x7f847c014a38 "employee_id",
m_alias_of_expr = false,
context = 0x7f847c013f90,
db_name = 0x0,
table_name = 0x7f847c014a30 "b",
field_name = 0x7f847c014a38 "employee_id",
cached_field_index = 0,
cached_table = 0x7f847c04c5b8,
depended_from = 0x0
},
members of Item_field:
table_ref = 0x0,
field = 0x0,
result_field = 0x0,
item_equal = 0x0,
no_const_subst = false,
have_privileges = 0,
any_privileges = false
}

p *item

(gdb) p *item
$127 = {
<Parse_tree_node> = {
_vptr.Parse_tree_node = 0x3d1a578 <vtable for PTI_udf_expr+16>
},
members of Item:
is_expensive_cache = -1 '377',
rsize = 0,
str_value = {
m_ptr = 0x0,
m_length = 0,
m_charset = 0x3d8a2a0 <my_charset_bin>,
m_alloced_length = 0,
m_is_alloced = false
},
item_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x0,
m_length = 0
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
orig_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x0,
m_length = 0
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
next = 0x7f847c0156d8,
max_length = 0,
marker = 0,
decimals = 0 '00',
maybe_null = 0 '00',
null_value = 0 '00',
unsigned_flag = 0 '00',
with_sum_func = 0 '00',
fixed = 0 '00',
collation = {
collation = 0x3d8a2a0 <my_charset_bin>,
derivation = DERIVATION_COERCIBLE,
---Type <return> to continue, or q <return> to quit---
repertoire = 3
},
cmp_context = 4294967295,
runtime_item = false,
derived_used = false,
with_subselect = 0 '00',
with_stored_program = 0 '00',
tables_locked_cache = false,
is_parser_item = true
}

p *(Item_field*)args[0]

(gdb) p *(Item_field*)args[0]
$180 = {
<Item_ident> = {
<Item> = {
<Parse_tree_node> = {
_vptr.Parse_tree_node = 0x3c704d8 <vtable for Item_field+16>
},
members of Item:
is_expensive_cache = -1 '377',
rsize = 0,
str_value = {
m_ptr = 0x0,
m_length = 0,
m_charset = 0x3d8a2a0 <my_charset_bin>,
m_alloced_length = 0,
m_is_alloced = false
},
item_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x7f847c014a38 "employee_id",
m_length = 11
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
orig_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x0,
m_length = 0
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
next = 0x7f847c014a48,
max_length = 11,
marker = 0,
decimals = 0 '00',
maybe_null = 1 '01',
null_value = 0 '00',
unsigned_flag = 0 '00',
with_sum_func = 0 '00',
fixed = 1 '01',
collation = {
---Type <return> to continue, or q <return> to quit---
collation = 0x3d922c0 <my_charset_latin1>,
derivation = DERIVATION_NUMERIC,
repertoire = 1
},
cmp_context = 4294967295,
runtime_item = false,
derived_used = false,
with_subselect = 0 '00',
with_stored_program = 0 '00',
tables_locked_cache = false,
is_parser_item = true
},
members of Item_ident:
orig_db_name = 0x0,
orig_table_name = 0x7f847c014a30 "b",
orig_field_name = 0x7f847c014a38 "employee_id",
m_alias_of_expr = false,
context = 0x7f847c013f90,
db_name = 0x7f847c016550 "t2",
table_name = 0x7f847c024390 "b",
field_name = 0x7f847c0169e9 "employee_id",
cached_field_index = 0,
cached_table = 0x7f847c01d198,
depended_from = 0x0
},
members of Item_field:
table_ref = 0x7f847c01d198,
field = 0x7f847c025630,
result_field = 0x7f847c025630,
item_equal = 0x0,
no_const_subst = false,
have_privileges = 0,
any_privileges = false
}

p  *(*(Item_field*)args[0]).field

(gdb) p
*(*(Item_field*)args[0]).field
$25 = {
<Proto_field> = {
_vptr.Proto_field = 0x3c63ed0 <vtable for Field_long+16>
},
members of Field:
ptr = 0x7f847c092d71 "M",
m_null_ptr = 0x0,
m_is_tmp_nullable = false,
m_is_tmp_null = false,
m_count_cuted_fields_saved = (unknown: 1634652180),
table = 0x7f847c0923c0,
orig_table = 0x7f847c0923c0,
table_name = 0x7f847c0924b0,
field_name = 0x7f847c047c59 "employee_id",
comment = {
str = 0x3062fd1 "",
length = 0
},
key_start = {
map = 0
},
part_of_key = {
map = 0
},
part_of_sortkey = {
map = 0
},
part_of_key_not_extended = {
map = 0
},
unireg_check = Field::NONE,
field_length = 11,
flags = 1,
field_index = 0,
null_bit = 0 '00',
is_created_from_null_item = false,
m_indexed = false,
m_warnings_pushed = 0,
gcol_info = 0x0,
stored_in_db = true
}

最后

以上就是明亮花瓣为你收集整理的2022-09-20 mysql列存储引擎-POC-调用自定义函数-参数赋值摘要:逻辑追踪:的全部内容,希望文章能够帮你解决2022-09-20 mysql列存储引擎-POC-调用自定义函数-参数赋值摘要:逻辑追踪:所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(53)

评论列表共有 0 条评论

立即
投稿
返回
顶部