On Tue, Nov 06, 2007 at 17:10:26 -0500, Baron Schwartz wrote:
> One of my feature requests for InnoDB
> (http://bugs.mysql.com/bug.php?id=29126) is to disable the verbose lock
> output in SHOW INNODB STATUS. It looks to me like it can be done very
> easily in innobase/lock/lock0lock.c by changing this code:
>
> 4172 for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
> 4173
> 4174 if (lock_rec_get_nth_bit(lock, i)) {
> 4175
> 4176 fprintf(file, "Record lock, heap no %lu ", (ulong) i);
> 4177
> 4178 if (page) {
> 4179 rec_t* rec
> 4180 = page_find_rec_with_heap_no(page, i);
> 4181 offsets = rec_get_offsets(rec, lock->index,
> 4182 offsets, ULINT_UNDEFINED, &heap);
> 4183 rec_print_new(file, rec, offsets);
> 4184 }
> 4185
> 4186 putc('\n', file);
> 4187 }
> 4188 }
>
> I could easily comment that out, but it'd be nice to make a patch others
> could use. I think all I need to do is add a #ifdef around that. But what
> should I #ifdef with? I see UNIV_SYNC_DEBUG in lots of places in the
> source, but maybe there's something better.
Well, I guess "#if 0" would be best :-) Beware that none of UNIV_*DEBUG
is intended for production environments - it will degrade performance
significantly. But I understand you are trying to disable some code, so
anything would do - even "#ifdef BOGUS_FOOBARBAZ_CODE_BELOW_IS_DISABLED".
> The other part of that feature request is to always print the locks for
> each transaction, as is done when the innodb_lock_monitor is enabled. This
> way I can see locks held, without filling the error log with them. I think
> the best way to do that is to add a server variable that will allow that to
> be configurable, but I doubt that's as easy as the following patch against
> the 5.0.45 source, which accomplishes both of my desired changes, plus
> changes the number of locks printed from 10 to 50:
Yes, and also I am afraid adding server parameters to 5.0 is somewhat
frozen.
> baron@tigger mysql-5.0.45 $ diff -ur innobase/lock/lock0lock.c{.orig,}
> --- innobase/lock/lock0lock.c.orig 2007-11-06 16:50:26.000000000 -0500
> +++ innobase/lock/lock0lock.c 2007-11-06 17:07:23.000000000 -0500
[...]
> Advice is appreciated. I'll do this one way or another, as I really need
> to see the locks and not the locked records for day-to-day troubleshooting
> and admin jobs. But doing it "the right way" would be nice :-)
Well, not very useful advice but as this is unlikely to make it to the
official 5.0 tree try to change as little lines as possible in order to
make your patch easily appliable to future 5.0.x versions.
Good luck!
PS Something interesting on this topic is cooking behind the corner
for 5.1.
--
Vasil Dimov
moc.elcaro@stripped Software Developer @ Oracle/Innobase Oy
gro.DSBeerF@dv Committer @ FreeBSD.org
gro.d5v@dv Home @ Sofia, Bulgaria
Attachment: [application/pgp-signature]