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@stripped, 2007-10-26 11:54:58+02:00, tomas@stripped +3 -0
WL#2680 NDB: Support for batched UPDATE
sql/ha_ndbcluster.cc@stripped, 2007-10-26 11:54:55+02:00, tomas@stripped +43
-2
WL#2680 NDB: Support for batched UPDATE
sql/ha_ndbcluster.h@stripped, 2007-10-26 11:54:55+02:00, tomas@stripped +8
-0
WL#2680 NDB: Support for batched UPDATE
sql/sql_update.cc@stripped, 2007-10-26 11:54:55+02:00, tomas@stripped +1 -1
WL#2680 NDB: Support for batched UPDATE
diff -Nrup a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
--- a/sql/ha_ndbcluster.cc 2007-10-25 18:39:42 +02:00
+++ b/sql/ha_ndbcluster.cc 2007-10-26 11:54:55 +02:00
@@ -3973,8 +3973,48 @@ ha_ndbcluster::update_row_conflict_fn(en
Update one record in NDB using primary key
*/
+bool ha_ndbcluster::start_bulk_update()
+{
+ DBUG_ENTER("ha_ndbcluster::start_bulk_update");
+ DBUG_RETURN(FALSE);
+}
+
+int ha_ndbcluster::bulk_update_row(const uchar *old_data, uchar *new_data,
+ uint *dup_key_found)
+{
+ DBUG_ENTER("ha_ndbcluster::bulk_update_row");
+ *dup_key_found= 0;
+ DBUG_RETURN(ndb_update_row(old_data, new_data, 1));
+}
+
+int ha_ndbcluster::exec_bulk_update(uint *dup_key_found)
+{
+ DBUG_ENTER("ha_ndbcluster::exec_bulk_update");
+ *dup_key_found= 0;
+ if (m_thd_ndb->m_unsent_bytes &&
+ execute_no_commit(m_thd_ndb, m_thd_ndb->trans,
+ FALSE, m_ignore_no_key) != 0)
+ {
+ no_uncommitted_rows_execute_failure();
+ DBUG_RETURN(ndb_err(m_thd_ndb->trans));
+ }
+ DBUG_RETURN(0);
+}
+
+void ha_ndbcluster::end_bulk_update()
+{
+ DBUG_ENTER("ha_ndbcluster::end_bulk_update");
+ DBUG_VOID_RETURN;
+}
+
int ha_ndbcluster::update_row(const uchar *old_data, uchar *new_data)
{
+ return ndb_update_row(old_data, new_data, 0);
+}
+
+int ha_ndbcluster::ndb_update_row(const uchar *old_data, uchar *new_data,
+ int is_bulk_update)
+{
THD *thd= table->in_use;
Thd_ndb *thd_ndb= m_thd_ndb;
NdbTransaction *trans= thd_ndb->trans;
@@ -3987,7 +4027,8 @@ int ha_ndbcluster::update_row(const ucha
bool pk_update= (have_pk &&
bitmap_is_overlapping(table->write_set, &m_pk_bitmap)
&&
primary_key_cmp(old_data, new_data));
- DBUG_ENTER("update_row");
+ bool batch_allowed= is_bulk_update || (thd->options & OPTION_ALLOW_BATCH);
+ DBUG_ENTER("ndb_update_row");
DBUG_ASSERT(trans);
/*
* If IGNORE the ignore constraint violations on primary and unique keys,
@@ -4099,7 +4140,7 @@ int ha_ndbcluster::update_row(const ucha
*/
DBUG_ASSERT(!pk_update);
if (!m_update_cannot_batch &&
- (cursor || ((thd->options & OPTION_ALLOW_BATCH) && have_pk)))
+ (cursor || (batch_allowed && have_pk)))
{
/* For a scan, we only need to execute() if the batch buffer is full. */
row= batch_copy_row_to_buffer(thd_ndb, new_data, need_execute);
diff -Nrup a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
--- a/sql/ha_ndbcluster.h 2007-10-25 18:39:42 +02:00
+++ b/sql/ha_ndbcluster.h 2007-10-26 11:54:55 +02:00
@@ -410,6 +410,14 @@ class ha_ndbcluster: public handler
void start_bulk_insert(ha_rows rows);
int end_bulk_insert();
+ bool start_bulk_update();
+ int bulk_update_row(const uchar *old_data, uchar *new_data,
+ uint *dup_key_found);
+ int exec_bulk_update(uint *dup_key_found);
+ void end_bulk_update();
+ int ndb_update_row(const uchar *old_data, uchar *new_data,
+ int is_bulk_update);
+
static Thd_ndb* seize_thd_ndb();
static void release_thd_ndb(Thd_ndb* thd_ndb);
diff -Nrup a/sql/sql_update.cc b/sql/sql_update.cc
--- a/sql/sql_update.cc 2007-10-23 17:04:29 +02:00
+++ b/sql/sql_update.cc 2007-10-26 11:54:55 +02:00
@@ -700,7 +700,7 @@ int mysql_update(THD *thd,
*/
if (will_batch &&
((error= table->file->exec_bulk_update(&dup_key_found)) ||
- !dup_key_found))
+ dup_key_found))
{
if (error)
{
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.2679) | tomas | 26 Oct |