Commit 8e59e994 authored by marko's avatar marko

branches/zip: Minor cleanup in update related code.

btr_push_update_extern_fields(): Instead of iterating all upd_get_n_fields(),
stop at the first match.

row_search_index_entry(): Simplify the return statements.

row_upd_sec_step(): Eliminate the local variable "err".

row_upd_clust_step(): Add a UNIV_UNLIKELY hint.
parent e4690b1d
...@@ -3499,9 +3499,7 @@ btr_push_update_extern_fields( ...@@ -3499,9 +3499,7 @@ btr_push_update_extern_fields(
upd_t* update) /* in: update vector or NULL */ upd_t* update) /* in: update vector or NULL */
{ {
ulint n_pushed = 0; ulint n_pushed = 0;
ibool is_updated;
ulint n; ulint n;
ulint j;
ulint i; ulint i;
if (update) { if (update) {
...@@ -3525,22 +3523,23 @@ btr_push_update_extern_fields( ...@@ -3525,22 +3523,23 @@ btr_push_update_extern_fields(
if (rec_offs_nth_extern(offsets, i)) { if (rec_offs_nth_extern(offsets, i)) {
/* Check it is not in updated fields */ /* Check it is not in updated fields */
is_updated = FALSE;
if (update) { if (update) {
ulint j;
for (j = 0; j < upd_get_n_fields(update); for (j = 0; j < upd_get_n_fields(update);
j++) { j++) {
if (upd_get_nth_field(update, j) if (upd_get_nth_field(update, j)
->field_no == i) { ->field_no == i) {
is_updated = TRUE; goto is_updated;
} }
} }
} }
if (!is_updated) { ext_vect[n_pushed] = i;
ext_vect[n_pushed] = i; n_pushed++;
n_pushed++; is_updated:
} ;
} }
} }
......
...@@ -674,16 +674,5 @@ row_search_index_entry( ...@@ -674,16 +674,5 @@ row_search_index_entry(
n_fields = dtuple_get_n_fields(entry); n_fields = dtuple_get_n_fields(entry);
if (page_rec_is_infimum(rec)) { return(!page_rec_is_infimum(rec) && low_match == n_fields);
return(FALSE);
}
if (low_match != n_fields) {
/* Not found */
return(FALSE);
}
return(TRUE);
} }
...@@ -1398,8 +1398,6 @@ row_upd_sec_step( ...@@ -1398,8 +1398,6 @@ row_upd_sec_step(
upd_node_t* node, /* in: row update node */ upd_node_t* node, /* in: row update node */
que_thr_t* thr) /* in: query thread */ que_thr_t* thr) /* in: query thread */
{ {
ulint err;
ut_ad((node->state == UPD_NODE_UPDATE_ALL_SEC) ut_ad((node->state == UPD_NODE_UPDATE_ALL_SEC)
|| (node->state == UPD_NODE_UPDATE_SOME_SEC)); || (node->state == UPD_NODE_UPDATE_SOME_SEC));
ut_ad(!dict_index_is_clust(node->index)); ut_ad(!dict_index_is_clust(node->index));
...@@ -1407,9 +1405,7 @@ row_upd_sec_step( ...@@ -1407,9 +1405,7 @@ row_upd_sec_step(
if (node->state == UPD_NODE_UPDATE_ALL_SEC if (node->state == UPD_NODE_UPDATE_ALL_SEC
|| row_upd_changes_ord_field_binary(node->row, node->index, || row_upd_changes_ord_field_binary(node->row, node->index,
node->update)) { node->update)) {
err = row_upd_sec_index_entry(node, thr); return(row_upd_sec_index_entry(node, thr));
return(err);
} }
return(DB_SUCCESS); return(DB_SUCCESS);
...@@ -1793,7 +1789,7 @@ exit_func: ...@@ -1793,7 +1789,7 @@ exit_func:
/* If the update is made for MySQL, we already have the update vector /* If the update is made for MySQL, we already have the update vector
ready, else we have to do some evaluation: */ ready, else we have to do some evaluation: */
if (!node->in_mysql_interface) { if (UNIV_UNLIKELY(!node->in_mysql_interface)) {
/* Copy the necessary columns from clust_rec and calculate the /* Copy the necessary columns from clust_rec and calculate the
new values to set */ new values to set */
row_upd_copy_columns(rec, offsets, row_upd_copy_columns(rec, offsets,
......
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