Commit 72e3f38f authored by marko's avatar marko

branches/innodb+: ibuf_insert_low(): When buffering an insert or a

delete-mark operation, do not count the buffered records.  The count
is only relevant for buffering IBUF_OP_DELETE operations.

ibuf_get_volume_buffered(): Do not count the records if n_recs is NULL.
Do not zero out *n_recs, but let the caller do that.

ibuf_get_volume_buffered_count(): Do nothing if n_recs == NULL.
parent 95d7d87c
...@@ -2581,6 +2581,12 @@ ibuf_get_volume_buffered_count( ...@@ -2581,6 +2581,12 @@ ibuf_get_volume_buffered_count(
ut_ad(ibuf_inside()); ut_ad(ibuf_inside());
ut_ad(rec_get_n_fields_old(rec) > 2); ut_ad(rec_get_n_fields_old(rec) > 2);
if (!n_recs) {
/* The records only need to be counted when
IBUF_OP_DELETE is being buffered. */
return;
}
field = rec_get_nth_field_old(rec, 1, &len); field = rec_get_nth_field_old(rec, 1, &len);
if (UNIV_UNLIKELY(len > 1)) { if (UNIV_UNLIKELY(len > 1)) {
...@@ -2655,8 +2661,9 @@ ibuf_get_volume_buffered( ...@@ -2655,8 +2661,9 @@ ibuf_get_volume_buffered(
or BTR_MODIFY_TREE */ or BTR_MODIFY_TREE */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint page_no,/* in: page number of an index page */ ulint page_no,/* in: page number of an index page */
ulint* n_recs, /* out: minimum number of records on the page ulint* n_recs, /* in/out: minimum number of records on the
after the buffered changes have been applied */ page after the buffered changes have been
applied, or NULL to disable the counting */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
ulint volume; ulint volume;
...@@ -2677,7 +2684,6 @@ ibuf_get_volume_buffered( ...@@ -2677,7 +2684,6 @@ ibuf_get_volume_buffered(
pcur */ pcur */
volume = 0; volume = 0;
*n_recs = 0;
memset(hash_bitmap, 0, sizeof hash_bitmap); memset(hash_bitmap, 0, sizeof hash_bitmap);
rec = btr_pcur_get_rec(pcur); rec = btr_pcur_get_rec(pcur);
...@@ -3223,8 +3229,11 @@ ibuf_insert_low( ...@@ -3223,8 +3229,11 @@ ibuf_insert_low(
/* Find out the volume of already buffered inserts for the same index /* Find out the volume of already buffered inserts for the same index
page */ page */
min_n_recs = 0;
buffered = ibuf_get_volume_buffered(&pcur, space, page_no, buffered = ibuf_get_volume_buffered(&pcur, space, page_no,
&min_n_recs, &mtr); op == IBUF_OP_DELETE
? &min_n_recs
: NULL, &mtr);
if (op == IBUF_OP_DELETE && min_n_recs == 0) { if (op == IBUF_OP_DELETE && min_n_recs == 0) {
/* The page could become empty after the record is /* The page could become empty after the record is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment