Commit 70764cd3 authored by calvin's avatar calvin

branches/zip: Merge revisions 2584:2956 from branches/6.0,

except c2932.

Bug#37232 and bug#31183 were fixed in the 6.0 branch only.
They should be fixed in the plugin too, specially MySQL 6.0
is discontinued at this point.

    ------------------------------------------------------------------------
    r2604 | inaam | 2008-08-21 09:37:06 -0500 (Thu, 21 Aug 2008) | 8 lines

    branches/6.0     bug#37232

    Relax locking behaviour for REPLACE INTO t SELECT ... FROM t1.
    Now SELECT on t1 is performed as a consistent read when the isolation
    level is set to READ COMMITTED.

    Reviewed by: Heikki
    ------------------------------------------------------------------------
    r2605 | inaam | 2008-08-21 09:59:33 -0500 (Thu, 21 Aug 2008) | 7 lines

    branches/6.0

    Added a comment to clarify why distinct calls to read MySQL binary
    log file name and log position do not entail any race condition.

    Suggested by: Heikki
    ------------------------------------------------------------------------
    r2956 | inaam | 2008-11-04 04:47:30 -0600 (Tue, 04 Nov 2008) | 11 lines

    branches/6.0  bug#31183

    If the system tablespace runs out of space because 'autoextend' is
    not specified with innodb_data_file_path there was no error message
    printed to the error log. The client would get 'table full' error.
    This patch prints an appropriate error message to the error log.

    rb://43

    Approved by: Marko
    ------------------------------------------------------------------------
parent c4511da7
...@@ -231,6 +231,9 @@ the extent are free and which contain old tuple version to clean. */ ...@@ -231,6 +231,9 @@ the extent are free and which contain old tuple version to clean. */
/* Offset of the descriptor array on a descriptor page */ /* Offset of the descriptor array on a descriptor page */
#define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE) #define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE)
/* Flag to indicate if we have printed the tablespace full error. */
static ibool fsp_tbs_full_error_printed = FALSE;
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
/**********************************************************************//** /**********************************************************************//**
Returns an extent to the free list of a space. */ Returns an extent to the free list of a space. */
...@@ -1218,6 +1221,19 @@ fsp_try_extend_data_file( ...@@ -1218,6 +1221,19 @@ fsp_try_extend_data_file(
if (space == 0 && !srv_auto_extend_last_data_file) { if (space == 0 && !srv_auto_extend_last_data_file) {
/* We print the error message only once to avoid
spamming the error log. Note that we don't need
to reset the flag to FALSE as dealing with this
error requires server restart. */
if (fsp_tbs_full_error_printed == FALSE) {
fprintf(stderr,
"InnoDB: Error: Data file(s) ran"
" out of space.\n"
"Please add another data file or"
" use \'autoextend\' for the last"
" data file.\n");
fsp_tbs_full_error_printed = TRUE;
}
return(FALSE); return(FALSE);
} }
......
...@@ -2501,6 +2501,19 @@ retry: ...@@ -2501,6 +2501,19 @@ retry:
} }
} }
/* The following calls to read the MySQL binary log
file name and the position return consistent results:
1) Other InnoDB transactions cannot intervene between
these calls as we are holding prepare_commit_mutex.
2) Binary logging of other engines is not relevant
to InnoDB as all InnoDB requires is that committing
InnoDB transactions appear in the same order in the
MySQL binary log as they appear in InnoDB logs.
3) A MySQL log file rotation cannot happen because
MySQL protects against this by having a counter of
transactions in prepared state and it only allows
a rotation when the counter drops to zero. See
LOCK_prep_xids and COND_prep_xids in log.cc. */
trx->mysql_log_file_name = mysql_bin_log_file_name(); trx->mysql_log_file_name = mysql_bin_log_file_name();
trx->mysql_log_offset = (ib_int64_t) mysql_bin_log_file_pos(); trx->mysql_log_offset = (ib_int64_t) mysql_bin_log_file_pos();
...@@ -8522,6 +8535,7 @@ ha_innobase::store_lock( ...@@ -8522,6 +8535,7 @@ ha_innobase::store_lock(
&& isolation_level != TRX_ISO_SERIALIZABLE && isolation_level != TRX_ISO_SERIALIZABLE
&& (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT)
&& (sql_command == SQLCOM_INSERT_SELECT && (sql_command == SQLCOM_INSERT_SELECT
|| sql_command == SQLCOM_REPLACE_SELECT
|| sql_command == SQLCOM_UPDATE || sql_command == SQLCOM_UPDATE
|| sql_command == SQLCOM_CREATE_TABLE)) { || sql_command == SQLCOM_CREATE_TABLE)) {
...@@ -8529,10 +8543,11 @@ ha_innobase::store_lock( ...@@ -8529,10 +8543,11 @@ ha_innobase::store_lock(
option set or this session is using READ COMMITTED option set or this session is using READ COMMITTED
isolation level and isolation level of the transaction isolation level and isolation level of the transaction
is not set to serializable and MySQL is doing is not set to serializable and MySQL is doing
INSERT INTO...SELECT or UPDATE ... = (SELECT ...) or INSERT INTO...SELECT or REPLACE INTO...SELECT
CREATE ... SELECT... without FOR UPDATE or or UPDATE ... = (SELECT ...) or CREATE ...
IN SHARE MODE in select, then we use consistent SELECT... without FOR UPDATE or IN SHARE
read for select. */ MODE in select, then we use consistent read
for select. */
prebuilt->select_lock_type = LOCK_NONE; prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = LOCK_NONE; prebuilt->stored_select_lock_type = LOCK_NONE;
......
--innodb_lock_wait_timeout=2
drop table if exists t1;
set session transaction isolation level read committed;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
create table t2 like t1;
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
set autocommit=0;
begin;
replace into t1 select * from t2;
set session transaction isolation level read committed;
set autocommit=0;
delete from t2 where a=5;
commit;
delete from t2;
commit;
commit;
begin;
insert into t1 select * from t2;
set session transaction isolation level read committed;
set autocommit=0;
delete from t2 where a=5;
commit;
delete from t2;
commit;
commit;
select * from t1;
a
1
2
3
4
5
6
7
drop table t1;
drop table t2;
-- source include/not_embedded.inc
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
# a consistent read of the source table.
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
set session transaction isolation level read committed;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
create table t2 like t1;
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
set autocommit=0;
# REPLACE INTO ... SELECT case
begin;
# this should not result in any locks on t2.
replace into t1 select * from t2;
connection b;
set session transaction isolation level read committed;
set autocommit=0;
# should not cuase a lock wait.
delete from t2 where a=5;
commit;
delete from t2;
commit;
connection a;
commit;
# INSERT INTO ... SELECT case
begin;
# this should not result in any locks on t2.
insert into t1 select * from t2;
connection b;
set session transaction isolation level read committed;
set autocommit=0;
# should not cuase a lock wait.
delete from t2 where a=5;
commit;
delete from t2;
commit;
connection a;
commit;
select * from t1;
drop table t1;
drop table t2;
connection default;
disconnect a;
disconnect b;
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