Skip to content

Commit 06acd7a

Browse files
committed
don't save vcol flags in frm
this is useless now, flags are recalculated on load anyway. But storing flags on disk means we cannot easily change (add, remove, or renumber) them in the new MariaDB version.
1 parent c3e0638 commit 06acd7a

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

sql/field.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ enum Derivation
396396
/* The length of the header part for each virtual column in the .frm file */
397397
#define FRM_VCOL_OLD_HEADER_SIZE(b) (3 + MY_TEST(b))
398398
#define FRM_VCOL_NEW_BASE_SIZE 16
399-
#define FRM_VCOL_NEW_HEADER_SIZE 7
399+
#define FRM_VCOL_NEW_HEADER_SIZE 6
400400

401401
class Count_distinct_field;
402402

sql/table.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,11 +2172,10 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
21722172
while (vcol_screen_pos < vcol_screen_end)
21732173
{
21742174
Virtual_column_info *vcol_info;
2175-
uint flags= (uint) vcol_screen_pos[0];
2175+
uint type= (uint) vcol_screen_pos[0];
21762176
uint field_nr= uint2korr(vcol_screen_pos+1);
21772177
uint expr_length= uint2korr(vcol_screen_pos+3);
2178-
uint type= (uint) vcol_screen_pos[5];
2179-
uint name_length= (uint) vcol_screen_pos[6];
2178+
uint name_length= (uint) vcol_screen_pos[5];
21802179
LEX_STRING name;
21812180
char *expr;
21822181

@@ -2208,8 +2207,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
22082207
vcol_info->expr_str.str= expr;
22092208
vcol_info->expr_str.length= expr_length;
22102209
vcol_screen_pos+= expr_length;
2211-
vcol_info->flags= flags;
2212-
vcol_info->stored_in_db= 0;
22132210

22142211
switch (type) {
22152212
case 0: // Generated virtual field

sql/unireg.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,9 @@ static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr,
560560
pack_expression
561561
562562
The data is stored as:
563-
1 byte flags; VCOL_NON_DETERMINISTIC, etc
563+
1 byte type (0 virtual, 1 virtual stored, 2 def, 3 check)
564564
2 bytes field_number
565565
2 bytes length of expression
566-
1 byte type (0 virtual, 1 virtual stored, 2 def, 3 check)
567566
1 byte length of name
568567
name
569568
next bytes column expression (text data)
@@ -572,15 +571,14 @@ static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr,
572571
static void pack_expression(uchar **buff, Virtual_column_info *vcol,
573572
uint offset, uint type)
574573
{
575-
(*buff)[0]= vcol->flags;
574+
(*buff)[0]= (uchar) type;
576575
int2store((*buff)+1, offset);
577576
/*
578577
expr_str.length < 64K as we have checked that the total size of the
579578
frm file is < 64K
580579
*/
581580
int2store((*buff)+3, vcol->expr_str.length);
582-
(*buff)[5]= (uchar) type;
583-
(*buff)[6]= vcol->name.length;
581+
(*buff)[5]= vcol->name.length;
584582
(*buff)+= FRM_VCOL_NEW_HEADER_SIZE;
585583
memcpy((*buff), vcol->name.str, vcol->name.length);
586584
(*buff)+= vcol->name.length;

0 commit comments

Comments
 (0)