Bug #75371 Arguments in wrong order
Submitted: 1 Jan 2015 11:05 Modified: 5 Jan 2015 16:34
Reporter: Joshua Rogers Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7.6 OS:Any
Assigned to: CPU Architecture:Any

[1 Jan 2015 11:05] Joshua Rogers
Description:
In /storage/innobase/btr/btr0btr.cc:

3415                        mbr_changed = rtr_merge_mbr_changed(
3416                                &cursor2, &father_cursor,
3417                                offsets2, offsets, &new_mbr,
3418                                merge_block, block, index);

    &cursor2 is passed to cursor rather than to cursor2
    offsets2 is passed to offsets rather than to offsets2
    offsets is passed to offsets2 rather than to offsets

How to repeat:
.

Suggested fix:
.
[1 Jan 2015 15:12] MySQL Verification Team
Hello Joshua Rogers,

Thank you for the report.

Thanks,
Umesh

// from trunk

// storage/innobase/btr/btr0btr.cc

			/* Check if parent entry needs to be updated */
			mbr_changed = rtr_merge_mbr_changed(
				&cursor2, &father_cursor,
				offsets2, offsets, &new_mbr,
				merge_block, block, index);

//  storage/innobase/gis/gis0rtree.cc

/****************************************************************//**
Check two MBRs are identical or need to be merged */
bool
rtr_merge_mbr_changed(
/*==================*/
	btr_cur_t*		cursor,		/*!< in/out: cursor */
	btr_cur_t*		cursor2,	/*!< in: the other cursor */
	ulint*			offsets,	/*!< in: rec offsets */
	ulint*			offsets2,	/*!< in: rec offsets */
	rtr_mbr_t*		new_mbr,	/*!< out: MBR to update */
	buf_block_t*		merge_block,	/*!< in: page to merge */
	buf_block_t*		block,		/*!< in: page be merged */
	dict_index_t*		index)		/*!< in: index */
{
	double*		mbr;
	double		mbr1[SPDIMS * 2];
	double		mbr2[SPDIMS * 2];
	rec_t*		rec;
	ulint		len;
	bool		changed = false;
[5 Jan 2015 7:00] Allen Lai
Hi, Joshua Rogers, thanks for report this bug.
Actually, in function rtr_merge_mbr_changed, the input parameters cursor and offsets is the pair information of first record, similarly, cursor2 and offsets2 is for second record.
When we call rtr_merge_mbr_changed in btr_compress, we send the variable cursor2 and offsets2 as the first pair, and father_cursor/offsets as the second pair. We don't need to care about the names, the only thing we need to care is what's their meaning and context.
BTW, Thanks again for reading our code so carefully, hope my answer can help you to understand our code more clearly.