-
Vasil Dimov authored
INNODB-LOG-FILE-SIZE Lower the limit of max number of user-defined columns inside InnoDB from 1020 to 1017. The limit is imposed by the fact that we store the number in a 10-bit integer (max 1023 columns). We add 3 system columns, which lowers the limit to 1023-3=1020. In mlog_parse_index() we add the 3 system columns, even though some of them may already be present, which in worst case means that we may end up with those 3 system columns added twice to the dummy table object that mlog_parse_index() creates. The input to mlog_parse_index() is n_fields, n_uniq and the lengths of the columns. From this data, mlog_parse_index() cannot deduct how many of the system columns are present and their positions. Here is an example: Case 1: CREATE TABLE t1 (a INT, b INT, c INT) mlog_open_and_write_index(): index=GEN_CLUST_INDEX, table->n_cols=6, n_fields=6, uniq in tree=1, writing (6, 1) mlog_open_and_write_index() writing DB_ROW_ID's len=32774 mlog_open_and_write_index() writing DB_TRX_ID's len=32774 mlog_open_and_write_index() writing DB_ROLL_PTR's len=32775 mlog_open_and_write_index() writing a's len=4 mlog_open_and_write_index() writing b's len=4 mlog_open_and_write_index() writing c's len=4 Case 2: CREATE TABLE t2 (a CHAR(6), b INT, c INT, d INT, PRIMARY KEY(a)) mlog_open_and_write_index(): index=PRIMARY, table->n_cols=7, n_fields=6, uniq in tree=1, writing (6, 1) mlog_open_and_write_index() writing a's len=32774 mlog_open_and_write_index() writing DB_TRX_ID's len=32774 mlog_open_and_write_index() writing DB_ROLL_PTR's len=32775 mlog_open_and_write_index() writing b's len=4 mlog_open_and_write_index() writing c's len=4 mlog_open_and_write_index() writing d's len=4 So when mlog_parse_index() sees the two numbers (n_fields=6, uniq in tree=1) and then the six lengths (32774, 32774, 32775, 4, 4, 4) it has now way to distinguish between the above two cases. Thus we are stuck with this double-counting of sys columns and the simplest fix is to lower the limit to 1017 so that the double counting does not overflow the 10 bit integer. Reviewed by: Marko (rb:1606)
Vasil Dimov authoredINNODB-LOG-FILE-SIZE Lower the limit of max number of user-defined columns inside InnoDB from 1020 to 1017. The limit is imposed by the fact that we store the number in a 10-bit integer (max 1023 columns). We add 3 system columns, which lowers the limit to 1023-3=1020. In mlog_parse_index() we add the 3 system columns, even though some of them may already be present, which in worst case means that we may end up with those 3 system columns added twice to the dummy table object that mlog_parse_index() creates. The input to mlog_parse_index() is n_fields, n_uniq and the lengths of the columns. From this data, mlog_parse_index() cannot deduct how many of the system columns are present and their positions. Here is an example: Case 1: CREATE TABLE t1 (a INT, b INT, c INT) mlog_open_and_write_index(): index=GEN_CLUST_INDEX, table->n_cols=6, n_fields=6, uniq in tree=1, writing (6, 1) mlog_open_and_write_index() writing DB_ROW_ID's len=32774 mlog_open_and_write_index() writing DB_TRX_ID's len=32774 mlog_open_and_write_index() writing DB_ROLL_PTR's len=32775 mlog_open_and_write_index() writing a's len=4 mlog_open_and_write_index() writing b's len=4 mlog_open_and_write_index() writing c's len=4 Case 2: CREATE TABLE t2 (a CHAR(6), b INT, c INT, d INT, PRIMARY KEY(a)) mlog_open_and_write_index(): index=PRIMARY, table->n_cols=7, n_fields=6, uniq in tree=1, writing (6, 1) mlog_open_and_write_index() writing a's len=32774 mlog_open_and_write_index() writing DB_TRX_ID's len=32774 mlog_open_and_write_index() writing DB_ROLL_PTR's len=32775 mlog_open_and_write_index() writing b's len=4 mlog_open_and_write_index() writing c's len=4 mlog_open_and_write_index() writing d's len=4 So when mlog_parse_index() sees the two numbers (n_fields=6, uniq in tree=1) and then the six lengths (32774, 32774, 32775, 4, 4, 4) it has now way to distinguish between the above two cases. Thus we are stuck with this double-counting of sys columns and the simplest fix is to lower the limit to 1017 so that the double counting does not overflow the 10 bit integer. Reviewed by: Marko (rb:1606)
Loading