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
21b9be3a
Commit
21b9be3a
authored
Nov 04, 2004
by
marko@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge marko@bk-internal.mysql.com:/home/bk/mysql-4.1
into hundin.mysql.fi:/home/marko/j/mysql-4.1
parents
d0bb7cc1
1e82a087
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
6 deletions
+69
-6
innobase/include/lock0lock.h
innobase/include/lock0lock.h
+8
-0
innobase/include/row0mysql.h
innobase/include/row0mysql.h
+5
-1
innobase/lock/lock0lock.c
innobase/lock/lock0lock.c
+13
-0
innobase/row/row0mysql.c
innobase/row/row0mysql.c
+11
-3
sql/ha_innodb.cc
sql/ha_innodb.cc
+29
-1
sql/ha_innodb.h
sql/ha_innodb.h
+3
-1
No files found.
innobase/include/lock0lock.h
View file @
21b9be3a
...
@@ -463,6 +463,14 @@ lock_rec_hash(
...
@@ -463,6 +463,14 @@ lock_rec_hash(
ulint
space
,
/* in: space */
ulint
space
,
/* in: space */
ulint
page_no
);
/* in: page number */
ulint
page_no
);
/* in: page number */
/*************************************************************************
/*************************************************************************
Gets the table covered by an IX table lock. */
dict_table_t
*
lock_get_ix_table
(
/*==============*/
/* out: the table covered by the lock */
lock_t
*
lock
);
/* in: table lock */
/*************************************************************************
Checks that a transaction id is sensible, i.e., not in the future. */
Checks that a transaction id is sensible, i.e., not in the future. */
ibool
ibool
...
...
innobase/include/row0mysql.h
View file @
21b9be3a
...
@@ -175,8 +175,12 @@ int
...
@@ -175,8 +175,12 @@ int
row_lock_table_for_mysql
(
row_lock_table_for_mysql
(
/*=====================*/
/*=====================*/
/* out: error code or DB_SUCCESS */
/* out: error code or DB_SUCCESS */
row_prebuilt_t
*
prebuilt
);
/* in: prebuilt struct in the MySQL
row_prebuilt_t
*
prebuilt
,
/* in: prebuilt struct in the MySQL
table handle */
table handle */
dict_table_t
*
table
);
/* in: table to LOCK_IX, or NULL
if prebuilt->table should be
locked as LOCK_TABLE_EXP |
prebuilt->select_lock_type */
/*************************************************************************
/*************************************************************************
Does an insert for MySQL. */
Does an insert for MySQL. */
...
...
innobase/lock/lock0lock.c
View file @
21b9be3a
...
@@ -395,6 +395,19 @@ lock_rec_get_nth_bit(
...
@@ -395,6 +395,19 @@ lock_rec_get_nth_bit(
return
(
ut_bit_get_nth
(
b
,
bit_index
));
return
(
ut_bit_get_nth
(
b
,
bit_index
));
}
}
/*************************************************************************
Gets the table covered by an IX table lock. */
dict_table_t
*
lock_get_ix_table
(
/*==============*/
/* out: the table covered by the lock */
lock_t
*
lock
)
/* in: table lock */
{
ut_a
(
lock
->
type_mode
==
(
LOCK_TABLE
|
LOCK_IX
));
return
(
lock
->
un_member
.
tab_lock
.
table
);
}
/*************************************************************************/
/*************************************************************************/
#define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex)
#define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex)
...
...
innobase/row/row0mysql.c
View file @
21b9be3a
...
@@ -779,8 +779,12 @@ int
...
@@ -779,8 +779,12 @@ int
row_lock_table_for_mysql
(
row_lock_table_for_mysql
(
/*=====================*/
/*=====================*/
/* out: error code or DB_SUCCESS */
/* out: error code or DB_SUCCESS */
row_prebuilt_t
*
prebuilt
)
/* in: prebuilt struct in the MySQL
row_prebuilt_t
*
prebuilt
,
/* in: prebuilt struct in the MySQL
table handle */
table handle */
dict_table_t
*
table
)
/* in: table to LOCK_IX, or NULL
if prebuilt->table should be
locked as LOCK_TABLE_EXP |
prebuilt->select_lock_type */
{
{
trx_t
*
trx
=
prebuilt
->
trx
;
trx_t
*
trx
=
prebuilt
->
trx
;
que_thr_t
*
thr
;
que_thr_t
*
thr
;
...
@@ -813,8 +817,12 @@ run_again:
...
@@ -813,8 +817,12 @@ run_again:
trx_start_if_not_started
(
trx
);
trx_start_if_not_started
(
trx
);
err
=
lock_table
(
LOCK_TABLE_EXP
,
prebuilt
->
table
,
if
(
table
)
{
prebuilt
->
select_lock_type
,
thr
);
err
=
lock_table
(
0
,
table
,
LOCK_IX
,
thr
);
}
else
{
err
=
lock_table
(
LOCK_TABLE_EXP
,
prebuilt
->
table
,
prebuilt
->
select_lock_type
,
thr
);
}
trx
->
error_state
=
err
;
trx
->
error_state
=
err
;
...
...
sql/ha_innodb.cc
View file @
21b9be3a
...
@@ -2314,6 +2314,34 @@ ha_innobase::write_row(
...
@@ -2314,6 +2314,34 @@ ha_innobase::write_row(
if
(
table
->
timestamp_field_type
&
TIMESTAMP_AUTO_SET_ON_INSERT
)
if
(
table
->
timestamp_field_type
&
TIMESTAMP_AUTO_SET_ON_INSERT
)
table
->
timestamp_field
->
set_time
();
table
->
timestamp_field
->
set_time
();
if
(
user_thd
->
lex
->
sql_command
==
SQLCOM_ALTER_TABLE
&&
num_write_row
>=
10000
)
{
/* ALTER TABLE is COMMITted at every 10000 copied rows.
The IX table lock for the original table has to be re-issued.
As this method will be called on a temporary table where the
contents of the original table is being copied to, it is
a bit tricky to determine the source table. The cursor
position in the source table need not be adjusted after the
intermediate COMMIT, since writes by other transactions are
being blocked by a MySQL table lock TL_WRITE_ALLOW_READ. */
ut_a
(
prebuilt
->
trx
->
mysql_n_tables_locked
==
2
);
ut_a
(
UT_LIST_GET_LEN
(
prebuilt
->
trx
->
trx_locks
)
>=
2
);
dict_table_t
*
table
=
lock_get_ix_table
(
UT_LIST_GET_FIRST
(
prebuilt
->
trx
->
trx_locks
));
num_write_row
=
0
;
/* Commit the transaction. This will release the table
locks, so they have to be acquired again. */
innobase_commit
(
user_thd
,
prebuilt
->
trx
);
/* Note that this transaction is still active. */
user_thd
->
transaction
.
all
.
innodb_active_trans
=
1
;
/* Re-acquire the IX table lock on the source table. */
row_lock_table_for_mysql
(
prebuilt
,
table
);
/* We will need an IX lock on the destination table. */
prebuilt
->
sql_stat_start
=
TRUE
;
}
num_write_row
++
;
if
(
last_query_id
!=
user_thd
->
query_id
)
{
if
(
last_query_id
!=
user_thd
->
query_id
)
{
prebuilt
->
sql_stat_start
=
TRUE
;
prebuilt
->
sql_stat_start
=
TRUE
;
last_query_id
=
user_thd
->
query_id
;
last_query_id
=
user_thd
->
query_id
;
...
@@ -4986,7 +5014,7 @@ ha_innobase::external_lock(
...
@@ -4986,7 +5014,7 @@ ha_innobase::external_lock(
if
(
thd
->
in_lock_tables
&&
if
(
thd
->
in_lock_tables
&&
thd
->
variables
.
innodb_table_locks
)
{
thd
->
variables
.
innodb_table_locks
)
{
ulint
error
;
ulint
error
;
error
=
row_lock_table_for_mysql
(
prebuilt
);
error
=
row_lock_table_for_mysql
(
prebuilt
,
0
);
if
(
error
!=
DB_SUCCESS
)
{
if
(
error
!=
DB_SUCCESS
)
{
error
=
convert_error_code_to_mysql
(
error
=
convert_error_code_to_mysql
(
...
...
sql/ha_innodb.h
View file @
21b9be3a
...
@@ -64,6 +64,7 @@ class ha_innobase: public handler
...
@@ -64,6 +64,7 @@ class ha_innobase: public handler
uint
last_match_mode
;
/* match mode of the latest search:
uint
last_match_mode
;
/* match mode of the latest search:
ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX,
ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX,
or undefined */
or undefined */
uint
num_write_row
;
/* number of write_row() calls */
longlong
auto_inc_counter_for_this_stat
;
longlong
auto_inc_counter_for_this_stat
;
ulong
max_supported_row_length
(
const
byte
*
buf
);
ulong
max_supported_row_length
(
const
byte
*
buf
);
...
@@ -85,7 +86,8 @@ class ha_innobase: public handler
...
@@ -85,7 +86,8 @@ class ha_innobase: public handler
HA_PRIMARY_KEY_IN_READ_INDEX
|
HA_PRIMARY_KEY_IN_READ_INDEX
|
HA_TABLE_SCAN_ON_INDEX
),
HA_TABLE_SCAN_ON_INDEX
),
last_dup_key
((
uint
)
-
1
),
last_dup_key
((
uint
)
-
1
),
start_of_scan
(
0
)
start_of_scan
(
0
),
num_write_row
(
0
)
{
{
}
}
~
ha_innobase
()
{}
~
ha_innobase
()
{}
...
...
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