MySQL的非叶子节点指针是什么
本篇文章为大家展示了MySQL的非叶子节点指针是什么,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
这个指针为8字节:4(唯一定位字段个数)+4(page no)。函数为dict_index_build_node_ptr。仅此记录,后续研究
/**********************************************************************//**Buildsanodepointeroutofaphysicalrecordandapagenumber.@returnown:nodepointer*/dtuple_t*dict_index_build_node_ptr(/*======================*/constdict_index_t*index,/*!<in:index*/constrec_t*rec,/*!<in:recordforwhichtobuildnodepointer*/ulintpage_no,/*!<in:pagenumbertoputinnodepointer*/mem_heap_t*heap,/*!<in:memoryheapwherepointercreated*/ulintlevel)/*!<in:levelofrecintree:0meansleaflevel*/{dtuple_t*tuple;dfield_t*field;byte*buf;ulintn_unique;if(dict_index_is_ibuf(index)){/*Inauniversalindextree,wetakethewholerecordasthenodepointeriftherecordisontheleaflevel,onnon-leaflevelsweremovethelastfield,whichcontainsthepagenumberofthechildpage*/ut_a(!dict_table_is_comp(index->table));n_unique=rec_get_n_fields_old(rec);if(level>0){ut_a(n_unique>1);n_unique--;}}else{n_unique=dict_index_get_n_unique_in_tree_nonleaf(index);//唯一定位到叶子节点的字段个数}tuple=dtuple_create(heap,n_unique+1);//建立元组/*Whensearchinginthetreeforthenodepointer,wemustnotdocomparisononthelastfield,thepagenumberfield,asonupperlevelsinthetreetheremaybeidenticalnodepointerswithadifferentpagenumber;therefore,wesetthen_fields_cmptooneless:*/dtuple_set_n_fields_cmp(tuple,n_unique);//比较字段为数据域dict_index_copy_types(tuple,index,n_unique);//进行类型复制buf=static_cast<byte*>(mem_heap_alloc(heap,4));//分配内存mach_write_to_4(buf,page_no);//写入叶子节点pagenofield=dtuple_get_nth_field(tuple,n_unique);//字段个数能够唯一定位的字段个数dfield_set_data(field,buf,4);//写入字段个数dtype_set(dfield_get_type(field),DATA_SYS_CHILD,DATA_NOT_NULL,4);rec_copy_prefix_to_dtuple(tuple,rec,index,n_unique,heap);//复制数据dtuple_set_info_bits(tuple,dtuple_get_info_bits(tuple)|REC_STATUS_NODE_PTR);ut_ad(dtuple_check_typed(tuple));return(tuple);}
上述内容就是MySQL的非叶子节点指针是什么,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注亿速云行业资讯频道。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。