3849 Marko Mäkelä 2012-05-22
WL#5526 optimization: Do not log trx_id for ROW_OP_PURGE.
modified:
storage/innobase/row/row0log.cc
3848 Marko Mäkelä 2012-05-22
rec_get_trx_id(): Use trx_read_trx_id().
modified:
storage/innobase/rem/rem0rec.cc
3847 Marko Mäkelä 2012-05-21
WL#6255 preparations to avoid adding rec_get_offsets() calls.
The function rec_get_offsets() was added for MySQL 5.0.3 in a hurry.
InnoDB reallocates and recomputes the offsets a few times per B-tree
operation. We should really allocate the space for the offsets on
page_cur creation, and we should keep the offsets up to date with
page_cur.rec. This is not a complete fix, but it will avoid some cases
of recomputing, so that WL#6255 will not add any rec_get_offsets()
calls.
btr_cur_upd_lock_and_undo(), btr_cur_update_in_place():
Add the parameter offsets.
btr_cur_update_in_place_log(): Add const qualifiers.
btr_cur_optimistic_update(): Add the parameters offsets, heap, for
keeping the result from rec_get_offsets(). TODO: Take the offsets from
the caller.
btr_cur_pessimistic_update(): Add the parameter offsets for keeping
the result from rec_get_offsets(). TODO: Take the offsets from the
caller.
row_ins_index_entry_big_rec_func(): Declare the parameter offsets nonnull.
row_ins_clust_index_entry_by_modify(): Add the parameter offsets for
keeping the result from rec_get_offsets().
row_undo_mod_clust_low(): Add the parameters offsets, heap, for
keeping the result from rec_get_offsets(). TODO: Take the offsets from
the caller.
modified:
storage/innobase/btr/btr0cur.cc
storage/innobase/include/btr0cur.h
storage/innobase/include/row0ins.h
storage/innobase/row/row0ins.cc
storage/innobase/row/row0log.cc
storage/innobase/row/row0merge.cc
storage/innobase/row/row0umod.cc
storage/innobase/row/row0upd.cc
=== modified file 'storage/innobase/rem/rem0rec.cc'
--- a/storage/innobase/rem/rem0rec.cc revid:marko.makela@strippedcmg
+++ b/storage/innobase/rem/rem0rec.cc revid:marko.makela@stripped
@@ -1828,15 +1828,12 @@ rec_get_trx_id(
trx_id = rec_get_nth_field(rec, offsets, trx_id_col, &len);
ut_ad(len == DATA_TRX_ID_LEN);
-# if DATA_TRX_ID_LEN != 6
-# error
-# endif
if (heap) {
mem_heap_free(heap);
}
- return(mach_read_from_6(trx_id));
+ return(trx_read_trx_id(trx_id));
}
# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
=== modified file 'storage/innobase/row/row0log.cc'
--- a/storage/innobase/row/row0log.cc revid:marko.makela@stripped
+++ b/storage/innobase/row/row0log.cc revid:marko.makela@strippedom-20120522074751-ssjclchp2lqkq5mu
@@ -41,7 +41,7 @@ static bool row_log_apply_print;
#endif /* ROW_LOG_APPLY_PRINT */
/** Size of the modification log entry header, in bytes */
-#define ROW_LOG_HEADER_SIZE (2 + DATA_TRX_ID_LEN)/*op, trx_id, extra_size*/
+#define ROW_LOG_HEADER_SIZE 2/*op, extra_size*/
/** Log block for modifications during online index creation */
struct row_log_buf_struct {
@@ -143,9 +143,22 @@ op_ok:
ut_ad(extra_size >= REC_N_NEW_EXTRA_BYTES);
extra_size -= REC_N_NEW_EXTRA_BYTES;
size -= REC_N_NEW_EXTRA_BYTES;
- mrec_size = size + ROW_LOG_HEADER_SIZE + (extra_size >= 0x80);
-
ut_ad(size <= sizeof log->tail.buf);
+
+ switch (op) {
+ case ROW_OP_INSERT:
+ case ROW_OP_DELETE_MARK:
+ case ROW_OP_DELETE_UNMARK:
+ case ROW_OP_DELETE_PURGE:
+ mrec_size = ROW_LOG_HEADER_SIZE + DATA_TRX_ID_LEN
+ + (extra_size >= 0x80) + size;
+ break;
+ case ROW_OP_PURGE:
+ mrec_size = ROW_LOG_HEADER_SIZE
+ + (extra_size >= 0x80) + size;
+ break;
+ }
+
ut_ad(log->tail.bytes < srv_sort_buf_size);
avail_size = srv_sort_buf_size - log->tail.bytes;
@@ -156,8 +169,17 @@ op_ok:
}
*b++ = op;
- trx_write_trx_id(b, trx_id);
- b += DATA_TRX_ID_LEN;
+
+ switch (op) {
+ case ROW_OP_INSERT:
+ case ROW_OP_DELETE_MARK:
+ case ROW_OP_DELETE_UNMARK:
+ case ROW_OP_DELETE_PURGE:
+ trx_write_trx_id(b, trx_id);
+ b += DATA_TRX_ID_LEN;
+ case ROW_OP_PURGE:
+ break;
+ }
if (extra_size < 0x80) {
*b++ = (byte) extra_size;
@@ -648,9 +670,18 @@ row_log_apply_op(
case ROW_OP_INSERT:
case ROW_OP_DELETE_MARK:
case ROW_OP_DELETE_UNMARK:
- case ROW_OP_PURGE:
case ROW_OP_DELETE_PURGE:
+ if (ROW_LOG_HEADER_SIZE + DATA_TRX_ID_LEN + mrec >= mrec_end) {
+ return(NULL);
+ }
+
op = static_cast<enum row_op>(*mrec++);
+ trx_id = trx_read_trx_id(mrec);
+ mrec += DATA_TRX_ID_LEN;
+ break;
+ case ROW_OP_PURGE:
+ op = static_cast<enum row_op>(*mrec++);
+ trx_id = 0;
break;
default:
corrupted:
@@ -659,9 +690,6 @@ corrupted:
return(NULL);
}
- trx_id = trx_read_trx_id(mrec);
- mrec += DATA_TRX_ID_LEN;
-
extra_size = *mrec++;
ut_ad(mrec < mrec_end);
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-trunk-wl6255 branch (marko.makela:3847 to 3849) WL#5526 | marko.makela | 22 May |