Commit 600b965f authored by guilhem@mysql.com's avatar guilhem@mysql.com

Merge

parents 3eb817a8 6cd218cc
This diff is collapsed.
...@@ -319,4 +319,5 @@ ...@@ -319,4 +319,5 @@
#define ER_INVALID_CHARACTER_STRING 1300 #define ER_INVALID_CHARACTER_STRING 1300
#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 #define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301
#define ER_CONFLICTING_DECLARATIONS 1302 #define ER_CONFLICTING_DECLARATIONS 1302
#define ER_ERROR_MESSAGES 303 #define ER_NO_CONS_READ_ENGINE 1303
#define ER_ERROR_MESSAGES 304
drop table if exists t1;
create table t1 (a int) engine=innodb;
start transaction with consistent snapshot;
insert into t1 values(1);
select * from t1;
a
commit;
delete from t1;
start transaction;
insert into t1 values(1);
select * from t1;
a
1
commit;
drop table t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
create table t1 (a int);
insert into t1 values(9);
select * from mysqltest1.t1;
a
9
show databases like 'mysqltest1';
Database (mysqltest1)
mysqltest1
select * from test.t1;
a
9
drop table t1;
drop database mysqltest1;
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
### Test 1:
### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction.
connection con1;
create table t1 (a int) engine=innodb;
start transaction with consistent snapshot;
connection con2;
insert into t1 values(1);
connection con1;
select * from t1; # if consistent snapshot was set as expected, we
# should see nothing.
commit;
### Test 2:
### - For any non-consistent snapshot transaction, external
### committed inserts should be visible to the transaction.
delete from t1;
start transaction; # Now we omit WITH CONSISTENT SNAPSHOT
connection con2;
insert into t1 values(1);
connection con1;
select * from t1; # if consistent snapshot was not set, as expected, we
# should see 1.
commit;
drop table t1;
"--replicate-rewrite-db=mysqltest1->test"
source include/master-slave.inc;
--disable_warnings
drop database if exists mysqltest1;
--enable_warnings
create database mysqltest1;
use mysqltest1;
create table t1 (a int);
insert into t1 values(9);
select * from mysqltest1.t1;
sync_slave_with_master;
show databases like 'mysqltest1'; # should be empty
select * from test.t1;
# cleanup
connection master;
drop table t1;
drop database mysqltest1;
sync_slave_with_master;
...@@ -583,6 +583,12 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) ...@@ -583,6 +583,12 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
if (opt_using_transactions) if (opt_using_transactions)
{ {
bool operation_done=0; bool operation_done=0;
/*
As rollback can be 30 times slower than insert in InnoDB, and user may
not know there's rollback (if it's because of a dupl row), better warn.
*/
const char *save_proc_info= thd->proc_info;
thd->proc_info= "Rolling back";
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_NDBCLUSTER_DB
if (trans->ndb_tid) if (trans->ndb_tid)
{ {
...@@ -654,6 +660,7 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) ...@@ -654,6 +660,7 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
thd->variables.tx_isolation=thd->session_tx_isolation; thd->variables.tx_isolation=thd->session_tx_isolation;
if (operation_done) if (operation_done)
statistic_increment(ha_rollback_count,&LOCK_status); statistic_increment(ha_rollback_count,&LOCK_status);
thd->proc_info= save_proc_info;
} }
#endif /* USING_TRANSACTIONS */ #endif /* USING_TRANSACTIONS */
DBUG_RETURN(error); DBUG_RETURN(error);
...@@ -766,6 +773,24 @@ int ha_savepoint(THD *thd, char *savepoint_name) ...@@ -766,6 +773,24 @@ int ha_savepoint(THD *thd, char *savepoint_name)
DBUG_RETURN(error); DBUG_RETURN(error);
} }
int ha_start_consistent_snapshot(THD *thd)
{
#ifdef HAVE_INNOBASE_DB
if ((have_innodb == SHOW_OPTION_YES) &&
!innobase_start_trx_and_assign_read_view(thd))
return 0;
#endif
/*
Same idea as when one wants to CREATE TABLE in one engine which does not
exist:
*/
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_NO_CONS_READ_ENGINE, ER(ER_NO_CONS_READ_ENGINE));
return 0;
}
bool ha_flush_logs() bool ha_flush_logs()
{ {
bool result=0; bool result=0;
......
...@@ -138,6 +138,8 @@ ...@@ -138,6 +138,8 @@
#define HA_CACHE_TBL_ASKTRANSACT 2 #define HA_CACHE_TBL_ASKTRANSACT 2
#define HA_CACHE_TBL_TRANSACT 4 #define HA_CACHE_TBL_TRANSACT 4
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
#define MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
enum db_type enum db_type
{ {
...@@ -568,4 +570,4 @@ int ha_find_files(THD *thd,const char *db,const char *path, ...@@ -568,4 +570,4 @@ int ha_find_files(THD *thd,const char *db,const char *path,
const char *wild, bool dir,List<char>* files); const char *wild, bool dir,List<char>* files);
int ha_table_exists(THD* thd, const char* db, const char* name); int ha_table_exists(THD* thd, const char* db, const char* name);
TYPELIB *ha_known_exts(void); TYPELIB *ha_known_exts(void);
int ha_start_consistent_snapshot(THD *thd);
...@@ -114,6 +114,7 @@ static SYMBOL symbols[] = { ...@@ -114,6 +114,7 @@ static SYMBOL symbols[] = {
{ "COMMITTED", SYM(COMMITTED_SYM)}, { "COMMITTED", SYM(COMMITTED_SYM)},
{ "COMPRESSED", SYM(COMPRESSED_SYM)}, { "COMPRESSED", SYM(COMPRESSED_SYM)},
{ "CONCURRENT", SYM(CONCURRENT)}, { "CONCURRENT", SYM(CONCURRENT)},
{ "CONSISTENT", SYM(CONSISTENT_SYM)},
{ "CONSTRAINT", SYM(CONSTRAINT)}, { "CONSTRAINT", SYM(CONSTRAINT)},
{ "CONVERT", SYM(CONVERT_SYM)}, { "CONVERT", SYM(CONVERT_SYM)},
{ "CREATE", SYM(CREATE)}, { "CREATE", SYM(CREATE)},
...@@ -382,6 +383,7 @@ static SYMBOL symbols[] = { ...@@ -382,6 +383,7 @@ static SYMBOL symbols[] = {
{ "SIGNED", SYM(SIGNED_SYM)}, { "SIGNED", SYM(SIGNED_SYM)},
{ "SIMPLE", SYM(SIMPLE_SYM)}, { "SIMPLE", SYM(SIMPLE_SYM)},
{ "SLAVE", SYM(SLAVE)}, { "SLAVE", SYM(SLAVE)},
{ "SNAPSHOT", SYM(SNAPSHOT_SYM)},
{ "SMALLINT", SYM(SMALLINT)}, { "SMALLINT", SYM(SMALLINT)},
{ "SOME", SYM(ANY_SYM)}, { "SOME", SYM(ANY_SYM)},
{ "SONAME", SYM(UDF_SONAME_SYM)}, { "SONAME", SYM(UDF_SONAME_SYM)},
......
...@@ -977,7 +977,8 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -977,7 +977,8 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
int Query_log_event::exec_event(struct st_relay_log_info* rli) int Query_log_event::exec_event(struct st_relay_log_info* rli)
{ {
int expected_error,actual_error= 0; int expected_error,actual_error= 0;
thd->db= (char*) rewrite_db(db); // thd->db_length is set later if needed thd->db_length= db_len;
thd->db= (char*) rewrite_db(db, &thd->db_length);
/* /*
InnoDB internally stores the master log position it has processed so far; InnoDB internally stores the master log position it has processed so far;
...@@ -995,11 +996,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -995,11 +996,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db)) if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{ {
thd->set_time((time_t)when); thd->set_time((time_t)when);
/*
We cannot use db_len from event to fill thd->db_length, because
rewrite_db() may have changed db.
*/
thd->db_length= thd->db ? strlen(thd->db) : 0;
thd->query_length= q_len; thd->query_length= q_len;
thd->query = (char*)query; thd->query = (char*)query;
VOID(pthread_mutex_lock(&LOCK_thread_count)); VOID(pthread_mutex_lock(&LOCK_thread_count));
...@@ -1057,7 +1053,7 @@ Default database: '%s'. Query: '%s'", ...@@ -1057,7 +1053,7 @@ Default database: '%s'. Query: '%s'",
expected_error, expected_error,
actual_error ? thd->net.last_error: "no error", actual_error ? thd->net.last_error: "no error",
actual_error, actual_error,
print_slave_db_safe(db), query); print_slave_db_safe(thd->db), query);
thd->query_error= 1; thd->query_error= 1;
} }
/* /*
...@@ -1078,7 +1074,7 @@ Default database: '%s'. Query: '%s'", ...@@ -1078,7 +1074,7 @@ Default database: '%s'. Query: '%s'",
"Error '%s' on query. Default database: '%s'. Query: '%s'", "Error '%s' on query. Default database: '%s'. Query: '%s'",
(actual_error ? thd->net.last_error : (actual_error ? thd->net.last_error :
"unexpected success or fatal error"), "unexpected success or fatal error"),
print_slave_db_safe(db), query); print_slave_db_safe(thd->db), query);
thd->query_error= 1; thd->query_error= 1;
} }
} /* End of if (db_ok(... */ } /* End of if (db_ok(... */
...@@ -1706,7 +1702,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ...@@ -1706,7 +1702,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
bool use_rli_only_for_errors) bool use_rli_only_for_errors)
{ {
char *load_data_query= 0; char *load_data_query= 0;
thd->db= (char*) rewrite_db(db); // thd->db_length is set later if needed thd->db_length= db_len;
thd->db= (char*) rewrite_db(db, &thd->db_length);
DBUG_ASSERT(thd->query == 0); DBUG_ASSERT(thd->query == 0);
thd->query_length= 0; // Should not be needed thd->query_length= 0; // Should not be needed
thd->query_error= 0; thd->query_error= 0;
...@@ -1741,7 +1738,6 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ...@@ -1741,7 +1738,6 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db)) if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{ {
thd->set_time((time_t)when); thd->set_time((time_t)when);
thd->db_length= thd->db ? strlen(thd->db) : 0;
VOID(pthread_mutex_lock(&LOCK_thread_count)); VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id = query_id++; thd->query_id = query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count)); VOID(pthread_mutex_unlock(&LOCK_thread_count));
...@@ -1847,7 +1843,7 @@ Slave: load data infile on table '%s' at log position %s in log \ ...@@ -1847,7 +1843,7 @@ Slave: load data infile on table '%s' at log position %s in log \
(char*) table_name, (char*) table_name,
llstr(log_pos,llbuff), RPL_LOG_NAME, llstr(log_pos,llbuff), RPL_LOG_NAME,
(ulong) thd->cuted_fields, (ulong) thd->cuted_fields,
print_slave_db_safe(db)); print_slave_db_safe(thd->db));
} }
if (net) if (net)
net->pkt_nr= thd->net.pkt_nr; net->pkt_nr= thd->net.pkt_nr;
...@@ -1865,6 +1861,7 @@ Slave: load data infile on table '%s' at log position %s in log \ ...@@ -1865,6 +1861,7 @@ Slave: load data infile on table '%s' at log position %s in log \
} }
thd->net.vio = 0; thd->net.vio = 0;
char *save_db= thd->db;
VOID(pthread_mutex_lock(&LOCK_thread_count)); VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->db= 0; thd->db= 0;
thd->query= 0; thd->query= 0;
...@@ -1887,7 +1884,7 @@ Slave: load data infile on table '%s' at log position %s in log \ ...@@ -1887,7 +1884,7 @@ Slave: load data infile on table '%s' at log position %s in log \
} }
slave_print_error(rli,sql_errno,"\ slave_print_error(rli,sql_errno,"\
Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'", Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
err, (char*)table_name, print_slave_db_safe(db)); err, (char*)table_name, print_slave_db_safe(save_db));
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
return 1; return 1;
} }
...@@ -1897,7 +1894,7 @@ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'", ...@@ -1897,7 +1894,7 @@ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
{ {
slave_print_error(rli,ER_UNKNOWN_ERROR, "\ slave_print_error(rli,ER_UNKNOWN_ERROR, "\
Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'", Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'",
(char*)table_name, print_slave_db_safe(db)); (char*)table_name, print_slave_db_safe(save_db));
return 1; return 1;
} }
......
...@@ -331,3 +331,4 @@ character-set=latin2 ...@@ -331,3 +331,4 @@ character-set=latin2
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -322,3 +322,4 @@ character-set=latin1 ...@@ -322,3 +322,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -331,3 +331,4 @@ character-set=latin1 ...@@ -331,3 +331,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -319,3 +319,4 @@ character-set=latin1 ...@@ -319,3 +319,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -324,3 +324,4 @@ character-set=latin7 ...@@ -324,3 +324,4 @@ character-set=latin7
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -319,3 +319,4 @@ character-set=latin1 ...@@ -319,3 +319,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -332,3 +332,4 @@ character-set=latin1 ...@@ -332,3 +332,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -319,3 +319,4 @@ character-set=greek ...@@ -319,3 +319,4 @@ character-set=greek
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -324,3 +324,4 @@ character-set=latin2 ...@@ -324,3 +324,4 @@ character-set=latin2
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -319,3 +319,4 @@ character-set=latin1 ...@@ -319,3 +319,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -323,3 +323,4 @@ character-set=ujis ...@@ -323,3 +323,4 @@ character-set=ujis
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -319,3 +319,4 @@ character-set=euckr ...@@ -319,3 +319,4 @@ character-set=euckr
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -321,3 +321,4 @@ character-set=latin1 ...@@ -321,3 +321,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -321,3 +321,4 @@ character-set=latin1 ...@@ -321,3 +321,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -324,3 +324,4 @@ character-set=latin2 ...@@ -324,3 +324,4 @@ character-set=latin2
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -321,3 +321,4 @@ character-set=latin1 ...@@ -321,3 +321,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -324,3 +324,4 @@ character-set=latin2 ...@@ -324,3 +324,4 @@ character-set=latin2
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -324,3 +324,4 @@ character-set=koi8r ...@@ -324,3 +324,4 @@ character-set=koi8r
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -312,3 +312,4 @@ character-set=cp1250 ...@@ -312,3 +312,4 @@ character-set=cp1250
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -327,3 +327,4 @@ character-set=latin2 ...@@ -327,3 +327,4 @@ character-set=latin2
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -323,3 +323,4 @@ character-set=latin1 ...@@ -323,3 +323,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -319,3 +319,4 @@ character-set=latin1 ...@@ -319,3 +319,4 @@ character-set=latin1
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -325,3 +325,4 @@ character-set=koi8u ...@@ -325,3 +325,4 @@ character-set=koi8u
"Invalid %s character string: '%.64s'", "Invalid %s character string: '%.64s'",
"Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
"Conflicting declarations: '%s%s' and '%s%s'" "Conflicting declarations: '%s%s' and '%s%s'"
"This MySQL server does not support any consistent-read capable storage engine"
...@@ -1032,7 +1032,7 @@ bool net_request_file(NET* net, const char* fname) ...@@ -1032,7 +1032,7 @@ bool net_request_file(NET* net, const char* fname)
} }
const char *rewrite_db(const char* db) const char *rewrite_db(const char* db, uint *new_len)
{ {
if (replicate_rewrite_db.is_empty() || !db) if (replicate_rewrite_db.is_empty() || !db)
return db; return db;
...@@ -1042,8 +1042,11 @@ const char *rewrite_db(const char* db) ...@@ -1042,8 +1042,11 @@ const char *rewrite_db(const char* db)
while ((tmp=it++)) while ((tmp=it++))
{ {
if (!strcmp(tmp->key, db)) if (!strcmp(tmp->key, db))
{
*new_len= strlen(tmp->val);
return tmp->val; return tmp->val;
} }
}
return db; return db;
} }
...@@ -1056,7 +1059,7 @@ const char *rewrite_db(const char* db) ...@@ -1056,7 +1059,7 @@ const char *rewrite_db(const char* db)
const char *print_slave_db_safe(const char* db) const char *print_slave_db_safe(const char* db)
{ {
return (db ? rewrite_db(db) : ""); return (db ? db : "");
} }
/* /*
......
...@@ -510,8 +510,8 @@ int add_table_rule(HASH* h, const char* table_spec); ...@@ -510,8 +510,8 @@ int add_table_rule(HASH* h, const char* table_spec);
int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec);
void init_table_rule_hash(HASH* h, bool* h_inited); void init_table_rule_hash(HASH* h, bool* h_inited);
void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited); void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited);
const char *rewrite_db(const char* db); const char *rewrite_db(const char* db, uint *new_db_len);
const char *print_slave_db_safe(const char* db); const char *print_slave_db_safe(const char *db);
int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code); int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code);
void skip_load_data_infile(NET* net); void skip_load_data_infile(NET* net);
void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...); void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...);
......
...@@ -613,7 +613,7 @@ typedef struct st_lex ...@@ -613,7 +613,7 @@ typedef struct st_lex
uint uint_geom_type; uint uint_geom_type;
uint grant, grant_tot_col, which_columns; uint grant, grant_tot_col, which_columns;
uint fk_delete_opt, fk_update_opt, fk_match_option; uint fk_delete_opt, fk_update_opt, fk_match_option;
uint slave_thd_opt; uint slave_thd_opt, start_transaction_opt;
uint8 describe; uint8 describe;
bool drop_if_exists, drop_temporary, local_file, one_shot_set; bool drop_if_exists, drop_temporary, local_file, one_shot_set;
bool in_comment, ignore_space, verbose, no_write_to_binlog; bool in_comment, ignore_space, verbose, no_write_to_binlog;
......
...@@ -3076,6 +3076,12 @@ purposes internal to the MySQL server", MYF(0)); ...@@ -3076,6 +3076,12 @@ purposes internal to the MySQL server", MYF(0));
} }
case SQLCOM_UNLOCK_TABLES: case SQLCOM_UNLOCK_TABLES:
/*
It is critical for mysqldump --single-transaction --master-data that
UNLOCK TABLES does not implicitely commit a connection which has only
done FLUSH TABLES WITH READ LOCK + BEGIN. If this assumption becomes
false, mysqldump will not work.
*/
unlock_locked_tables(thd); unlock_locked_tables(thd);
if (thd->options & OPTION_TABLE_LOCK) if (thd->options & OPTION_TABLE_LOCK)
{ {
...@@ -3462,6 +3468,8 @@ purposes internal to the MySQL server", MYF(0)); ...@@ -3462,6 +3468,8 @@ purposes internal to the MySQL server", MYF(0));
thd->options= ((thd->options & (ulong) ~(OPTION_STATUS_NO_TRANS_UPDATE)) | thd->options= ((thd->options & (ulong) ~(OPTION_STATUS_NO_TRANS_UPDATE)) |
OPTION_BEGIN); OPTION_BEGIN);
thd->server_status|= SERVER_STATUS_IN_TRANS; thd->server_status|= SERVER_STATUS_IN_TRANS;
if (!(lex->start_transaction_opt & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT) ||
!(res= ha_start_consistent_snapshot(thd)))
send_ok(thd); send_ok(thd);
} }
break; break;
......
...@@ -131,6 +131,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -131,6 +131,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token CLIENT_SYM %token CLIENT_SYM
%token COMMENT_SYM %token COMMENT_SYM
%token COMMIT_SYM %token COMMIT_SYM
%token CONSISTENT_SYM
%token COUNT_SYM %token COUNT_SYM
%token CREATE %token CREATE
%token CROSS %token CROSS
...@@ -165,6 +166,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -165,6 +166,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token SELECT_SYM %token SELECT_SYM
%token SHOW %token SHOW
%token SLAVE %token SLAVE
%token SNAPSHOT_SYM
%token SQL_THREAD %token SQL_THREAD
%token START_SYM %token START_SYM
%token STD_SYM %token STD_SYM
...@@ -618,6 +620,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -618,6 +620,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
table_option opt_if_not_exists opt_no_write_to_binlog opt_var_type table_option opt_if_not_exists opt_no_write_to_binlog opt_var_type
opt_var_ident_type delete_option opt_temporary all_or_any opt_distinct opt_var_ident_type delete_option opt_temporary all_or_any opt_distinct
opt_ignore_leaves fulltext_options spatial_type union_option opt_ignore_leaves fulltext_options spatial_type union_option
start_transaction_opts
%type <ulong_num> %type <ulong_num>
ULONG_NUM raid_types merge_insert_types ULONG_NUM raid_types merge_insert_types
...@@ -2095,10 +2098,20 @@ slave: ...@@ -2095,10 +2098,20 @@ slave:
start: start:
START_SYM TRANSACTION_SYM { Lex->sql_command = SQLCOM_BEGIN;} START_SYM TRANSACTION_SYM start_transaction_opts
{} {
Lex->sql_command = SQLCOM_BEGIN;
Lex->start_transaction_opt= $3;
}
; ;
start_transaction_opts:
/*empty*/ { $$ = 0; }
| WITH CONSISTENT_SYM SNAPSHOT_SYM
{
$$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT;
}
slave_thread_opts: slave_thread_opts:
{ Lex->slave_thd_opt= 0; } { Lex->slave_thd_opt= 0; }
slave_thread_opt_list slave_thread_opt_list
...@@ -5122,6 +5135,7 @@ keyword: ...@@ -5122,6 +5135,7 @@ keyword:
| COMMIT_SYM {} | COMMIT_SYM {}
| COMPRESSED_SYM {} | COMPRESSED_SYM {}
| CONCURRENT {} | CONCURRENT {}
| CONSISTENT_SYM {}
| CUBE_SYM {} | CUBE_SYM {}
| DATA_SYM {} | DATA_SYM {}
| DATETIME {} | DATETIME {}
...@@ -5262,6 +5276,7 @@ keyword: ...@@ -5262,6 +5276,7 @@ keyword:
| SHARE_SYM {} | SHARE_SYM {}
| SHUTDOWN {} | SHUTDOWN {}
| SLAVE {} | SLAVE {}
| SNAPSHOT_SYM {}
| SOUNDS_SYM {} | SOUNDS_SYM {}
| SQL_CACHE_SYM {} | SQL_CACHE_SYM {}
| SQL_BUFFER_RESULT {} | SQL_BUFFER_RESULT {}
...@@ -5888,7 +5903,7 @@ grant_option: ...@@ -5888,7 +5903,7 @@ grant_option:
; ;
begin: begin:
BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN;} opt_work {} BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN; Lex->start_transaction_opt= 0;} opt_work {}
; ;
opt_work: opt_work:
......
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