Loading innobase/row/row0ins.c +23 −18 Original line number Diff line number Diff line Loading @@ -51,14 +51,19 @@ innobase_invalidate_query_cache( chars count */ /********************************************************************** This function returns true if SQL-query in the current thread This function returns true if 1) SQL-query in the current thread is either REPLACE or LOAD DATA INFILE REPLACE. 2) SQL-query in the current thread is INSERT ON DUPLICATE KEY UPDATE. NOTE that /mysql/innobase/row/row0ins.c must contain the prototype for this function ! */ ibool innobase_query_is_replace(void); /*===========================*/ innobase_query_is_update(void); /************************************************************************* Creates an insert node struct. */ Loading Loading @@ -1562,12 +1567,12 @@ row_ins_scan_sec_index_for_duplicate( trx = thr_get_trx(thr); ut_ad(trx); if (innobase_query_is_replace()) { if (innobase_query_is_update()) { /* The manual defines the REPLACE semantics that it is either an INSERT or DELETE(s) for duplicate key + INSERT. Therefore, we should take X-lock for duplicates */ /* If the SQL-query will update or replace duplicate key we will take X-lock for duplicates ( REPLACE, LOAD DATAFILE REPLACE, INSERT ON DUPLICATE KEY UPDATE). */ err = row_ins_set_exclusive_rec_lock( LOCK_ORDINARY,rec,index,thr); Loading Loading @@ -1675,12 +1680,12 @@ row_ins_duplicate_error_in_clust( sure that in roll-forward we get the same duplicate errors as in original execution */ if (innobase_query_is_replace()) { if (innobase_query_is_update()) { /* The manual defines the REPLACE semantics that it is either an INSERT or DELETE(s) for duplicate key + INSERT. Therefore, we should take X-lock for duplicates */ /* If the SQL-query will update or replace duplicate key we will take X-lock for duplicates ( REPLACE, LOAD DATAFILE REPLACE, INSERT ON DUPLICATE KEY UPDATE). */ err = row_ins_set_exclusive_rec_lock( LOCK_REC_NOT_GAP,rec,cursor->index, Loading Loading @@ -1713,12 +1718,12 @@ row_ins_duplicate_error_in_clust( if (rec != page_get_supremum_rec(page)) { /* The manual defines the REPLACE semantics that it is either an INSERT or DELETE(s) for duplicate key + INSERT. Therefore, we should take X-lock for duplicates. */ if (innobase_query_is_update()) { if (innobase_query_is_replace()) { /* If the SQL-query will update or replace duplicate key we will take X-lock for duplicates ( REPLACE, LOAD DATAFILE REPLACE, INSERT ON DUPLICATE KEY UPDATE). */ err = row_ins_set_exclusive_rec_lock( LOCK_REC_NOT_GAP, Loading mysql-test/r/func_sapdb.result +3 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,7 @@ insert into test values ('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"), ('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'), ('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null), ('2001-01-01 01:01:01', '-01:01:01', '1 01:01:01', '2001-01-01 01:01:01'), ('2001-01-01 01:01:01', null, '-1 01:01:01', null), (null, null, null, null), ('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01'); Loading @@ -194,6 +195,7 @@ ttt qqq 2001-01-01 00:00:00 -25:01:00 1997-12-31 00:00:00 -25:01:00 2001-01-01 02:02:02 -24:00:00 2001-01-01 00:00:00 24:00:00 NULL NULL NULL NULL 2001-01-01 02:02:02 26:02:02 Loading @@ -203,6 +205,7 @@ ttt qqq 26305:01:02 22:58:58 -26305:01:02 -22:58:58 NULL 26:02:02 00:00:00 -26:02:02 NULL NULL NULL NULL 00:00:00 -24:00:00 Loading mysql-test/t/func_sapdb.test +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ insert into test values ('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"), ('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'), ('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null), ('2001-01-01 01:01:01', '-01:01:01', '1 01:01:01', '2001-01-01 01:01:01'), ('2001-01-01 01:01:01', null, '-1 01:01:01', null), (null, null, null, null), ('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01'); Loading ndb/test/ndbapi/Makefile.am +2 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,8 @@ test_event_SOURCES = test_event.cpp ndbapi_slow_select_SOURCES = slow_select.cpp testReadPerf_SOURCES = testReadPerf.cpp testLcp_SOURCES = testLcp.cpp DbCreate_SOURCES= bench/mainPopulate.cpp bench/dbPopulate.cpp bench/userInterface.cpp DbAsyncGenerator_SOURCES= bench/mainAsyncGenerator.cpp bench/asyncGenerator.cpp bench/ndb_async2.cpp DbCreate_SOURCES= bench/mainPopulate.cpp bench/dbPopulate.cpp bench/userInterface.cpp bench/dbPopulate.h bench/userInterface.h bench/testData.h bench/testDefinitions.h bench/ndb_schema.hpp bench/ndb_error.hpp DbAsyncGenerator_SOURCES= bench/mainAsyncGenerator.cpp bench/asyncGenerator.cpp bench/ndb_async2.cpp bench/dbGenerator.h bench/macros.h bench/userInterface.h bench/testData.h bench/testDefinitions.h bench/ndb_schema.hpp bench/ndb_error.hpp INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel Loading sql/ha_innodb.cc +17 −6 Original line number Diff line number Diff line Loading @@ -5653,14 +5653,20 @@ innobase_get_at_most_n_mbchars( extern "C" { /********************************************************************** This function returns true if SQL-query in the current thread This function returns true if 1) SQL-query in the current thread is either REPLACE or LOAD DATA INFILE REPLACE. 2) SQL-query in the current thread is INSERT ON DUPLICATE KEY UPDATE. NOTE that /mysql/innobase/row/row0ins.c must contain the prototype for this function ! */ ibool innobase_query_is_replace(void) /*===========================*/ innobase_query_is_update(void) /*==========================*/ { THD* thd; Loading @@ -5670,10 +5676,15 @@ innobase_query_is_replace(void) thd->lex->sql_command == SQLCOM_REPLACE_SELECT || ( thd->lex->sql_command == SQLCOM_LOAD && thd->lex->duplicates == DUP_REPLACE )) { return true; } else { return false; return(1); } if ( thd->lex->sql_command == SQLCOM_INSERT && thd->lex->duplicates == DUP_UPDATE ) { return(1); } return(0); } } Loading Loading
innobase/row/row0ins.c +23 −18 Original line number Diff line number Diff line Loading @@ -51,14 +51,19 @@ innobase_invalidate_query_cache( chars count */ /********************************************************************** This function returns true if SQL-query in the current thread This function returns true if 1) SQL-query in the current thread is either REPLACE or LOAD DATA INFILE REPLACE. 2) SQL-query in the current thread is INSERT ON DUPLICATE KEY UPDATE. NOTE that /mysql/innobase/row/row0ins.c must contain the prototype for this function ! */ ibool innobase_query_is_replace(void); /*===========================*/ innobase_query_is_update(void); /************************************************************************* Creates an insert node struct. */ Loading Loading @@ -1562,12 +1567,12 @@ row_ins_scan_sec_index_for_duplicate( trx = thr_get_trx(thr); ut_ad(trx); if (innobase_query_is_replace()) { if (innobase_query_is_update()) { /* The manual defines the REPLACE semantics that it is either an INSERT or DELETE(s) for duplicate key + INSERT. Therefore, we should take X-lock for duplicates */ /* If the SQL-query will update or replace duplicate key we will take X-lock for duplicates ( REPLACE, LOAD DATAFILE REPLACE, INSERT ON DUPLICATE KEY UPDATE). */ err = row_ins_set_exclusive_rec_lock( LOCK_ORDINARY,rec,index,thr); Loading Loading @@ -1675,12 +1680,12 @@ row_ins_duplicate_error_in_clust( sure that in roll-forward we get the same duplicate errors as in original execution */ if (innobase_query_is_replace()) { if (innobase_query_is_update()) { /* The manual defines the REPLACE semantics that it is either an INSERT or DELETE(s) for duplicate key + INSERT. Therefore, we should take X-lock for duplicates */ /* If the SQL-query will update or replace duplicate key we will take X-lock for duplicates ( REPLACE, LOAD DATAFILE REPLACE, INSERT ON DUPLICATE KEY UPDATE). */ err = row_ins_set_exclusive_rec_lock( LOCK_REC_NOT_GAP,rec,cursor->index, Loading Loading @@ -1713,12 +1718,12 @@ row_ins_duplicate_error_in_clust( if (rec != page_get_supremum_rec(page)) { /* The manual defines the REPLACE semantics that it is either an INSERT or DELETE(s) for duplicate key + INSERT. Therefore, we should take X-lock for duplicates. */ if (innobase_query_is_update()) { if (innobase_query_is_replace()) { /* If the SQL-query will update or replace duplicate key we will take X-lock for duplicates ( REPLACE, LOAD DATAFILE REPLACE, INSERT ON DUPLICATE KEY UPDATE). */ err = row_ins_set_exclusive_rec_lock( LOCK_REC_NOT_GAP, Loading
mysql-test/r/func_sapdb.result +3 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,7 @@ insert into test values ('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"), ('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'), ('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null), ('2001-01-01 01:01:01', '-01:01:01', '1 01:01:01', '2001-01-01 01:01:01'), ('2001-01-01 01:01:01', null, '-1 01:01:01', null), (null, null, null, null), ('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01'); Loading @@ -194,6 +195,7 @@ ttt qqq 2001-01-01 00:00:00 -25:01:00 1997-12-31 00:00:00 -25:01:00 2001-01-01 02:02:02 -24:00:00 2001-01-01 00:00:00 24:00:00 NULL NULL NULL NULL 2001-01-01 02:02:02 26:02:02 Loading @@ -203,6 +205,7 @@ ttt qqq 26305:01:02 22:58:58 -26305:01:02 -22:58:58 NULL 26:02:02 00:00:00 -26:02:02 NULL NULL NULL NULL 00:00:00 -24:00:00 Loading
mysql-test/t/func_sapdb.test +1 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,7 @@ insert into test values ('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"), ('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'), ('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null), ('2001-01-01 01:01:01', '-01:01:01', '1 01:01:01', '2001-01-01 01:01:01'), ('2001-01-01 01:01:01', null, '-1 01:01:01', null), (null, null, null, null), ('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01'); Loading
ndb/test/ndbapi/Makefile.am +2 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,8 @@ test_event_SOURCES = test_event.cpp ndbapi_slow_select_SOURCES = slow_select.cpp testReadPerf_SOURCES = testReadPerf.cpp testLcp_SOURCES = testLcp.cpp DbCreate_SOURCES= bench/mainPopulate.cpp bench/dbPopulate.cpp bench/userInterface.cpp DbAsyncGenerator_SOURCES= bench/mainAsyncGenerator.cpp bench/asyncGenerator.cpp bench/ndb_async2.cpp DbCreate_SOURCES= bench/mainPopulate.cpp bench/dbPopulate.cpp bench/userInterface.cpp bench/dbPopulate.h bench/userInterface.h bench/testData.h bench/testDefinitions.h bench/ndb_schema.hpp bench/ndb_error.hpp DbAsyncGenerator_SOURCES= bench/mainAsyncGenerator.cpp bench/asyncGenerator.cpp bench/ndb_async2.cpp bench/dbGenerator.h bench/macros.h bench/userInterface.h bench/testData.h bench/testDefinitions.h bench/ndb_schema.hpp bench/ndb_error.hpp INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel Loading
sql/ha_innodb.cc +17 −6 Original line number Diff line number Diff line Loading @@ -5653,14 +5653,20 @@ innobase_get_at_most_n_mbchars( extern "C" { /********************************************************************** This function returns true if SQL-query in the current thread This function returns true if 1) SQL-query in the current thread is either REPLACE or LOAD DATA INFILE REPLACE. 2) SQL-query in the current thread is INSERT ON DUPLICATE KEY UPDATE. NOTE that /mysql/innobase/row/row0ins.c must contain the prototype for this function ! */ ibool innobase_query_is_replace(void) /*===========================*/ innobase_query_is_update(void) /*==========================*/ { THD* thd; Loading @@ -5670,10 +5676,15 @@ innobase_query_is_replace(void) thd->lex->sql_command == SQLCOM_REPLACE_SELECT || ( thd->lex->sql_command == SQLCOM_LOAD && thd->lex->duplicates == DUP_REPLACE )) { return true; } else { return false; return(1); } if ( thd->lex->sql_command == SQLCOM_INSERT && thd->lex->duplicates == DUP_UPDATE ) { return(1); } return(0); } } Loading