List:Commits« Previous MessageNext Message »
From:marko.makela Date:May 18 2012 5:25am
Subject:bzr push into mysql-trunk-wl6255 branch (marko.makela:3840 to 3843)
View as plain text  
 3843 Marko Mäkelä	2012-05-17
      btr_cur_add_path_info(): Add const qualifiers.

    modified:
      storage/innobase/btr/btr0cur.cc
 3842 Marko Mäkelä	2012-05-17
      Remove unused function row_upd_changes_fts_columns().

    modified:
      storage/innobase/include/row0upd.h
      storage/innobase/row/row0upd.cc
 3841 Marko Mäkelä	2012-05-17
      WL#6255 optimization: Remove duplicate rec_get_offsets() call.
      
      trx_undo_report_row_operation(): Add the parameter offsets.

    modified:
      storage/innobase/btr/btr0cur.cc
      storage/innobase/include/trx0rec.h
      storage/innobase/trx/trx0rec.cc
 3840 Marko Mäkelä	2012-05-16
      row_log_apply(): Assert that the index is a secondary index.

    modified:
      storage/innobase/include/row0log.h
      storage/innobase/row/row0log.cc
=== modified file 'storage/innobase/btr/btr0cur.cc'
--- a/storage/innobase/btr/btr0cur.cc	revid:marko.makela@strippedebox7
+++ b/storage/innobase/btr/btr0cur.cc	revid:marko.makela@stripped
@@ -1139,7 +1139,7 @@ btr_cur_ins_lock_and_undo(
 
 	err = trx_undo_report_row_operation(flags, TRX_UNDO_INSERT_OP,
 					    thr, index, entry,
-					    NULL, 0, NULL,
+					    NULL, 0, NULL, NULL,
 					    &roll_ptr);
 	if (err != DB_SUCCESS) {
 
@@ -1626,23 +1626,19 @@ btr_cur_upd_lock_and_undo(
 	/* Check if we have to wait for a lock: enqueue an explicit lock
 	request if yes */
 
-	err = DB_SUCCESS;
+	mem_heap_t*	heap		= NULL;
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
+	ulint*		offsets;
+	rec_offs_init(offsets_);
+	offsets = rec_get_offsets(rec, index, offsets_,
+				  ULINT_UNDEFINED, &heap);
 
 	if (!(flags & BTR_NO_LOCKING_FLAG)) {
-		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-		rec_offs_init(offsets_);
-
 		err = lock_clust_rec_modify_check_and_lock(
 			flags, btr_cur_get_block(cursor), rec, index,
-			rec_get_offsets(rec, index, offsets_,
-					ULINT_UNDEFINED, &heap), thr);
-		if (UNIV_LIKELY_NULL(heap)) {
-			mem_heap_free(heap);
-		}
+			offsets, thr);
 		if (err != DB_SUCCESS) {
-
-			return(err);
+			goto func_exit;
 		}
 	}
 
@@ -1650,7 +1646,12 @@ btr_cur_upd_lock_and_undo(
 
 	err = trx_undo_report_row_operation(flags, TRX_UNDO_MODIFY_OP, thr,
 					    index, NULL, update,
-					    cmpl_info, rec, roll_ptr);
+					    cmpl_info, rec, offsets, roll_ptr);
+func_exit:
+	if (UNIV_LIKELY_NULL(heap)) {
+		mem_heap_free(heap);
+	}
+
 	return(err);
 }
 
@@ -2750,7 +2751,7 @@ btr_cur_del_mark_set_clust_rec(
 	}
 
 	err = trx_undo_report_row_operation(0, TRX_UNDO_MODIFY_OP, thr,
-					    index, NULL, NULL, 0, rec,
+					    index, NULL, NULL, 0, rec, offsets,
 					    &roll_ptr);
 	if (err != DB_SUCCESS) {
 
@@ -3231,8 +3232,8 @@ btr_cur_add_path_info(
 	ulint		root_height)	/*!< in: root node height in tree */
 {
 	btr_path_t*	slot;
-	rec_t*		rec;
-	page_t*		page;
+	const rec_t*	rec;
+	const page_t*	page;
 
 	ut_a(cursor->path_arr);
 

=== modified file 'storage/innobase/include/row0upd.h'
--- a/storage/innobase/include/row0upd.h	revid:marko.makela@strippedspebox7
+++ b/storage/innobase/include/row0upd.h	revid:marko.makela@stripped
@@ -325,18 +325,6 @@ row_upd_changes_doc_id(
 	upd_field_t*	upd_field)	/*!< in: field to check */
 	__attribute__((nonnull, warn_unused_result));
 /***********************************************************//**
-Checks if an update vector changes the table's FTS-indexed columns.
-NOTE: must not be called for tables which do not have an FTS-index.
-Also, the vector returned must be explicitly freed as it's allocated
-using the ut_malloc() allocator.
-@return vector of FTS indexes that were affected by the update else NULL */
-UNIV_INTERN
-ib_vector_t*
-row_upd_changes_fts_columns(
-/*========================*/
-	dict_table_t*	table,		/*!< in: table */
-	upd_t*		update);	/*!< in: update vector for the row */
-/***********************************************************//**
 Checks if an update vector changes an ordering field of an index record.
 This function is fast if the update vector is short or the number of ordering
 fields in the index is small. Otherwise, this can be quadratic.

=== modified file 'storage/innobase/include/trx0rec.h'
--- a/storage/innobase/include/trx0rec.h	revid:marko.makela@strippeda4paaphifspebox7
+++ b/storage/innobase/include/trx0rec.h	revid:marko.makela@stripped05vt9
@@ -227,11 +227,12 @@ trx_undo_report_row_operation(
 	const rec_t*	rec,		/*!< in: case of an update or delete
 					marking, the record in the clustered
 					index, otherwise NULL */
+	const ulint*	offsets,	/*!< in: rec_get_offsets(rec) */
 	roll_ptr_t*	roll_ptr)	/*!< out: rollback pointer to the
 					inserted undo log record,
 					0 if BTR_NO_UNDO_LOG
 					flag was specified */
-	__attribute__((nonnull(3,4,9), warn_unused_result));
+	__attribute__((nonnull(3,4,10), warn_unused_result));
 /******************************************************************//**
 Copies an undo record to heap. This function can be called if we know that
 the undo log record exists.

=== modified file 'storage/innobase/row/row0upd.cc'
--- a/storage/innobase/row/row0upd.cc	revid:marko.makela@oracle.com-20120516135728-a4paaphifspebox7
+++ b/storage/innobase/row/row0upd.cc	revid:marko.makela@stripped04133-y0mmf2zyqap05vt9
@@ -1433,61 +1433,6 @@ row_upd_changes_fts_column(
 }
 
 /***********************************************************//**
-Checks if an update vector changes the table's FTS-indexed columns.
-NOTE: must not be called for tables which do not have an FTS-index.
-Also, the vector returned must be explicitly freed as it's allocated
-using the ut_malloc() allocator.
-@return vector of FTS indexes that were affected by the update */
-UNIV_INTERN
-ib_vector_t*
-row_upd_changes_fts_columns(
-/*========================*/
-	dict_table_t*	table,		/*!< in: table */
-	upd_t*		update)		/*!< in: update vector for the row */
-{
-	ulint		i;
-	ulint		offset;
-	fts_t*		fts = table->fts;
-	ib_vector_t*	updated_fts_indexes = NULL;
-
-	for (i = 0; i < upd_get_n_fields(update); ++i) {
-		upd_field_t*	upd_field = upd_get_nth_field(update, i);
-
-		offset = row_upd_changes_fts_column(table, upd_field);
-
-		if (offset != ULINT_UNDEFINED) {
-
-			dict_index_t*	index;
-
-			/* TODO: Investigate if we can check whether the
-			existing set of affected indexes matches the new
-			affected set. If matched then we don't need to
-			do the extra malloc()/free(). */
-
-			/* This vector is created from the ut_malloc()
-			allocator because we only want to keep one instance
-			around not matter how many times this row is
-			updated. The old entry should be deleted when
-			we update the FTS row info with this new vector. */
-			if (updated_fts_indexes == NULL) {
-				ib_alloc_t*	ut_alloc;
-
-				ut_alloc = ib_ut_allocator_create();
-
-				updated_fts_indexes = ib_vector_create(
-					ut_alloc, sizeof(dict_index_t*), 2);
-			}
-
-			index = static_cast<dict_index_t*>(
-				ib_vector_getp(fts->indexes, offset));
-			ib_vector_push(updated_fts_indexes, &index);
-		}
-	}
-
-	return(updated_fts_indexes);
-}
-
-/***********************************************************//**
 Checks if an update vector changes some of the first ordering fields of an
 index record. This is only used in foreign key checks and we can assume
 that index does not contain column prefixes.

=== modified file 'storage/innobase/trx/trx0rec.cc'
--- a/storage/innobase/trx/trx0rec.cc	revid:marko.makela@stripped-a4paaphifspebox7
+++ b/storage/innobase/trx/trx0rec.cc	revid:marko.makela@strippedvt9
@@ -1205,6 +1205,7 @@ trx_undo_report_row_operation(
 	const rec_t*	rec,		/*!< in: in case of an update or delete
 					marking, the record in the clustered
 					index, otherwise NULL */
+	const ulint*	offsets,	/*!< in: rec_get_offsets(rec) */
 	roll_ptr_t*	roll_ptr)	/*!< out: rollback pointer to the
 					inserted undo log record,
 					0 if BTR_NO_UNDO_LOG
@@ -1217,15 +1218,12 @@ trx_undo_report_row_operation(
 	trx_rseg_t*	rseg;
 	mtr_t		mtr;
 	dberr_t		err		= DB_SUCCESS;
-	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
 #ifdef UNIV_DEBUG
 	int		loop_count	= 0;
 #endif /* UNIV_DEBUG */
-	rec_offs_init(offsets_);
 
 	ut_a(dict_index_is_clust(index));
+	ut_ad(!rec || rec_offs_validate(rec, index, offsets));
 
 	if (flags & BTR_NO_UNDO_LOG_FLAG) {
 
@@ -1291,8 +1289,6 @@ trx_undo_report_row_operation(
 		}
 
 		ut_ad(err == DB_SUCCESS);
-		offsets = rec_get_offsets(rec, index, offsets,
-					  ULINT_UNDEFINED, &heap);
 	}
 
 	page_no = undo->last_page_no;
@@ -1371,8 +1367,7 @@ trx_undo_report_row_operation(
 			*roll_ptr = trx_undo_build_roll_ptr(
 				op_type == TRX_UNDO_INSERT_OP,
 				rseg->id, page_no, offset);
-			err = DB_SUCCESS;
-			goto func_exit;
+			return(DB_SUCCESS);
 		}
 
 		ut_ad(page_no == undo->last_page_no);
@@ -1399,10 +1394,6 @@ trx_undo_report_row_operation(
 err_exit:
 	mutex_exit(&trx->undo_mutex);
 	mtr_commit(&mtr);
-func_exit:
-	if (UNIV_LIKELY_NULL(heap)) {
-		mem_heap_free(heap);
-	}
 	return(err);
 }
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl6255 branch (marko.makela:3840 to 3843) marko.makela18 May