3396 Ole John Aske 2011-10-21
Introduced 'read before write removal' into new MRR implementation.
Code is taken from old MRR (deprecated) and addapted to the new interface
and datastructures.
modified:
sql/ha_ndbcluster.cc
3395 jonas oreland 2011-10-19
record rpl_ndb_extra_col_slave rpl_extra/rpl_extra_col_slave has added new suppression (wo/ using disable query log)
modified:
mysql-test/suite/rpl_ndb/r/rpl_ndb_extra_col_slave.result
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-10-18 10:43:35 +0000
+++ b/sql/ha_ndbcluster.cc 2011-10-21 12:52:20 +0000
@@ -14980,6 +14980,10 @@ int ha_ndbcluster::multi_range_start_ret
int range_no= 0;
int mrr_range_no= starting_range;
+ bool any_real_read= FALSE;
+
+ if (m_read_before_write_removal_possible)
+ check_read_before_write_removal();
for (;
!m_range_res;
@@ -15024,7 +15028,7 @@ int ha_ndbcluster::multi_range_start_ret
if (part_spec.start_part > part_spec.end_part)
{
/*
- We can skip this partition since the key won't fit into any
+ We can skip this range since the key won't fit into any
partition
*/
multi_range_entry_type(row_buf)= enum_skip_range;
@@ -15061,6 +15065,9 @@ int ha_ndbcluster::multi_range_start_ret
DBUG_RETURN(error);
}
+ any_real_read= TRUE;
+ DBUG_PRINT("info", ("any_real_read= TRUE"));
+
/* Create the scan operation for the first scan range. */
if (!m_multi_cursor)
{
@@ -15153,6 +15160,8 @@ int ha_ndbcluster::multi_range_start_ret
}
else
{
+ multi_range_entry_type(row_buf)= enum_unique_range;
+
if (!trans)
{
DBUG_ASSERT(active_index != MAX_KEY);
@@ -15161,24 +15170,43 @@ int ha_ndbcluster::multi_range_start_ret
error))))
DBUG_RETURN(error);
}
- /* Convert to primary/unique key operation. */
- Uint32 partitionId;
- Uint32* ppartitionId = NULL;
- if (m_user_defined_partitioning &&
- (cur_index_type == PRIMARY_KEY_ORDERED_INDEX ||
- cur_index_type == PRIMARY_KEY_INDEX))
+ if (m_read_before_write_removal_used)
{
- partitionId=part_spec.start_part;
- ppartitionId=&partitionId;
+ DBUG_PRINT("info", ("m_read_before_write_removal_used == TRUE"));
+
+ /* Key will later be returned as result record.
+ * Save it in 'row_buf' from where it will later retrieved.
+ */
+ key_restore(multi_range_row(row_buf),
+ (uchar*)mrr_cur_range.start_key.key,
+ key_info, key_info->key_length);
+
+ op= NULL; // read_before_write_removal
}
+ else
+ {
+ any_real_read= TRUE;
+ DBUG_PRINT("info", ("any_real_read= TRUE"));
- multi_range_entry_type(row_buf)= enum_unique_range;
- if (!(op= pk_unique_index_read_key(active_index,
- mrr_cur_range.start_key.key,
- multi_range_row(row_buf), lm,
- ppartitionId)))
- ERR_RETURN(trans->getNdbError());
+ /* Convert to primary/unique key operation. */
+ Uint32 partitionId;
+ Uint32* ppartitionId = NULL;
+
+ if (m_user_defined_partitioning &&
+ (cur_index_type == PRIMARY_KEY_ORDERED_INDEX ||
+ cur_index_type == PRIMARY_KEY_INDEX))
+ {
+ partitionId=part_spec.start_part;
+ ppartitionId=&partitionId;
+ }
+
+ if (!(op= pk_unique_index_read_key(active_index,
+ mrr_cur_range.start_key.key,
+ multi_range_row(row_buf), lm,
+ ppartitionId)))
+ ERR_RETURN(trans->getNdbError());
+ }
oplist[num_keyops++]= op;
row_buf= multi_range_next_entry(row_buf, reclength);
}
@@ -15196,7 +15224,7 @@ int ha_ndbcluster::multi_range_start_ret
}
}
- if (execute_no_commit_ie(m_thd_ndb, trans))
+ if (any_real_read && execute_no_commit_ie(m_thd_ndb, trans))
ERR_RETURN(trans->getNdbError());
if (!m_range_res)
@@ -15240,7 +15268,10 @@ int ha_ndbcluster::multi_range_start_ret
continue;
DBUG_ASSERT(op_idx < MRR_MAX_RANGES);
- const NdbError &error= oplist[op_idx]->getNdbError();
+ if ((op= oplist[op_idx++]) == NULL)
+ continue; // read_before_write_removal
+
+ const NdbError &error= op->getNdbError();
if (error.code != 0)
{
if (error.classification == NdbError::NoDataFound)
@@ -15260,7 +15291,6 @@ int ha_ndbcluster::multi_range_start_ret
ERR_RETURN(error); /* purecov: deadcode */
}
}
- op_idx++;
}
DBUG_RETURN(0);
@@ -15278,7 +15308,6 @@ int ha_ndbcluster::multi_range_read_next
for(;;)
{
-
/* for each range (we should have remembered the number) */
while (first_running_range < first_unstarted_range)
{
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-cluster branch (ole.john.aske:3395 to 3396) | Ole John Aske | 24 Oct |