Commit 5dce2df4 authored by Marko Mäkelä's avatar Marko Mäkelä

Non-functional changes (cleanup) made while narrowing down Bug #55284:

row_purge(): Change the return type to void. (The return value always
was DB_SUCCESS.) Remove some local variables.

row_undo_mod_remove_clust_low(): Remove some local variables.

rb://547 approved by Jimmy Yang
parent 03d42acc
...@@ -613,47 +613,32 @@ err_exit: ...@@ -613,47 +613,32 @@ err_exit:
/***********************************************************//** /***********************************************************//**
Fetches an undo log record and does the purge for the recorded operation. Fetches an undo log record and does the purge for the recorded operation.
If none left, or the current purge completed, returns the control to the If none left, or the current purge completed, returns the control to the
parent node, which is always a query thread node. parent node, which is always a query thread node. */
@return DB_SUCCESS if operation successfully completed, else error code */ static __attribute__((nonnull))
static void
ulint
row_purge( row_purge(
/*======*/ /*======*/
purge_node_t* node, /*!< in: row purge node */ purge_node_t* node, /*!< in: row purge node */
que_thr_t* thr) /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
{ {
roll_ptr_t roll_ptr;
ibool purge_needed;
ibool updated_extern; ibool updated_extern;
trx_t* trx;
ut_ad(node && thr);
trx = thr_get_trx(thr); ut_ad(node);
ut_ad(thr);
node->undo_rec = trx_purge_fetch_next_rec(&roll_ptr, node->undo_rec = trx_purge_fetch_next_rec(&node->roll_ptr,
&(node->reservation), &node->reservation,
node->heap); node->heap);
if (!node->undo_rec) { if (!node->undo_rec) {
/* Purge completed for this query thread */ /* Purge completed for this query thread */
thr->run_node = que_node_get_parent(node); thr->run_node = que_node_get_parent(node);
return(DB_SUCCESS); return;
}
node->roll_ptr = roll_ptr;
if (node->undo_rec == &trx_purge_dummy_rec) {
purge_needed = FALSE;
} else {
purge_needed = row_purge_parse_undo_rec(node, &updated_extern,
thr);
/* If purge_needed == TRUE, we must also remember to unfreeze
data dictionary! */
} }
if (purge_needed) { if (node->undo_rec != &trx_purge_dummy_rec
&& row_purge_parse_undo_rec(node, &updated_extern, thr)) {
node->found_clust = FALSE; node->found_clust = FALSE;
node->index = dict_table_get_next_index( node->index = dict_table_get_next_index(
...@@ -672,7 +657,7 @@ row_purge( ...@@ -672,7 +657,7 @@ row_purge(
btr_pcur_close(&(node->pcur)); btr_pcur_close(&(node->pcur));
} }
row_mysql_unfreeze_data_dictionary(trx); row_mysql_unfreeze_data_dictionary(thr_get_trx(thr));
} }
/* Do some cleanup */ /* Do some cleanup */
...@@ -680,8 +665,6 @@ row_purge( ...@@ -680,8 +665,6 @@ row_purge(
mem_heap_empty(node->heap); mem_heap_empty(node->heap);
thr->run_node = node; thr->run_node = node;
return(DB_SUCCESS);
} }
/***********************************************************//** /***********************************************************//**
...@@ -695,9 +678,6 @@ row_purge_step( ...@@ -695,9 +678,6 @@ row_purge_step(
que_thr_t* thr) /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
{ {
purge_node_t* node; purge_node_t* node;
#ifdef UNIV_DEBUG
ulint err;
#endif /* UNIV_DEBUG */
ut_ad(thr); ut_ad(thr);
...@@ -705,12 +685,7 @@ row_purge_step( ...@@ -705,12 +685,7 @@ row_purge_step(
ut_ad(que_node_get_type(node) == QUE_NODE_PURGE); ut_ad(que_node_get_type(node) == QUE_NODE_PURGE);
#ifdef UNIV_DEBUG
err =
#endif /* UNIV_DEBUG */
row_purge(node, thr); row_purge(node, thr);
ut_ad(err == DB_SUCCESS);
return(thr); return(thr);
} }
...@@ -173,40 +173,26 @@ row_undo_mod_remove_clust_low( ...@@ -173,40 +173,26 @@ row_undo_mod_remove_clust_low(
mtr_t* mtr, /*!< in: mtr */ mtr_t* mtr, /*!< in: mtr */
ulint mode) /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */ ulint mode) /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */
{ {
btr_pcur_t* pcur;
btr_cur_t* btr_cur; btr_cur_t* btr_cur;
ulint err; ulint err;
ibool success;
ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC); ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC);
pcur = &(node->pcur);
btr_cur = btr_pcur_get_btr_cur(pcur);
success = btr_pcur_restore_position(mode, pcur, mtr); /* Find out if the record has been purged already
or if we can remove it. */
if (!success) { if (!btr_pcur_restore_position(mode, &node->pcur, mtr)
|| row_vers_must_preserve_del_marked(node->new_trx_id, mtr)) {
return(DB_SUCCESS); return(DB_SUCCESS);
} }
/* Find out if we can remove the whole clustered index record */ btr_cur = btr_pcur_get_btr_cur(&node->pcur);
if (node->rec_type == TRX_UNDO_UPD_DEL_REC
&& !row_vers_must_preserve_del_marked(node->new_trx_id, mtr)) {
/* Ok, we can remove */
} else {
return(DB_SUCCESS);
}
if (mode == BTR_MODIFY_LEAF) { if (mode == BTR_MODIFY_LEAF) {
success = btr_cur_optimistic_delete(btr_cur, mtr); err = btr_cur_optimistic_delete(btr_cur, mtr)
? DB_SUCCESS
if (success) { : DB_FAIL;
err = DB_SUCCESS;
} else {
err = DB_FAIL;
}
} else { } else {
ut_ad(mode == BTR_MODIFY_TREE); ut_ad(mode == BTR_MODIFY_TREE);
......
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