Bug#12606344 - ADD VALGRIND DIAGNOSTICS TO MTR_START, MTR_COMMIT

mtr_start(): Declare the mtr memory area uninitialized in Valgrind
before initializing the fields.

mtr_commit(): Declare everything uninitialized except
mtr->start_lsn, mtr->end_lsn and mtr->state.
This commit is contained in:
Marko Mäkelä 2011-05-31 10:55:29 +03:00
parent 322dfc9d11
commit 942cd5fd18
2 changed files with 14 additions and 1 deletions

View File

@ -37,6 +37,8 @@ mtr_start(
/*======*/
mtr_t* mtr) /*!< out: mini-transaction */
{
UNIV_MEM_INVALID(mtr, sizeof *mtr);
dyn_array_create(&(mtr->memo));
dyn_array_create(&(mtr->log));

View File

@ -265,9 +265,20 @@ mtr_commit(
mtr_memo_pop_all(mtr);
#endif /* !UNIV_HOTBACKUP */
ut_d(mtr->state = MTR_COMMITTED);
dyn_array_free(&(mtr->memo));
dyn_array_free(&(mtr->log));
#ifdef UNIV_DEBUG_VALGRIND
/* Declare everything uninitialized except
mtr->start_lsn, mtr->end_lsn and mtr->state. */
{
ib_uint64_t start_lsn = mtr->start_lsn;
ib_uint64_t end_lsn = mtr->end_lsn;
UNIV_MEM_INVALID(mtr, sizeof *mtr);
mtr->start_lsn = start_lsn;
mtr->end_lsn = end_lsn;
}
#endif /* UNIV_DEBUG_VALGRIND */
ut_d(mtr->state = MTR_COMMITTED);
}
#ifndef UNIV_HOTBACKUP