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