Commit 70f11286 authored by marko's avatar marko

branches/innodb+: Merge revisions 2835:2862 from branches/zip:

  ------------------------------------------------------------------------
  r2838 | vasil | 2008-10-21 12:49:27 +0300 (Tue, 21 Oct 2008) | 61 lines

  branches/zip:

  Merge 2744:2837 from branches/5.1 (skipping r2782 and r2826):

    ------------------------------------------------------------------------
    r2832 | vasil | 2008-10-21 10:08:30 +0300 (Tue, 21 Oct 2008) | 10 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc

    branches/5.1:

    In ha_innobase::info():

    Replace sql_print_warning() which prints to mysqld error log with
    push_warning_printf() which sends the error message to the client.

    Suggested by: Marko, Sunny, Michael
    Objected by:  Inaam

    ------------------------------------------------------------------------
    r2837 | vasil | 2008-10-21 12:07:44 +0300 (Tue, 21 Oct 2008) | 32 lines
    Changed paths:
       M /branches/5.1/mysql-test/innodb-semi-consistent.result
       M /branches/5.1/mysql-test/innodb-semi-consistent.test
       M /branches/5.1/mysql-test/innodb.result
       M /branches/5.1/mysql-test/innodb.test

    branches/5.1:

    Merge a change from MySQL (this fixes the failing innodb and
    innodb-semi-consistent tests):

      revno: 2757
      committer: Georgi Kodinov <kgeorge@mysql.com>
      branch nick: B39812-5.1-5.1.29-rc
      timestamp: Fri 2008-10-03 15:24:19 +0300
      message:
        Bug #39812: Make statement replication default for 5.1 (to match 5.0)

        Make STMT replication default for 5.1.
        Add a default of MIXED into the config files
        Fix the tests that needed MIXED replication mode.
      modified:
        mysql-test/include/mix1.inc
        mysql-test/r/innodb-semi-consistent.result
        mysql-test/r/innodb.result
        mysql-test/r/innodb_mysql.result
        mysql-test/r/tx_isolation_func.result
        mysql-test/t/innodb-semi-consistent.test
        mysql-test/t/innodb.test
        mysql-test/t/tx_isolation_func.test
        sql/mysqld.cc
        support-files/my-huge.cnf.sh
        support-files/my-innodb-heavy-4G.cnf.sh
        support-files/my-large.cnf.sh
        support-files/my-medium.cnf.sh
        support-files/my-small.cnf.sh


    ------------------------------------------------------------------------

  ------------------------------------------------------------------------
  r2847 | marko | 2008-10-22 10:07:37 +0300 (Wed, 22 Oct 2008) | 6 lines

  branches/zip: page_zip_rec_needs_ext(): Fix a bug that was introduced
  in the fix of Mantis issue #73.  With key_block_size=16, we will also
  have to check the available space on the uncompressed page.
  Otherwise, the clustered index record can be almost 16 kilobytes in
  size, and the undo log record will not fit.
  ------------------------------------------------------------------------
  r2850 | marko | 2008-10-22 13:52:12 +0300 (Wed, 22 Oct 2008) | 2 lines

  branches/zip: ibuf_insert_to_index_page(): Discard the local variable block.
  page_cur is always positioned on block, the function parameter.
  ------------------------------------------------------------------------
  r2853 | sunny | 2008-10-23 01:52:09 +0300 (Thu, 23 Oct 2008) | 2 lines
  branches/zip: Add missing UNIV_INTERN.
  ------------------------------------------------------------------------
  r2855 | sunny | 2008-10-23 09:29:46 +0300 (Thu, 23 Oct 2008) | 36 lines

  branches/zip:

  Merge revisions 2837:2852 from branches/5.1:

    ------------------------------------------------------------------------
    r2849 | sunny | 2008-10-22 12:01:18 +0300 (Wed, 22 Oct 2008) | 8 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/include/row0mysql.h
       M /branches/5.1/row/row0mysql.c

    branches/5.1: Return the actual error code encountered when allocating
    a new autoinc value. The change in behavior (bug) was introduced in 5.1.22
    when we introduced the new AUTOINC locking model.

    rb://31

    Bug#40224 New AUTOINC changes mask reporting of deadlock/timeout errors

    ------------------------------------------------------------------------
    r2852 | sunny | 2008-10-23 01:42:24 +0300 (Thu, 23 Oct 2008) | 9 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/handler/ha_innodb.h

    branches/5.1: Backport r2724 from branches/zip

    Check column value against the col max value before updating the table's
    global autoinc counter value. This is part of simplifying the AUTOINC
    sub-system. We extract the type info from MySQL data structures at runtime.

    This fixes Bug#37788 InnoDB Plugin: AUTO_INCREMENT wrong for compressed tables

    ------------------------------------------------------------------------

  ------------------------------------------------------------------------
  r2856 | sunny | 2008-10-23 10:07:05 +0300 (Thu, 23 Oct 2008) | 1 line

  Reverting test file changes from r2855
  ------------------------------------------------------------------------
  r2857 | sunny | 2008-10-23 10:24:33 +0300 (Thu, 23 Oct 2008) | 30 lines

  branches/zip:

  Merge revisions 2852:2854 from branches/5.1:

    ------------------------------------------------------------------------
    r2854 | sunny | 2008-10-23 08:30:32 +0300 (Thu, 23 Oct 2008) | 13 lines
    Changed paths:
       M /branches/5.1/dict/dict0dict.c
       M /branches/5.1/dict/dict0mem.c
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/handler/ha_innodb.h
       M /branches/5.1/include/dict0dict.h
       M /branches/5.1/include/dict0mem.h
       M /branches/5.1/row/row0mysql.c

    branches/5.1: Backport changes from branches/zip r2725

    Simplify the autoinc initialization code. This removes the
    non-determinism related to reading the table's autoinc value for the first
    time. This change has also reduced the sizeof dict_table_t by sizeof(ibool)
    bytes because we don't need the dict_table_t::autoinc_inited field anymore.

    Bug#39830 Table autoinc value not updated on first insert.
    Bug#35498 Cannot get table test/table1 auto-inccounter value in ::info
    Bug#36411 Failed to read auto-increment value from storage engine" in 5.1.24 auto-inc
    rb://16


    ------------------------------------------------------------------------

  ------------------------------------------------------------------------
  r2858 | vasil | 2008-10-23 11:33:43 +0300 (Thu, 23 Oct 2008) | 4 lines

  branches/zip:

  Update the ChangeLog
  ------------------------------------------------------------------------
  r2861 | marko | 2008-10-23 12:27:15 +0300 (Thu, 23 Oct 2008) | 24 lines

  branches/zip: Clean up the file format stamping.

  trx_sys_file_format_max_upgrade(): Rename from
  trx_sys_file_format_max_update().  Improve the documentation.  Add a
  const qualifier to the parameter "name".  Replace the parameter
  "flags" with "format_id", because this function should deal with file
  format identifiers, not with table flags.

  trx_sys_file_format_max_write(), trx_sys_file_format_max_set(): Add a
  const qualifier to the parameter "name".

  ha_innodb.cc: Correct the spelling in some comments: "side effect".
  Remove redundant prototypes for some static callback functions.

  innodb_file_format_name_update(), innodb_file_format_check_update():
  Correct the function signature.  Use appropriate pointer type conversions.

  MYSQL_SYSVAR_STR(file_format), MYSQL_SYSVAR_STR(file_format_check):
  Remove the type conversions from the callback function pointers.  When
  the function signatures match, no type conversion is needed.  The type
  conversions would only prevent compilation warnings for any mismatch.

  Approved by Sunny in rb://25.
  ------------------------------------------------------------------------
  r2862 | marko | 2008-10-23 12:37:42 +0300 (Thu, 23 Oct 2008) | 8 lines

  branches/zip: Non-functional changes:

  ibuf_get_volume_buffered(): Declare with static linkage.
  This function is private to ibuf0ibuf.c.

  btr_cur_pessimistic_delete(): Use the cached result of
  btr_cur_get_index(cursor).
  ------------------------------------------------------------------------
parent c782aeff
2008-10-22 The InnoDB Team
* dict/dict0dict.c, dict/dict0mem.c, handler/ha_innodb.cc,
handler/ha_innodb.h, include/dict0dict.h, include/dict0mem.h,
row/row0mysql.c:
Fix Bug#39830 Table autoinc value not updated on first insert
Fix Bug#35498 Cannot get table test/table1 auto-inccounter value in
::info
Fix Bug#36411 "Failed to read auto-increment value from storage
engine" in 5.1.24 auto-inc
2008-10-22 The InnoDB Team
* handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c:
Fix Bug#40224 New AUTOINC changes mask reporting of deadlock/timeout
errors
2008-10-09 The InnoDB Team
* buf/buf0lru.c:
Fix Bug#39939 DROP TABLE/DISCARD TABLESPACE takes long time in
buf_LRU_invalidate_tablespace()
2008-10-08 The InnoDB Team 2008-10-08 The InnoDB Team
* dict/dict0crea.c, trx/trx0roll.c, include/row0mysql.h, * dict/dict0crea.c, trx/trx0roll.c, include/row0mysql.h,
......
...@@ -3004,7 +3004,7 @@ btr_cur_pessimistic_delete( ...@@ -3004,7 +3004,7 @@ btr_cur_pessimistic_delete(
} }
if (UNIV_UNLIKELY(page_get_n_recs(page) < 2) if (UNIV_UNLIKELY(page_get_n_recs(page) < 2)
&& UNIV_UNLIKELY(dict_index_get_page(btr_cur_get_index(cursor)) && UNIV_UNLIKELY(dict_index_get_page(index)
!= buf_block_get_page_no(block))) { != buf_block_get_page_no(block))) {
/* If there is only one record, drop the whole page in /* If there is only one record, drop the whole page in
......
...@@ -317,7 +317,7 @@ dict_table_autoinc_read( ...@@ -317,7 +317,7 @@ dict_table_autoinc_read(
/************************************************************************ /************************************************************************
Updates the autoinc counter if the value supplied is greater than the Updates the autoinc counter if the value supplied is greater than the
current value. If not inited, does nothing. */ current value. */
UNIV_INTERN UNIV_INTERN
void void
dict_table_autoinc_update_if_greater( dict_table_autoinc_update_if_greater(
...@@ -329,6 +329,7 @@ dict_table_autoinc_update_if_greater( ...@@ -329,6 +329,7 @@ dict_table_autoinc_update_if_greater(
ut_ad(mutex_own(&table->autoinc_mutex)); ut_ad(mutex_own(&table->autoinc_mutex));
if (value > table->autoinc) { if (value > table->autoinc) {
table->autoinc = value; table->autoinc = value;
} }
} }
......
...@@ -62,6 +62,12 @@ dict_mem_table_create( ...@@ -62,6 +62,12 @@ dict_mem_table_create(
mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX); mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
table->autoinc = 0;
/* The number of transactions that are either waiting on the
AUTOINC lock or have been granted the lock. */
table->n_waiting_or_granted_auto_inc_locks = 0;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
table->magic_n = DICT_TABLE_MAGIC_N; table->magic_n = DICT_TABLE_MAGIC_N;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
......
This diff is collapsed.
...@@ -81,7 +81,7 @@ class ha_innobase: public handler ...@@ -81,7 +81,7 @@ class ha_innobase: public handler
ulint innobase_update_autoinc(ulonglong auto_inc); ulint innobase_update_autoinc(ulonglong auto_inc);
ulint innobase_initialize_autoinc(); ulint innobase_initialize_autoinc();
dict_index_t* innobase_get_index(uint keynr); dict_index_t* innobase_get_index(uint keynr);
ulonglong innobase_get_int_col_max_value(const Field* field); ulonglong innobase_get_int_col_max_value(const Field* field);
/* Init values for the class: */ /* Init values for the class: */
public: public:
......
...@@ -2526,7 +2526,7 @@ ibuf_contract_after_insert( ...@@ -2526,7 +2526,7 @@ ibuf_contract_after_insert(
/************************************************************************* /*************************************************************************
Gets an upper limit for the combined size of entries buffered in the insert Gets an upper limit for the combined size of entries buffered in the insert
buffer for a given page. */ buffer for a given page. */
UNIV_INTERN static
ulint ulint
ibuf_get_volume_buffered( ibuf_get_volume_buffered(
/*=====================*/ /*=====================*/
...@@ -3370,11 +3370,9 @@ ibuf_insert_to_index_page( ...@@ -3370,11 +3370,9 @@ ibuf_insert_to_index_page(
PAGE_CUR_LE, &page_cur); PAGE_CUR_LE, &page_cur);
if (low_match == dtuple_get_n_fields(entry)) { if (low_match == dtuple_get_n_fields(entry)) {
buf_block_t* block;
page_zip_des_t* page_zip; page_zip_des_t* page_zip;
rec = page_cur_get_rec(&page_cur); rec = page_cur_get_rec(&page_cur);
block = page_cur_get_block(&page_cur);
page_zip = buf_block_get_page_zip(block); page_zip = buf_block_get_page_zip(block);
btr_cur_set_deleted_flag_for_ibuf(rec, page_zip, FALSE, mtr); btr_cur_set_deleted_flag_for_ibuf(rec, page_zip, FALSE, mtr);
......
...@@ -189,8 +189,8 @@ dict_table_autoinc_read( ...@@ -189,8 +189,8 @@ dict_table_autoinc_read(
/* out: value for a new row, or 0 */ /* out: value for a new row, or 0 */
const dict_table_t* table); /* in: table */ const dict_table_t* table); /* in: table */
/************************************************************************ /************************************************************************
Updates the autoinc counter if the value supplied is equal or bigger than the Updates the autoinc counter if the value supplied is greater than the
current value. If not inited, does nothing. */ current value. */
UNIV_INTERN UNIV_INTERN
void void
dict_table_autoinc_update_if_greater( dict_table_autoinc_update_if_greater(
......
...@@ -168,9 +168,11 @@ page_zip_rec_needs_ext( ...@@ -168,9 +168,11 @@ page_zip_rec_needs_ext(
the dense page directory for every record. But there the dense page directory for every record. But there
is no record header. There should be enough room for is no record header. There should be enough room for
one record on an empty leaf page. Subtract 1 byte for one record on an empty leaf page. Subtract 1 byte for
the encoded heap number. */ the encoded heap number. Check also the available space
on the uncompressed page. */
return(rec_size - (REC_N_NEW_EXTRA_BYTES - 2) return(rec_size - (REC_N_NEW_EXTRA_BYTES - 2)
>= (page_zip_empty_size(n_fields, zip_size) - 1)); >= (page_zip_empty_size(n_fields, zip_size) - 1)
|| rec_size >= page_get_free_space_of_empty(TRUE) / 2);
} }
return(rec_size >= page_get_free_space_of_empty(comp) / 2); return(rec_size >= page_get_free_space_of_empty(comp) / 2);
......
...@@ -707,6 +707,11 @@ struct row_prebuilt_struct { ...@@ -707,6 +707,11 @@ struct row_prebuilt_struct {
ulonglong autoinc_offset; /* The offset passed to ulonglong autoinc_offset; /* The offset passed to
get_auto_increment() by MySQL. Required get_auto_increment() by MySQL. Required
to calculate the next value */ to calculate the next value */
ulint autoinc_error; /* The actual error code encountered
while trying to init or read the
autoinc value from the table. We
store it here so that we can return
it to MySQL */
/*----------------------*/ /*----------------------*/
UT_LIST_NODE_T(row_prebuilt_t) prebuilts; UT_LIST_NODE_T(row_prebuilt_t) prebuilts;
/* list node of table->prebuilts */ /* list node of table->prebuilts */
......
...@@ -326,7 +326,7 @@ const char* ...@@ -326,7 +326,7 @@ const char*
trx_sys_file_format_id_to_name( trx_sys_file_format_id_to_name(
/*===========================*/ /*===========================*/
/* out: pointer to the name */ /* out: pointer to the name */
const uint id); /* in: id of the file format */ const ulint id); /* in: id of the file format */
/********************************************************************* /*********************************************************************
Set the file format id unconditionally except if it's already the Set the file format id unconditionally except if it's already the
same value. */ same value. */
...@@ -336,7 +336,7 @@ trx_sys_file_format_max_set( ...@@ -336,7 +336,7 @@ trx_sys_file_format_max_set(
/*========================*/ /*========================*/
/* out: TRUE if value updated */ /* out: TRUE if value updated */
ulint format_id, /* in: file format id */ ulint format_id, /* in: file format id */
char** name); /* out: max file format name or const char** name); /* out: max file format name or
NULL if not needed. */ NULL if not needed. */
/********************************************************************* /*********************************************************************
Get the name representation of the file format from its id. */ Get the name representation of the file format from its id. */
...@@ -354,14 +354,16 @@ trx_sys_file_format_max_check( ...@@ -354,14 +354,16 @@ trx_sys_file_format_max_check(
/* out: DB_SUCCESS or error code */ /* out: DB_SUCCESS or error code */
ulint max_format_id); /* in: the max format id to check */ ulint max_format_id); /* in: the max format id to check */
/************************************************************************ /************************************************************************
Update the file format tag in the tablespace to the max value. */ Update the file format tag in the system tablespace only if the given
format id is greater than the known max id. */
UNIV_INTERN UNIV_INTERN
ibool ibool
trx_sys_file_format_max_update( trx_sys_file_format_max_upgrade(
/*===========================*/ /*============================*/
/* out: TRUE if value updated */ /* out: TRUE if format_id was
uint flags, /* in: flags of the table */ bigger than the known max id */
char** name); /* out: max format name */ const char** name, /* out: max file format name */
ulint format_id); /* in: file format identifier */
/* The automatically created system rollback segment has this id */ /* The automatically created system rollback segment has this id */
#define TRX_SYS_SYSTEM_RSEG_ID 0 #define TRX_SYS_SYSTEM_RSEG_ID 0
......
drop table if exists t1; drop table if exists t1;
set binlog_format=mixed;
set session transaction isolation level read committed; set session transaction isolation level read committed;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2),(3),(4),(5),(6),(7); insert into t1 values (1),(2),(3),(4),(5),(6),(7);
...@@ -6,6 +7,7 @@ set autocommit=0; ...@@ -6,6 +7,7 @@ set autocommit=0;
select * from t1 where a=3 lock in share mode; select * from t1 where a=3 lock in share mode;
a a
3 3
set binlog_format=mixed;
set session transaction isolation level read committed; set session transaction isolation level read committed;
set autocommit=0; set autocommit=0;
update t1 set a=10 where a=5; update t1 set a=10 where a=5;
......
...@@ -10,6 +10,7 @@ drop table if exists t1; ...@@ -10,6 +10,7 @@ drop table if exists t1;
connect (a,localhost,root,,); connect (a,localhost,root,,);
connect (b,localhost,root,,); connect (b,localhost,root,,);
connection a; connection a;
set binlog_format=mixed;
set session transaction isolation level read committed; set session transaction isolation level read committed;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2),(3),(4),(5),(6),(7); insert into t1 values (1),(2),(3),(4),(5),(6),(7);
...@@ -17,6 +18,7 @@ set autocommit=0; ...@@ -17,6 +18,7 @@ set autocommit=0;
# this should lock the entire table # this should lock the entire table
select * from t1 where a=3 lock in share mode; select * from t1 where a=3 lock in share mode;
connection b; connection b;
set binlog_format=mixed;
set session transaction isolation level read committed; set session transaction isolation level read committed;
set autocommit=0; set autocommit=0;
-- error ER_LOCK_WAIT_TIMEOUT -- error ER_LOCK_WAIT_TIMEOUT
......
...@@ -1024,6 +1024,7 @@ id code name ...@@ -1024,6 +1024,7 @@ id code name
4 2 Erik 4 2 Erik
5 3 Sasha 5 3 Sasha
COMMIT; COMMIT;
SET binlog_format='MIXED';
BEGIN; BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt'); insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
...@@ -2963,9 +2964,11 @@ drop table t1,t2; ...@@ -2963,9 +2964,11 @@ drop table t1,t2;
create table t1(a int not null, b int, primary key(a)) engine=innodb; create table t1(a int not null, b int, primary key(a)) engine=innodb;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
commit; commit;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
update t1 set b = 5 where b = 1; update t1 set b = 5 where b = 1;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
select * from t1 where a = 7 and b = 3 for update; select * from t1 where a = 7 and b = 3 for update;
...@@ -3004,6 +3007,7 @@ d e ...@@ -3004,6 +3007,7 @@ d e
3 1 3 1
8 6 8 6
12 1 12 1
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
insert into t1 select * from t2; insert into t1 select * from t2;
...@@ -3034,30 +3038,39 @@ a b ...@@ -3034,30 +3038,39 @@ a b
3 1 3 1
8 6 8 6
12 1 12 1
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
insert into t1 select * from t2; insert into t1 select * from t2;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
update t3 set b = (select b from t2 where a = d); update t3 set b = (select b from t2 where a = d);
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
insert into t5 (select * from t2 lock in share mode); insert into t5 (select * from t2 lock in share mode);
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
update t6 set e = (select b from t2 where a = d lock in share mode); update t6 set e = (select b from t2 where a = d lock in share mode);
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
insert into t8 (select * from t2 for update); insert into t8 (select * from t2 for update);
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
update t9 set e = (select b from t2 where a = d for update); update t9 set e = (select b from t2 where a = d for update);
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
...@@ -3205,6 +3218,7 @@ id ...@@ -3205,6 +3218,7 @@ id
-10 -10
1 1
DROP TABLE t1; DROP TABLE t1;
SET binlog_format='MIXED';
SET TX_ISOLATION='read-committed'; SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
...@@ -3215,6 +3229,7 @@ CREATE TABLE t1 ( a int ) ENGINE=InnoDB; ...@@ -3215,6 +3229,7 @@ CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SELECT * FROM t2; SELECT * FROM t2;
a a
SET binlog_format='MIXED';
SET TX_ISOLATION='read-committed'; SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
...@@ -3222,10 +3237,12 @@ COMMIT; ...@@ -3222,10 +3237,12 @@ COMMIT;
SELECT * FROM t1 WHERE a=1; SELECT * FROM t1 WHERE a=1;
a a
1 1
SET binlog_format='MIXED';
SET TX_ISOLATION='read-committed'; SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
SELECT * FROM t2; SELECT * FROM t2;
a a
SET binlog_format='MIXED';
SET TX_ISOLATION='read-committed'; SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
......
...@@ -701,6 +701,7 @@ insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha'); ...@@ -701,6 +701,7 @@ insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
select id, code, name from t1 order by id; select id, code, name from t1 order by id;
COMMIT; COMMIT;
SET binlog_format='MIXED';
BEGIN; BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt'); insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
...@@ -2001,10 +2002,12 @@ connection a; ...@@ -2001,10 +2002,12 @@ connection a;
create table t1(a int not null, b int, primary key(a)) engine=innodb; create table t1(a int not null, b int, primary key(a)) engine=innodb;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
commit; commit;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
update t1 set b = 5 where b = 1; update t1 set b = 5 where b = 1;
connection b; connection b;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
# #
...@@ -2072,6 +2075,7 @@ commit; ...@@ -2072,6 +2075,7 @@ commit;
set autocommit = 0; set autocommit = 0;
select * from t2 for update; select * from t2 for update;
connection b; connection b;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
insert into t1 select * from t2; insert into t1 select * from t2;
...@@ -2128,46 +2132,55 @@ commit; ...@@ -2128,46 +2132,55 @@ commit;
set autocommit = 0; set autocommit = 0;
select * from t2 for update; select * from t2 for update;
connection b; connection b;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--send --send
insert into t1 select * from t2; insert into t1 select * from t2;
connection c; connection c;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--send --send
update t3 set b = (select b from t2 where a = d); update t3 set b = (select b from t2 where a = d);
connection d; connection d;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--send --send
create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
connection e; connection e;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
--send --send
insert into t5 (select * from t2 lock in share mode); insert into t5 (select * from t2 lock in share mode);
connection f; connection f;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
--send --send
update t6 set e = (select b from t2 where a = d lock in share mode); update t6 set e = (select b from t2 where a = d lock in share mode);
connection g; connection g;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
--send --send
create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
connection h; connection h;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
--send --send
insert into t8 (select * from t2 for update); insert into t8 (select * from t2 for update);
connection i; connection i;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
--send --send
update t9 set e = (select b from t2 where a = d for update); update t9 set e = (select b from t2 where a = d for update);
connection j; connection j;
SET binlog_format='MIXED';
set autocommit = 0; set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
--send --send
...@@ -2382,6 +2395,7 @@ DROP TABLE t1; ...@@ -2382,6 +2395,7 @@ DROP TABLE t1;
CONNECT (c1,localhost,root,,); CONNECT (c1,localhost,root,,);
CONNECT (c2,localhost,root,,); CONNECT (c2,localhost,root,,);
CONNECTION c1; CONNECTION c1;
SET binlog_format='MIXED';
SET TX_ISOLATION='read-committed'; SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
...@@ -2389,6 +2403,7 @@ CREATE TABLE t1 ( a int ) ENGINE=InnoDB; ...@@ -2389,6 +2403,7 @@ CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SELECT * FROM t2; SELECT * FROM t2;
CONNECTION c2; CONNECTION c2;
SET binlog_format='MIXED';
SET TX_ISOLATION='read-committed'; SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
...@@ -2400,10 +2415,12 @@ DISCONNECT c2; ...@@ -2400,10 +2415,12 @@ DISCONNECT c2;
CONNECT (c1,localhost,root,,); CONNECT (c1,localhost,root,,);
CONNECT (c2,localhost,root,,); CONNECT (c2,localhost,root,,);
CONNECTION c1; CONNECTION c1;
SET binlog_format='MIXED';
SET TX_ISOLATION='read-committed'; SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
SELECT * FROM t2; SELECT * FROM t2;
CONNECTION c2; CONNECTION c2;
SET binlog_format='MIXED';
SET TX_ISOLATION='read-committed'; SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
......
...@@ -625,6 +625,7 @@ row_create_prebuilt( ...@@ -625,6 +625,7 @@ row_create_prebuilt(
prebuilt->clust_ref = ref; prebuilt->clust_ref = ref;
prebuilt->autoinc_error = 0;
prebuilt->autoinc_offset = 0; prebuilt->autoinc_offset = 0;
/* Default to 1, we will set the actual value later in /* Default to 1, we will set the actual value later in
......
...@@ -24,7 +24,7 @@ Created 3/26/1996 Heikki Tuuri ...@@ -24,7 +24,7 @@ Created 3/26/1996 Heikki Tuuri
/* The file format tag structure with id and name. */ /* The file format tag structure with id and name. */
struct file_format_struct { struct file_format_struct {
uint id; /* id of the file format */ ulint id; /* id of the file format */
const char* name; /* text representation of the const char* name; /* text representation of the
file format */ file format */
mutex_t mutex; /* covers changes to the above mutex_t mutex; /* covers changes to the above
...@@ -95,8 +95,8 @@ static const char* file_format_name_map[] = { ...@@ -95,8 +95,8 @@ static const char* file_format_name_map[] = {
}; };
/* The number of elements in the file format name array. */ /* The number of elements in the file format name array. */
static const ulint FILE_FORMAT_NAME_N = static const ulint FILE_FORMAT_NAME_N
sizeof(file_format_name_map) / sizeof(file_format_name_map[0]); = sizeof(file_format_name_map) / sizeof(file_format_name_map[0]);
/* This is used to track the maximum file format id known to InnoDB. It's /* This is used to track the maximum file format id known to InnoDB. It's
updated via SET GLOBAL innodb_file_format_check = 'x' or when we open updated via SET GLOBAL innodb_file_format_check = 'x' or when we open
...@@ -1057,7 +1057,7 @@ trx_sys_file_format_max_write( ...@@ -1057,7 +1057,7 @@ trx_sys_file_format_max_write(
/*==========================*/ /*==========================*/
/* out: always TRUE */ /* out: always TRUE */
ulint format_id, /* in: file format id */ ulint format_id, /* in: file format id */
char** name) /* out: max file format name, can const char** name) /* out: max file format name, can
be NULL */ be NULL */
{ {
mtr_t mtr; mtr_t mtr;
...@@ -1077,7 +1077,7 @@ trx_sys_file_format_max_write( ...@@ -1077,7 +1077,7 @@ trx_sys_file_format_max_write(
tag_value_low = format_id + TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW; tag_value_low = format_id + TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
if (name) { if (name) {
*name = (char*) file_format_max.name; *name = file_format_max.name;
} }
mlog_write_dulint( mlog_write_dulint(
...@@ -1137,7 +1137,7 @@ const char* ...@@ -1137,7 +1137,7 @@ const char*
trx_sys_file_format_id_to_name( trx_sys_file_format_id_to_name(
/*===========================*/ /*===========================*/
/* out: pointer to the name */ /* out: pointer to the name */
const uint id) /* in: id of the file format */ const ulint id) /* in: id of the file format */
{ {
ut_a(id < FILE_FORMAT_NAME_N); ut_a(id < FILE_FORMAT_NAME_N);
...@@ -1207,7 +1207,7 @@ trx_sys_file_format_max_set( ...@@ -1207,7 +1207,7 @@ trx_sys_file_format_max_set(
/*========================*/ /*========================*/
/* out: TRUE if value updated */ /* out: TRUE if value updated */
ulint format_id, /* in: file format id */ ulint format_id, /* in: file format id */
char** name) /* out: max file format name or const char** name) /* out: max file format name or
NULL if not needed. */ NULL if not needed. */
{ {
ibool ret = FALSE; ibool ret = FALSE;
...@@ -1248,20 +1248,19 @@ trx_sys_file_format_tag_init(void) ...@@ -1248,20 +1248,19 @@ trx_sys_file_format_tag_init(void)
} }
/************************************************************************ /************************************************************************
Update the file format tag in the tablespace only if the given format id Update the file format tag in the system tablespace only if the given
is greater than the known max id. */ format id is greater than the known max id. */
UNIV_INTERN UNIV_INTERN
ibool ibool
trx_sys_file_format_max_update( trx_sys_file_format_max_upgrade(
/*===========================*/ /*============================*/
uint flags, /* in: flags of the table.*/ /* out: TRUE if format_id was
char** name) /* out: max file format name */ bigger than the known max id */
const char** name, /* out: max file format name */
ulint format_id) /* in: file format identifier */
{ {
ulint format_id;
ibool ret = FALSE; ibool ret = FALSE;
format_id = (flags & DICT_TF_FORMAT_MASK) >> DICT_TF_FORMAT_SHIFT;
ut_a(name); ut_a(name);
ut_a(file_format_max.name != NULL); ut_a(file_format_max.name != NULL);
ut_a(format_id <= DICT_TF_FORMAT_MAX); ut_a(format_id <= DICT_TF_FORMAT_MAX);
......
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