1./* 下面是函数 dict_index_too_big_for_tree 中关于 rec_max_size 计算部分的内容 */
2./* 涉及到的辅助函数,下面也有相关说明 */
3.
4.rec_max_size = comp /* comp 为 true */
5.? REC_N_NEW_EXTRA_BYTES /* rem0rec.h:52:#define REC_N_NEW_EXTRA_BYTES 5 */
6.: REC_N_OLD_EXTRA_BYTES; /* rem0rec.h:49:#define REC_N_OLD_EXTRA_BYTES 6 */
7.
8.rec_max_size += UT_BITS_IN_BYTES(new_index->n_nullable);
9.
10./*
11.这个宏的实现如下:
12.
13.ut0ut.h:222
14.#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
15.
16.即 (允许为空的字段个数 + 7) / 8
17.*/
18.
19.for (i = 0; i < new_index->n_fields; i++) {
20.const dict_field_t* field
21.= dict_index_get_nth_field(new_index, i);
22.const dict_col_t* col
23.= dict_field_get_col(field);
24.ulint field_max_size;
25.ulint field_ext_max_size;
26.
27./* In dtuple_convert_big_rec(), variable-length columns
28.that are longer than BTR_EXTERN_LOCAL_STORED_MAX_SIZE
29.may be chosen for external storage.
30.
31.Fixed-length columns, and all columns of secondary
32.index records are always stored inline. */
33.
34./* Determine the maximum length of the index field.
35.The field_ext_max_size should be computed as the worst
36.case in rec_get_converted_size_comp() for
37.REC_STATUS_ORDINARY records. */
38.
39.field_max_size = dict_col_get_fixed_size(col, comp);
40.
41./* 本质上是判断是否定长,并获得定长字段的字节数*/
42.
43./*如果是定长,则直接 goto add_field_size 进行求值*/
44.
45.if (field_max_size && field->fixed_len != 0) {
46./* dict_index_add_col() should guarantee this */
47.ut_ad(!field->prefix_len</