From: Date: February 7 2006 11:47am Subject: bk commit into 5.1 tree (tomas:1.2076) BUG#17154 List-Archive: http://lists.mysql.com/commits/2225 X-Bug: 17154 Message-Id: <20060207104716.A6C3D817AC@poseidon.mysql.com> Below is the list of changes that have just been committed into a local 5.1 repository of tomas. When tomas does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2076 06/02/07 11:47:04 tomas@stripped +4 -0 Bug#17081 LOAD DATA INFILE" may not load all the data Bug #17154 load data infile hangs when duplicate key encountered mysql-test/t/ndb_load.test 1.1 06/02/07 11:46:49 tomas@stripped +24 -0 New BitKeeper file ``mysql-test/t/ndb_load.test'' mysql-test/r/ndb_load.result 1.1 06/02/07 11:46:49 tomas@stripped +80 -0 New BitKeeper file ``mysql-test/r/ndb_load.result'' sql/sql_load.cc 1.91 06/02/07 11:46:49 tomas@stripped +5 -2 Bug#17081 LOAD DATA INFILE" may not load all the data Bug #17154 load data infile hangs when duplicate key encountered mysql-test/t/ndb_load.test 1.0 06/02/07 11:46:49 tomas@stripped +0 -0 BitKeeper file /home/tomas/mysql-5.1-new/mysql-test/t/ndb_load.test mysql-test/r/ndb_load.result 1.0 06/02/07 11:46:49 tomas@stripped +0 -0 BitKeeper file /home/tomas/mysql-5.1-new/mysql-test/r/ndb_load.result sql/ha_ndbcluster.cc 1.261 06/02/07 11:46:48 tomas@stripped +23 -8 Bug#17081 LOAD DATA INFILE" may not load all the data Bug #17154 load data infile hangs when duplicate key encountered # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: tomas # Host: poseidon.ndb.mysql.com # Root: /home/tomas/mysql-5.1-new --- 1.90/sql/sql_load.cc 2005-12-26 10:50:36 +01:00 +++ 1.91/sql/sql_load.cc 2006-02-07 11:46:49 +01:00 @@ -384,8 +384,11 @@ error= read_sep_field(thd, info, table_list, fields_vars, set_fields, set_values, read_info, *enclosed, skip_lines, ignore); - if (table->file->end_bulk_insert()) - error=1; /* purecov: inspected */ + if (table->file->end_bulk_insert() && !error) + { + table->file->print_error(my_errno, MYF(0)); + error= 1; + } table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->next_number_field=0; } --- 1.260/sql/ha_ndbcluster.cc 2006-02-06 21:30:33 +01:00 +++ 1.261/sql/ha_ndbcluster.cc 2006-02-07 11:46:48 +01:00 @@ -3446,9 +3446,26 @@ "rows_inserted:%d, bulk_insert_rows: %d", (int) m_rows_inserted, (int) m_bulk_insert_rows)); m_bulk_insert_not_flushed= FALSE; - if (execute_no_commit(this,trans) != 0) { - no_uncommitted_rows_execute_failure(); - my_errno= error= ndb_err(trans); + if (m_transaction_on) + { + if (execute_no_commit(this, trans) != 0) + { + no_uncommitted_rows_execute_failure(); + my_errno= error= ndb_err(trans); + } + } + else + { + if (execute_commit(this, trans) != 0) + { + no_uncommitted_rows_execute_failure(); + my_errno= error= ndb_err(trans); + } + else + { + int res= trans->restart(); + DBUG_ASSERT(res == 0); + } } } @@ -3605,8 +3622,7 @@ ERR_RETURN(ndb->getNdbError()); no_uncommitted_rows_reset(thd); thd_ndb->stmt= trans; - if (m_transaction_on) - trans_register_ha(thd, FALSE, &ndbcluster_hton); + trans_register_ha(thd, FALSE, &ndbcluster_hton); } else { @@ -3621,8 +3637,7 @@ ERR_RETURN(ndb->getNdbError()); no_uncommitted_rows_reset(thd); thd_ndb->all= trans; - if (m_transaction_on) - trans_register_ha(thd, TRUE, &ndbcluster_hton); + trans_register_ha(thd, TRUE, &ndbcluster_hton); /* If this is the start of a LOCK TABLE, a table look @@ -6194,7 +6209,7 @@ } bool ha_ndbcluster::has_transactions() { - return m_transaction_on; + return TRUE; } const char* ha_ndbcluster::index_type(uint key_number) { --- New file --- +++ mysql-test/r/ndb_load.result 06/02/07 11:46:49 DROP TABLE IF EXISTS t1; CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ; ERROR 23000: Can't write; duplicate key in table 't1' DROP TABLE t1; CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ; SELECT * FROM t1 ORDER BY word; word Aarhus Aarhus Aaron Aaron Ababa Ababa aback aback abaft abaft abandon abandon abandoned abandoned abandoning abandoning abandonment abandonment abandons abandons abase abased abasement abasements abases abash abashed abashes abashing abasing abate abated abatement abatements abater abates abating Abba abbe abbey abbeys abbot abbots Abbott abbreviate abbreviated abbreviates abbreviating abbreviation abbreviations Abby abdomen abdomens abdominal abduct abducted abduction abductions abductor abductors abducts Abe abed Abel Abelian Abelson Aberdeen Abernathy aberrant aberration DROP TABLE t1; --- New file --- +++ mysql-test/t/ndb_load.test 06/02/07 11:46:49 -- source include/have_ndb.inc -- source include/not_embedded.inc --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings # # Basic test for different types of loading data # # should give duplicate key CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB; --error 1022 LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ; DROP TABLE t1; # now without a primary key we should be ok CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ; SELECT * FROM t1 ORDER BY word; DROP TABLE t1; # End of 4.1 tests