Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
56bca79f
Commit
56bca79f
authored
Aug 10, 2009
by
Aleksandr Kuzminsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync with rev.94
parent
cbda445b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
7 deletions
+171
-7
handler/ha_innodb.cc
handler/ha_innodb.cc
+171
-5
include/srv0srv.h
include/srv0srv.h
+0
-1
srv/srv0srv.c
srv/srv0srv.c
+0
-1
No files found.
handler/ha_innodb.cc
View file @
56bca79f
...
...
@@ -160,6 +160,7 @@ static long innobase_mirrored_log_groups, innobase_log_files_in_group,
innobase_additional_mem_pool_size
,
innobase_file_io_threads
,
innobase_force_recovery
,
innobase_open_files
,
innobase_autoinc_lock_mode
;
static
unsigned
long
innobase_commit_concurrency
=
0
;
static
unsigned
long
innobase_read_io_threads
,
innobase_write_io_threads
;
static
my_bool
innobase_thread_concurrency_timer_based
;
...
...
@@ -278,6 +279,53 @@ innobase_alter_table_flags(
static
const
char
innobase_hton_name
[]
=
"InnoDB"
;
/** @brief Initialize the default value of innodb_commit_concurrency.
Once InnoDB is running, the innodb_commit_concurrency must not change
from zero to nonzero. (Bug #42101)
The initial default value is 0, and without this extra initialization,
SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter
to 0, even if it was initially set to nonzero at the command line
or configuration file. */
static
void
innobase_commit_concurrency_init_default
(
void
);
/*==========================================*/
/*****************************************************************
Check for a valid value of innobase_commit_concurrency. */
static
int
innobase_commit_concurrency_validate
(
/*=================================*/
/* out: 0 for valid
innodb_commit_concurrency */
THD
*
thd
,
/* in: thread handle */
struct
st_mysql_sys_var
*
var
,
/* in: pointer to system
variable */
void
*
save
,
/* out: immediate result
for update function */
struct
st_mysql_value
*
value
)
/* in: incoming string */
{
long
long
intbuf
;
ulong
commit_concurrency
;
DBUG_ENTER
(
"innobase_commit_concurrency_validate"
);
if
(
value
->
val_int
(
value
,
&
intbuf
))
{
/* The value is NULL. That is invalid. */
DBUG_RETURN
(
1
);
}
*
reinterpret_cast
<
ulong
*>
(
save
)
=
commit_concurrency
=
static_cast
<
ulong
>
(
intbuf
);
/* Allow the value to be updated, as long as it remains zero
or nonzero. */
DBUG_RETURN
(
!
(
!
commit_concurrency
==
!
innobase_commit_concurrency
));
}
static
MYSQL_THDVAR_BOOL
(
support_xa
,
PLUGIN_VAR_OPCMDARG
,
"Enable InnoDB support for the XA two-phase commit"
,
/* check_func */
NULL
,
/* update_func */
NULL
,
...
...
@@ -2261,6 +2309,8 @@ mem_free_and_error:
ut_a
(
0
==
strcmp
(
my_charset_latin1
.
name
,
"latin1_swedish_ci"
));
srv_latin1_ordering
=
my_charset_latin1
.
sort_order
;
innobase_commit_concurrency_init_default
();
/* Since we in this module access directly the fields of a trx
struct, and due to different headers and flags it might happen that
mutex_t has a different size in this module and in InnoDB
...
...
@@ -2582,11 +2632,11 @@ innobase_commit(
Note, the position is current because of
prepare_commit_mutex */
retry:
if
(
srv
_commit_concurrency
>
0
)
{
if
(
innobase
_commit_concurrency
>
0
)
{
pthread_mutex_lock
(
&
commit_cond_m
);
commit_threads
++
;
if
(
commit_threads
>
srv
_commit_concurrency
)
{
if
(
commit_threads
>
innobase
_commit_concurrency
)
{
commit_threads
--
;
pthread_cond_wait
(
&
commit_cond
,
&
commit_cond_m
);
...
...
@@ -2603,7 +2653,7 @@ retry:
innobase_commit_low
(
trx
);
if
(
srv
_commit_concurrency
>
0
)
{
if
(
innobase
_commit_concurrency
>
0
)
{
pthread_mutex_lock
(
&
commit_cond_m
);
commit_threads
--
;
pthread_cond_signal
(
&
commit_cond
);
...
...
@@ -9302,6 +9352,97 @@ innobase_set_cursor_view(
}
/***********************************************************************
Check whether any of the given columns is being renamed in the table. */
static
bool
column_is_being_renamed
(
/*====================*/
/* out: true if any of col_names is
being renamed in table */
TABLE
*
table
,
/* in: MySQL table */
uint
n_cols
,
/* in: number of columns */
const
char
**
col_names
)
/* in: names of the columns */
{
uint
j
;
uint
k
;
Field
*
field
;
const
char
*
col_name
;
for
(
j
=
0
;
j
<
n_cols
;
j
++
)
{
col_name
=
col_names
[
j
];
for
(
k
=
0
;
k
<
table
->
s
->
fields
;
k
++
)
{
field
=
table
->
field
[
k
];
if
((
field
->
flags
&
FIELD_IS_RENAMED
)
&&
innobase_strcasecmp
(
field
->
field_name
,
col_name
)
==
0
)
{
return
(
true
);
}
}
}
return
(
false
);
}
/***********************************************************************
Check whether a column in table "table" is being renamed and if this column
is part of a foreign key, either part of another table, referencing this
table or part of this table, referencing another table. */
static
bool
foreign_key_column_is_being_renamed
(
/*================================*/
/* out: true if a column that
participates in a foreign key definition
is being renamed */
row_prebuilt_t
*
prebuilt
,
/* in: InnoDB prebuilt struct */
TABLE
*
table
)
/* in: MySQL table */
{
dict_foreign_t
*
foreign
;
/* check whether there are foreign keys at all */
if
(
UT_LIST_GET_LEN
(
prebuilt
->
table
->
foreign_list
)
==
0
&&
UT_LIST_GET_LEN
(
prebuilt
->
table
->
referenced_list
)
==
0
)
{
/* no foreign keys involved with prebuilt->table */
return
(
false
);
}
row_mysql_lock_data_dictionary
(
prebuilt
->
trx
);
/* Check whether any column in the foreign key constraints which refer
to this table is being renamed. */
for
(
foreign
=
UT_LIST_GET_FIRST
(
prebuilt
->
table
->
referenced_list
);
foreign
!=
NULL
;
foreign
=
UT_LIST_GET_NEXT
(
referenced_list
,
foreign
))
{
if
(
column_is_being_renamed
(
table
,
foreign
->
n_fields
,
foreign
->
referenced_col_names
))
{
row_mysql_unlock_data_dictionary
(
prebuilt
->
trx
);
return
(
true
);
}
}
/* Check whether any column in the foreign key constraints in the
table is being renamed. */
for
(
foreign
=
UT_LIST_GET_FIRST
(
prebuilt
->
table
->
foreign_list
);
foreign
!=
NULL
;
foreign
=
UT_LIST_GET_NEXT
(
foreign_list
,
foreign
))
{
if
(
column_is_being_renamed
(
table
,
foreign
->
n_fields
,
foreign
->
foreign_col_names
))
{
row_mysql_unlock_data_dictionary
(
prebuilt
->
trx
);
return
(
true
);
}
}
row_mysql_unlock_data_dictionary
(
prebuilt
->
trx
);
return
(
false
);
}
UNIV_INTERN
bool
ha_innobase
::
check_if_incompatible_data
(
...
...
@@ -9320,6 +9461,13 @@ ha_innobase::check_if_incompatible_data(
return
(
COMPATIBLE_DATA_NO
);
}
/* Check if a column participating in a foreign key is being renamed.
There is no mechanism for updating InnoDB foreign key definitions. */
if
(
foreign_key_column_is_being_renamed
(
prebuilt
,
table
))
{
return
(
COMPATIBLE_DATA_NO
);
}
/* Check that row format didn't change */
if
((
info
->
used_fields
&
HA_CREATE_USED_ROW_FORMAT
)
&&
get_row_type
()
!=
((
info
->
row_type
==
ROW_TYPE_DEFAULT
)
...
...
@@ -9883,10 +10031,10 @@ static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables."
,
NULL
,
NULL
,
8
*
1024
*
1024L
,
5
*
1024
*
1024L
,
LONGLONG_MAX
,
1024
*
1024L
);
static
MYSQL_SYSVAR_ULONG
(
commit_concurrency
,
srv
_commit_concurrency
,
static
MYSQL_SYSVAR_ULONG
(
commit_concurrency
,
innobase
_commit_concurrency
,
PLUGIN_VAR_RQCMDARG
,
"Helps in performance tuning in heavily concurrent environments."
,
NULL
,
NULL
,
0
,
0
,
1000
,
0
);
innobase_commit_concurrency_validate
,
NULL
,
0
,
0
,
1000
,
0
);
static
MYSQL_SYSVAR_ULONG
(
concurrency_tickets
,
srv_n_free_tickets_to_enter
,
PLUGIN_VAR_RQCMDARG
,
...
...
@@ -10366,6 +10514,24 @@ i_s_innodb_index_stats,
i_s_innodb_patches
mysql_declare_plugin_end
;
/** @brief Initialize the default value of innodb_commit_concurrency.
Once InnoDB is running, the innodb_commit_concurrency must not change
from zero to nonzero. (Bug #42101)
The initial default value is 0, and without this extra initialization,
SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter
to 0, even if it was initially set to nonzero at the command line
or configuration file. */
static
void
innobase_commit_concurrency_init_default
(
void
)
/*==========================================*/
{
MYSQL_SYSVAR_NAME
(
commit_concurrency
).
def_val
=
innobase_commit_concurrency
;
}
#ifdef UNIV_COMPILE_TEST_FUNCS
typedef
struct
innobase_convert_name_test_struct
{
...
...
include/srv0srv.h
View file @
56bca79f
...
...
@@ -151,7 +151,6 @@ extern ulint srv_max_dirty_pages_pct;
extern
ulint
srv_force_recovery
;
extern
ulong
srv_thread_concurrency
;
extern
ulong
srv_commit_concurrency
;
extern
ulint
srv_max_n_threads
;
...
...
srv/srv0srv.c
View file @
56bca79f
...
...
@@ -289,7 +289,6 @@ concurrency check. */
UNIV_INTERN
ibool
srv_thread_concurrency_timer_based
=
FALSE
;
UNIV_INTERN
ulong
srv_thread_concurrency
=
0
;
UNIV_INTERN
ulong
srv_commit_concurrency
=
0
;
/* this mutex protects srv_conc data structures */
UNIV_INTERN
os_fast_mutex_t
srv_conc_mutex
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment