Unnecessary log_sys->mutex reacquisition in mtr_log_reserve_and_write()

Bug #1163439 reported by Alexey Kopytov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Medium
Alexey Kopytov
5.1
Won't Fix
Undecided
Unassigned
5.5
Fix Released
Medium
Alexey Kopytov
5.6
Fix Released
Medium
Alexey Kopytov

Bug Description

mtr_log_reserve_and_write() implements the following logic with respect
to log_sys->mutex: if the mini-transaction log contains a single block,
it calls log_reserve_and_write_fast() which acquires log_sys->mutex and
does a "fast" write by appending the new record to the current log
block. If the record does not fit in the current log block,
log_reserve_and_write_fast() releases log_sys->mutex and returns 0, in
which case mtr_log_reserve_and_write() immediately reacquires
log_sys->mutex by calling log_reserve_and_open() and proceeds with the
"slow" write procedure.

It doesn't make sense to release a mutex and reacquire it immediately
and benchmarks show that avoiding this helps to reduce log_sys->mutex
contention in some write-intensive workloads.

Tags: xtradb

Related branches

tags: added: xtradb
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

The exact same reasoning applies to the upstream, but there is no upstream bug ref. Is that intentional?

Revision history for this message
Alexey Kopytov (akopytov) wrote : Re: [Bug 1163439] Re: Unnecessary log_sys->mutex reacquisition in mtr_log_reserve_and_write()

Hi Laurynas,

On Wed, 03 Apr 2013 06:16:43 -0000, Laurynas Biveinis wrote:
> The exact same reasoning applies to the upstream, but there is no
> upstream bug ref. Is that intentional?
>

Upstream bug ref added.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1347

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.