Commit dfa485b4 authored by unknown's avatar unknown
Browse files

InnoDB: Replace the redo log entry type

MLOG_COMP_REC_SEC_DELETE_MARK with MLOG_REC_SEC_DELETE_MARK
in order to reduce the space occupied by the redo log.


innobase/btr/btr0cur.c:
  Replace MLOG_COMP_REC_SEC_DELETE_MARK with MLOG_REC_SEC_DELETE_MARK
  and eliminate redundant dict_index_t* parameters.
innobase/ibuf/ibuf0ibuf.c:
  Remove unnecessary parameter to btr_cur_del_unmark_for_ibuf()
innobase/include/btr0cur.h:
  Remove unnecessary dict_index_t* parameters
innobase/include/mtr0mtr.h:
  Note that MLOG_COMP_REC_SEC_DELETE_MARK is obsolete
innobase/log/log0recv.c:
  recv_parse_or_apply_log_rec_body():
  Ignore the index information in MLOG_COMP_REC_SEC_DELETE_MARK.
  Add assertions about page_is_comp().
parent 44bab0ea
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -2189,17 +2189,13 @@ void
btr_cur_del_mark_set_sec_rec_log(
/*=============================*/
	rec_t*		rec,	/* in: record */
	dict_index_t*	index,	/* in: record descriptor */
	ibool		val,	/* in: value to set */
	mtr_t*		mtr)	/* in: mtr */
{
	byte*	log_ptr;
	ut_ad(val <= 1);

	log_ptr = mlog_open_and_write_index(mtr, rec, index, index->table->comp
			? MLOG_COMP_REC_SEC_DELETE_MARK
			: MLOG_REC_SEC_DELETE_MARK,
			1 + 2);
	log_ptr = mlog_open(mtr, 11 + 1 + 2);

	if (!log_ptr) {
		/* Logging in mtr is switched off during crash recovery:
@@ -2207,10 +2203,12 @@ btr_cur_del_mark_set_sec_rec_log(
		return;
	}

	log_ptr = mlog_write_initial_log_record_fast(
			rec, MLOG_REC_SEC_DELETE_MARK, log_ptr, mtr);
	mach_write_to_1(log_ptr, val);
	log_ptr++;

	mach_write_to_2(log_ptr, rec - buf_frame_align(rec));
	mach_write_to_2(log_ptr, ut_align_offset(rec, UNIV_PAGE_SIZE));
	log_ptr += 2;

	mlog_close(mtr, log_ptr);
@@ -2226,7 +2224,6 @@ btr_cur_parse_del_mark_set_sec_rec(
				/* out: end of log record or NULL */
	byte*		ptr,	/* in: buffer */
	byte*		end_ptr,/* in: buffer end */
	dict_index_t*	index,	/* in: record descriptor */
	page_t*		page)	/* in: page or NULL */
{
	ibool	val;
@@ -2253,7 +2250,7 @@ btr_cur_parse_del_mark_set_sec_rec(
		is only being recovered, and there cannot be a hash index to
		it. */

		rec_set_deleted_flag(rec, index->table->comp, val);
		rec_set_deleted_flag(rec, page_is_comp(page), val);
	}
	
	return(ptr);
@@ -2293,18 +2290,21 @@ btr_cur_del_mark_set_sec_rec(
	}

	block = buf_block_align(rec);
	ut_ad(!!page_is_comp(buf_block_get_frame(block))
			== cursor->index->table->comp);
	
	if (block->is_hashed) {
		rw_lock_x_lock(&btr_search_latch);
	}

	rec_set_deleted_flag(rec, cursor->index->table->comp, val);
	rec_set_deleted_flag(rec, page_is_comp(buf_block_get_frame(block)),
									val);

	if (block->is_hashed) {
		rw_lock_x_unlock(&btr_search_latch);
	}

	btr_cur_del_mark_set_sec_rec_log(rec, cursor->index, val, mtr);
	btr_cur_del_mark_set_sec_rec_log(rec, val, mtr);

	return(DB_SUCCESS);
}
@@ -2317,15 +2317,14 @@ void
btr_cur_del_unmark_for_ibuf(
/*========================*/
	rec_t*		rec,	/* in: record to delete unmark */
	dict_index_t*	index,	/* in: record descriptor */
	mtr_t*		mtr)	/* in: mtr */
{
	/* We do not need to reserve btr_search_latch, as the page has just
	been read to the buffer pool and there cannot be a hash index to it. */

	rec_set_deleted_flag(rec, index->table->comp, FALSE);
	rec_set_deleted_flag(rec, page_is_comp(buf_frame_align(rec)), FALSE);

	btr_cur_del_mark_set_sec_rec_log(rec, index, FALSE, mtr);
	btr_cur_del_mark_set_sec_rec_log(rec, FALSE, mtr);
}

/*==================== B-TREE RECORD REMOVE =========================*/
+1 −1
Original line number Diff line number Diff line
@@ -2848,7 +2848,7 @@ ibuf_insert_to_index_page(
	if (low_match == dtuple_get_n_fields(entry)) {
		rec = page_cur_get_rec(&page_cur);
		
		btr_cur_del_unmark_for_ibuf(rec, index, mtr);
		btr_cur_del_unmark_for_ibuf(rec, mtr);
	} else {
		rec = page_cur_tuple_insert(&page_cur, entry, index, mtr);
		
+0 −2
Original line number Diff line number Diff line
@@ -284,7 +284,6 @@ void
btr_cur_del_unmark_for_ibuf(
/*========================*/
	rec_t*		rec,	/* in: record to delete unmark */
	dict_index_t*	index,	/* in: record descriptor */
	mtr_t*		mtr);	/* in: mtr */
/*****************************************************************
Tries to compress a page of the tree on the leaf level. It is assumed
@@ -389,7 +388,6 @@ btr_cur_parse_del_mark_set_sec_rec(
				/* out: end of log record or NULL */
	byte*		ptr,	/* in: buffer */
	byte*		end_ptr,/* in: buffer end */
	dict_index_t*	index,	/* in: index corresponding to page */
	page_t*		page);	/* in: page or NULL */
/***********************************************************************
Estimates the number of rows in a given index range. */
+5 −1
Original line number Diff line number Diff line
@@ -112,7 +112,11 @@ flag value must give the length also! */
						/* mark compact clustered index
						record deleted */
#define MLOG_COMP_REC_SEC_DELETE_MARK ((byte)40)/* mark compact secondary index
						record deleted */
						record deleted; this log
						record type is redundant, as
						MLOG_REC_SEC_DELETE_MARK is
						independent of the record
						format. */
#define MLOG_COMP_REC_UPDATE_IN_PLACE ((byte)41)/* update of a compact record,
						preserves record field sizes */
#define MLOG_COMP_REC_DELETE	((byte)42)	/* delete a compact record
+17 −5
Original line number Diff line number Diff line
@@ -765,6 +765,7 @@ recv_parse_or_apply_log_rec_body(
	case MLOG_REC_INSERT: case MLOG_COMP_REC_INSERT:
		if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
				type == MLOG_COMP_REC_INSERT, &index))) {
			ut_a(!page||!!page_is_comp(page)==index->table->comp);
			ptr = page_cur_parse_insert_rec(FALSE, ptr, end_ptr,
							index, page, mtr);
		}
@@ -772,20 +773,27 @@ recv_parse_or_apply_log_rec_body(
	case MLOG_REC_CLUST_DELETE_MARK: case MLOG_COMP_REC_CLUST_DELETE_MARK:
		if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
			type == MLOG_COMP_REC_CLUST_DELETE_MARK, &index))) {
			ut_a(!page||!!page_is_comp(page)==index->table->comp);
			ptr = btr_cur_parse_del_mark_set_clust_rec(ptr,
						end_ptr, index, page);
		}
		break;
	case MLOG_REC_SEC_DELETE_MARK: case MLOG_COMP_REC_SEC_DELETE_MARK:
		if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
			type == MLOG_COMP_REC_SEC_DELETE_MARK, &index))) {
			ptr = btr_cur_parse_del_mark_set_sec_rec(ptr, end_ptr,
								index, page);
	case MLOG_COMP_REC_SEC_DELETE_MARK:
		/* This log record type is obsolete, but we process it for
		backward compatibility with MySQL 5.0.3 and 5.0.4. */
		ut_a(!page || page_is_comp(page));
		ptr = mlog_parse_index(ptr, end_ptr, TRUE, &index);
		if (!ptr) {
			break;
		}
		/* Fall through */
	case MLOG_REC_SEC_DELETE_MARK:
		ptr = btr_cur_parse_del_mark_set_sec_rec(ptr, end_ptr, page);
		break;
	case MLOG_REC_UPDATE_IN_PLACE: case MLOG_COMP_REC_UPDATE_IN_PLACE:
		if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
			type == MLOG_COMP_REC_UPDATE_IN_PLACE, &index))) {
			ut_a(!page||!!page_is_comp(page)==index->table->comp);
			ptr = btr_cur_parse_update_in_place(ptr, end_ptr,
							page, index);
		}
@@ -795,6 +803,7 @@ recv_parse_or_apply_log_rec_body(
		if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
			type == MLOG_COMP_LIST_END_DELETE
			|| type == MLOG_COMP_LIST_START_DELETE, &index))) {
			ut_a(!page||!!page_is_comp(page)==index->table->comp);
			ptr = page_parse_delete_rec_list(type, ptr, end_ptr,
							index, page, mtr);
		}
@@ -802,6 +811,7 @@ recv_parse_or_apply_log_rec_body(
	case MLOG_LIST_END_COPY_CREATED: case MLOG_COMP_LIST_END_COPY_CREATED:
		if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
			type == MLOG_COMP_LIST_END_COPY_CREATED, &index))) {
			ut_a(!page||!!page_is_comp(page)==index->table->comp);
			ptr = page_parse_copy_rec_list_to_created_page(ptr,
						end_ptr, index, page, mtr);
		}
@@ -809,6 +819,7 @@ recv_parse_or_apply_log_rec_body(
	case MLOG_PAGE_REORGANIZE: case MLOG_COMP_PAGE_REORGANIZE:
		if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
				type == MLOG_COMP_PAGE_REORGANIZE, &index))) {
			ut_a(!page||!!page_is_comp(page)==index->table->comp);
			ptr = btr_parse_page_reorganize(ptr, end_ptr, index,
								page, mtr);
		}
@@ -841,6 +852,7 @@ recv_parse_or_apply_log_rec_body(
	case MLOG_REC_DELETE: case MLOG_COMP_REC_DELETE:
		if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
				type == MLOG_COMP_REC_DELETE, &index))) {
			ut_a(!page||!!page_is_comp(page)==index->table->comp);
			ptr = page_cur_parse_delete_rec(ptr, end_ptr,
							index, page, mtr);
		}