Commit 2d96f74a authored by marko's avatar marko

Tweak the bit-field definitions introduced since r813 to address Bug #20877.

rw_lock_t: Do not make writer_is_wait_ex a bit-field.  There are no fields
yet that could be fused to the same machine word, but we play it safe,
because the field writer_is_wait_ex may be modified by several threads
simultaneously.  Such fields should always be allocated an own machine
word.

dict_table_t: Change the type of all bit-fields to "unsigned".  Make
"space" a bit-field of 32 bits.  Move name_hash and id_hash after all
bit-fields, so that the bit-fields can be allocated together.  Do not
make autoinc_inited a bit-field, as we cannot allocate any field
from the same machine word.

dict_build_table_def_step(): Pass a local variable to
fil_create_new_single_table_tablespace() and initialize table->space
from it after the call, now that table->space is a bit-field.
parent 53f8a9ff
......@@ -240,7 +240,7 @@ dict_build_table_def_step(
- page 3 will contain the root of the clustered index of the
table we create here. */
table->space = 0; /* reset to zero for the call below */
ulint space = 0; /* reset to zero for the call below */
if (table->dir_path_of_temp_table) {
/* We place tables created with CREATE TEMPORARY
......@@ -253,9 +253,11 @@ dict_build_table_def_step(
is_path = FALSE;
}
error = fil_create_new_single_table_tablespace
(&table->space, path_or_name, is_path,
FIL_IBD_FILE_INITIAL_SIZE);
error = fil_create_new_single_table_tablespace(
&space, path_or_name, is_path,
FIL_IBD_FILE_INITIAL_SIZE);
table->space = space;
if (error != DB_SUCCESS) {
return(error);
......
......@@ -262,23 +262,27 @@ struct dict_table_struct{
innodb_file_per_table is defined in my.cnf;
in Unix this is usually /tmp/..., in Windows
\temp\... */
ulint space; /* space where the clustered index of the
unsigned space:32;
/* space where the clustered index of the
table is placed */
ibool ibd_file_missing:1;/* TRUE if this is in a single-table
unsigned ibd_file_missing:1;
/* TRUE if this is in a single-table
tablespace and the .ibd file is missing; then
we must return in ha_innodb.cc an error if the
user tries to query such an orphaned table */
ibool tablespace_discarded:1;/* this flag is set TRUE when the
user calls DISCARD TABLESPACE on this table,
and reset to FALSE in IMPORT TABLESPACE */
ibool cached:1;/* TRUE if the table object has been added
unsigned tablespace_discarded:1;
/* this flag is set TRUE when the user
calls DISCARD TABLESPACE on this
table, and reset to FALSE in IMPORT
TABLESPACE */
unsigned cached:1;/* TRUE if the table object has been added
to the dictionary cache */
ulint flags:8;/* DICT_TF_COMPACT, ... */
hash_node_t name_hash; /* hash chain node */
hash_node_t id_hash; /* hash chain node */
unsigned flags:8;/* DICT_TF_COMPACT, ... */
ulint n_def:10;/* number of columns defined so far */
ulint n_cols:10;/* number of columns */
dict_col_t* cols; /* array of column descriptions */
hash_node_t name_hash; /* hash chain node */
hash_node_t id_hash; /* hash chain node */
UT_LIST_BASE_NODE_T(dict_index_t)
indexes; /* list of indexes of the table */
UT_LIST_BASE_NODE_T(dict_foreign_t)
......@@ -362,7 +366,7 @@ struct dict_table_struct{
mutex_t autoinc_mutex;
/* mutex protecting the autoincrement
counter */
ibool autoinc_inited:1;
ibool autoinc_inited;
/* TRUE if the autoinc counter has been
inited; MySQL gets the init value by executing
SELECT MAX(auto inc column) */
......
......@@ -438,7 +438,7 @@ struct rw_lock_struct {
const char* cfile_name;/* File name where lock created */
const char* last_s_file_name;/* File name where last s-locked */
const char* last_x_file_name;/* File name where last x-locked */
unsigned writer_is_wait_ex:1;
ibool writer_is_wait_ex;
/* This is TRUE if the writer field is
RW_LOCK_WAIT_EX; this field is located far
from the memory update hotspot fields which
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment