summaryrefslogtreecommitdiff
path: root/innobase/lock
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2004-12-09 15:29:55 +0200
committerunknown <marko@hundin.mysql.fi>2004-12-09 15:29:55 +0200
commit7945222c28e3a6a4e6087c7c99ea34c3a990e46f (patch)
tree6765ffbcdc2b26af7abb9ec1f19b58356912d9bc /innobase/lock
parentf9bd116c297f80613ed0e51750e20e5fcb623f75 (diff)
downloadmariadb-git-7945222c28e3a6a4e6087c7c99ea34c3a990e46f.tar.gz
InnoDB: Changed interface to rec_get_offsets(), to reduce the use of
memory heaps. This changeset plugs also a few memory leaks that were introduced with the compact InnoDB table format. innobase/btr/btr0btr.c: Changed interface to rec_get_offsets() innobase/btr/btr0cur.c: Changed interface to rec_get_offsets() innobase/btr/btr0pcur.c: Changed interface to rec_get_offsets() innobase/btr/btr0sea.c: Changed interface to rec_get_offsets() innobase/include/rem0rec.h: Changed interface to rec_get_offsets() innobase/include/rem0rec.ic: Changed interface to rec_get_offsets() innobase/lock/lock0lock.c: Changed interface to rec_get_offsets() innobase/page/page0cur.c: Changed interface to rec_get_offsets() innobase/page/page0page.c: Changed interface to rec_get_offsets() innobase/rem/rem0rec.c: Changed interface to rec_get_offsets() innobase/row/row0ins.c: Changed interface to rec_get_offsets() innobase/row/row0mysql.c: Changed interface to rec_get_offsets() innobase/row/row0purge.c: Changed interface to rec_get_offsets() innobase/row/row0row.c: Changed interface to rec_get_offsets() innobase/row/row0sel.c: Changed interface to rec_get_offsets() innobase/row/row0umod.c: Changed interface to rec_print() innobase/row/row0undo.c: Changed interface to rec_get_offsets() innobase/row/row0upd.c: Changed interface to rec_get_offsets() innobase/row/row0vers.c: Changed interface to rec_get_offsets() innobase/trx/trx0rec.c: Changed interface to rec_get_offsets()
Diffstat (limited to 'innobase/lock')
-rw-r--r--innobase/lock/lock0lock.c66
1 files changed, 38 insertions, 28 deletions
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index d2d16a1ae4e..961210dbd06 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -424,7 +424,7 @@ lock_check_trx_id_sanity(
/* out: TRUE if ok */
dulint trx_id, /* in: trx id */
rec_t* rec, /* in: user record */
- dict_index_t* index, /* in: clustered index */
+ dict_index_t* index, /* in: index */
const ulint* offsets, /* in: rec_get_offsets(rec, index) */
ibool has_kernel_mutex)/* in: TRUE if the caller owns the
kernel mutex */
@@ -445,7 +445,7 @@ lock_check_trx_id_sanity(
fputs(" InnoDB: Error: transaction id associated"
" with record\n",
stderr);
- rec_print(stderr, rec, offsets);
+ rec_print_new(stderr, rec, offsets);
fputs("InnoDB: in ", stderr);
dict_index_name_print(stderr, NULL, index);
fprintf(stderr, "\n"
@@ -4073,10 +4073,9 @@ lock_rec_print(
ulint page_no;
ulint i;
mtr_t mtr;
- mem_heap_t* heap;
- ulint* offsets = NULL;
-
- heap = mem_heap_create(100);
+ mem_heap_t* heap = NULL;
+ ulint offsets_[100] = { 100, };
+ ulint* offsets = offsets_;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
@@ -4157,9 +4156,9 @@ lock_rec_print(
if (page) {
rec_t* rec
= page_find_rec_with_heap_no(page, i);
- offsets = rec_reget_offsets(rec, lock->index,
- offsets, ULINT_UNDEFINED, heap);
- rec_print(file, rec, offsets);
+ offsets = rec_get_offsets(rec, lock->index,
+ offsets, ULINT_UNDEFINED, &heap);
+ rec_print_new(file, rec, offsets);
}
putc('\n', file);
@@ -4167,9 +4166,11 @@ lock_rec_print(
}
mtr_commit(&mtr);
- mem_heap_free(heap);
-}
-
+ if (heap) {
+ mem_heap_free(heap);
+ }
+}
+
/*************************************************************************
Calculates the number of record lock structs in the record lock hash table. */
static
@@ -4562,12 +4563,13 @@ lock_rec_validate_page(
page_t* page;
lock_t* lock;
rec_t* rec;
- ulint nth_lock = 0;
- ulint nth_bit = 0;
+ ulint nth_lock = 0;
+ ulint nth_bit = 0;
ulint i;
mtr_t mtr;
- mem_heap_t* heap = mem_heap_create(100);
- ulint* offsets = NULL;
+ mem_heap_t* heap = NULL;
+ ulint offsets_[100] = { 100, };
+ ulint* offsets = offsets_;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
@@ -4607,8 +4609,8 @@ loop:
index = lock->index;
rec = page_find_rec_with_heap_no(page, i);
- offsets = rec_reget_offsets(rec, index,
- offsets, ULINT_UNDEFINED, heap);
+ offsets = rec_get_offsets(rec, index, offsets,
+ ULINT_UNDEFINED, &heap);
fprintf(stderr,
"Validating %lu %lu\n", (ulong) space, (ulong) page_no);
@@ -4635,7 +4637,9 @@ function_exit:
mtr_commit(&mtr);
- mem_heap_free(heap);
+ if (heap) {
+ mem_heap_free(heap);
+ }
return(TRUE);
}
@@ -4811,11 +4815,15 @@ lock_rec_insert_check_and_lock(
#ifdef UNIV_DEBUG
{
- mem_heap_t* heap = mem_heap_create(100);
- const ulint* offsets = rec_get_offsets(next_rec, index,
- ULINT_UNDEFINED, heap);
+ mem_heap_t* heap = NULL;
+ ulint offsets_[100] = { 100, };
+ const ulint* offsets = rec_get_offsets(
+ next_rec, index, offsets_,
+ ULINT_UNDEFINED, &heap);
ut_ad(lock_rec_queue_validate(next_rec, index, offsets));
- mem_heap_free(heap);
+ if (heap) {
+ mem_heap_free(heap);
+ }
}
#endif /* UNIV_DEBUG */
@@ -4954,11 +4962,14 @@ lock_sec_rec_modify_check_and_lock(
#ifdef UNIV_DEBUG
{
- mem_heap_t* heap = mem_heap_create(100);
- const ulint* offsets = rec_get_offsets(rec, index,
- ULINT_UNDEFINED, heap);
+ mem_heap_t* heap = NULL;
+ ulint offsets_[100] = { 100, };
+ const ulint* offsets = rec_get_offsets(
+ rec, index, offsets_, ULINT_UNDEFINED, &heap);
ut_ad(lock_rec_queue_validate(rec, index, offsets));
- mem_heap_free(heap);
+ if (heap) {
+ mem_heap_free(heap);
+ }
}
#endif /* UNIV_DEBUG */
@@ -5067,7 +5078,6 @@ lock_clust_rec_read_check_and_lock(
ut_ad(page_rec_is_user_rec(rec) || page_rec_is_supremum(rec));
ut_ad(gap_mode == LOCK_ORDINARY || gap_mode == LOCK_GAP
|| gap_mode == LOCK_REC_NOT_GAP);
- ut_ad(index->type & DICT_CLUSTERED);
ut_ad(rec_offs_validate(rec, index, offsets));
if (flags & BTR_NO_LOCKING_FLAG) {