List:Internals« Previous MessageNext Message »
From:MARK CALLAGHAN Date:February 18 2010 6:56pm
Subject:Re: Finding the start of a statement
View as plain text  
On Thu, Feb 18, 2010 at 10:19 AM, MARK CALLAGHAN <mdcallag@stripped> wrote:

>
> http://bugs.mysql.com/bug.php?id=51285 has an example of a stack trace
> where there is a call from
>  JOIN::optimize -> ... -> ha_innodb::external_lock -> innobase_commit
> -> trx_commit_for_mysql
>
> This is not good. The trx functions lock kernel_mutex which is already
> too hot. Why must commit be done during query optimization? This is
> the comment from ha_innodb::external_lock()
>
>        /* If the MySQL lock count drops to zero we know that the
> current SQL
>        statement has ended */
>
>        if (trx->n_mysql_tables_in_use == 0) {
>
>                trx->mysql_n_tables_locked
> = 0;
>                prebuilt->used_in_HANDLER =
> FALSE;
>
>                if (!thd_test_options(thd,
> OPTION_NOT_AUTOCOMMIT |
> OPTION_BEGIN)) {
>                        if
> (trx->active_trans != 0) {
>                        
>        innobase_commit(ht, thd, TRUE);
>

I added more tracing and the early call to innobase_commit is OK. For
simple queries and simple joins, trx_commit_for_mysql is still called
once per statement during sysbench and something else must have caused
the perf regression post 5.1.38.

-- 
Mark Callaghan
mdcallag@stripped
Thread
Finding the start of a statementPaul McCullagh27 Jan
  • re: Finding the start of a statementMichael Widenius29 Jan
    • Re: Finding the start of a statementMARK CALLAGHAN29 Jan
      • Re: Finding the start of a statementPaul McCullagh1 Feb
        • Re: Finding the start of a statementKristian Nielsen1 Feb
          • Re: Finding the start of a statementPaul McCullagh1 Feb
          • Re: Finding the start of a statementKristian Nielsen11 Feb
        • Re: Finding the start of a statementSergei Golubchik1 Feb
          • Re: Finding the start of a statementPaul McCullagh2 Feb
      • Re: Finding the start of a statementMichael Widenius3 Feb
        • Re: Finding the start of a statementMARK CALLAGHAN18 Feb
          • Re: Finding the start of a statementMARK CALLAGHAN18 Feb
  • Re: Finding the start of a statementSergei Golubchik1 Feb
    • Re: Finding the start of a statementPaul McCullagh1 Feb