Commit 16ecc675 authored by unknown's avatar unknown
Browse files

InnoDB: Write status bits to MLOG_COMP_REC_INSERT entries.

It is not safe to infer the status bits from the B-tree page
level, because after MLOG_COMP_LIST_END_COPY_CREATED, the
level will not be initialized before the records have been inserted.
(Bug #7973)


innobase/btr/btr0cur.c:
  Add parameter "offsets" to page_cur_insert_rec_low()
innobase/include/page0cur.h:
  page_cur_rec_insert(), page_cur_insert_rec_low(): Add param "offsets"
innobase/include/page0cur.ic:
  page_cur_rec_insert(), page_cur_insert_rec_low(): Add param "offsets"
innobase/include/rem0rec.h:
  Add rec_get_info_and_status_bits() and rec_set_info_and_status_bits()
innobase/include/rem0rec.ic:
  Add rec_get_info_and_status_bits() and rec_set_info_and_status_bits()
innobase/page/page0cur.c:
  page_cur_insert_rec_write_log(), page_cur_parse_insert_rec():
  write the status bits of the record to the log (Bug #7973)
  page_cur_insert_rec_low(): add parameter "offsets"
  page_copy_rec_list_end_to_created_page(): remove unnecessary call
  to mem_heap_create()
innobase/page/page0page.c:
  page_copy_rec_list_end_no_locks(), page_copy_rec_list_start():
  compute offsets and pass them to page_cur_rec_insert()
parent 7d358a01
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1022,7 +1022,8 @@ btr_cur_optimistic_insert(

	/* Now, try the insert */

	*rec = page_cur_insert_rec_low(page_cursor, entry, index, NULL, mtr);
	*rec = page_cur_insert_rec_low(page_cursor, entry, index,
							NULL, NULL, mtr);
	if (!(*rec)) {
		/* If the record did not fit, reorganize */
		btr_page_reorganize(page, index, mtr);
+2 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ page_cur_rec_insert(
	page_cur_t*	cursor,	/* in: a page cursor */
	rec_t*		rec,	/* in: record to insert */
	dict_index_t*	index,	/* in: record descriptor */
	ulint*		offsets,/* in: rec_get_offsets(rec, index) */
	mtr_t*		mtr);	/* in: mini-transaction handle */
/***************************************************************
Inserts a record next to page cursor. Returns pointer to inserted record if
@@ -160,6 +161,7 @@ page_cur_insert_rec_low(
	dtuple_t*	tuple,	/* in: pointer to a data tuple or NULL */
	dict_index_t*	index,	/* in: record descriptor */
	rec_t*		rec,	/* in: pointer to a physical record or NULL */
	ulint*		offsets,/* in: rec_get_offsets(rec, index) or NULL */
	mtr_t*		mtr);	/* in: mini-transaction handle */
/*****************************************************************
Copies records from page to a newly created page, from a given record onward,
+4 −2
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ page_cur_tuple_insert(
	dict_index_t*	index,	/* in: record descriptor */
	mtr_t*		mtr)	/* in: mini-transaction handle */
{
	return(page_cur_insert_rec_low(cursor, tuple, index, NULL, mtr));
	return(page_cur_insert_rec_low(cursor, tuple, index, NULL, NULL, mtr));
}

/***************************************************************
@@ -211,8 +211,10 @@ page_cur_rec_insert(
	page_cur_t*	cursor,	/* in: a page cursor */
	rec_t*		rec,	/* in: record to insert */
	dict_index_t*	index,	/* in: record descriptor */
	ulint*		offsets,/* in: rec_get_offsets(rec, index) */
	mtr_t*		mtr)	/* in: mini-transaction handle */
{
	return(page_cur_insert_rec_low(cursor, NULL, index, rec, mtr));
	return(page_cur_insert_rec_low(cursor, NULL, index, rec,
				offsets, mtr));
}
+21 −0
Original line number Diff line number Diff line
@@ -133,6 +133,27 @@ rec_set_status(
	rec_t*	rec,	/* in: physical record */
	ulint	bits);	/* in: info bits */

/**********************************************************
The following function is used to retrieve the info and status
bits of a record.  (Only compact records have status bits.) */
UNIV_INLINE
ulint
rec_get_info_and_status_bits(
/*==============*/
			/* out: info bits */
	rec_t*	rec,	/* in: physical record */
	ibool	comp);	/* in: TRUE=compact page format */
/**********************************************************
The following function is used to set the info and status
bits of a record.  (Only compact records have status bits.) */
UNIV_INLINE
void
rec_set_info_and_status_bits(
/*==============*/
	rec_t*	rec,	/* in: physical record */
	ibool	comp,	/* in: TRUE=compact page format */
	ulint	bits);	/* in: info bits */

/**********************************************************
The following function tells if record is delete marked. */
UNIV_INLINE
+47 −0
Original line number Diff line number Diff line
@@ -520,6 +520,53 @@ rec_set_status(
				REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
}

/**********************************************************
The following function is used to retrieve the info and status
bits of a record.  (Only compact records have status bits.) */
UNIV_INLINE
ulint
rec_get_info_and_status_bits(
/*==============*/
			/* out: info bits */
	rec_t*	rec,	/* in: physical record */
	ibool	comp)	/* in: TRUE=compact page format */
{
	ulint	bits;
#if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \
& (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)
# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap"
#endif
	if (comp) {
		bits = rec_get_info_bits(rec, TRUE) | rec_get_status(rec);
	} else {
		bits = rec_get_info_bits(rec, FALSE);
		ut_ad(!(bits & ~(REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)));
	}
	return(bits);
}
/**********************************************************
The following function is used to set the info and status
bits of a record.  (Only compact records have status bits.) */
UNIV_INLINE
void
rec_set_info_and_status_bits(
/*==============*/
	rec_t*	rec,	/* in: physical record */
	ibool	comp,	/* in: TRUE=compact page format */
	ulint	bits)	/* in: info bits */
{
#if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \
& (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)
# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap"
#endif
	if (comp) {
		rec_set_status(rec, bits & REC_NEW_STATUS_MASK);
	} else {
		ut_ad(!(bits & ~(REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)));
	}
	rec_set_info_bits(rec, bits & ~REC_NEW_STATUS_MASK, comp);
}

/**********************************************************
The following function tells if record is delete marked. */
UNIV_INLINE
Loading