Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-3789

LP:470590 - Multiple fsync()s when sync_binlog=N (>0)

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a Bug
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Depending on the setup and the choice of speed vs integrity in case of a server crash, configs need sync_binlog=1.
      This slows down the server, but actually unnecessarily so. The setting apparently causes separate fsync() calls in various places in the code (binlog, relay log/index, possibly the master.info file), and that's ridiculous.

      Can someone (Monty?) please fix this, and make the logic such that we get only a single fsync() per commit?
      If this is a logistical problem given the XtraDB/InnoDB plugin, I can cope with one extra fsync() in the main server code in addition to the one in InnoDB... that can be a good intermediate step and would already reduce the overhead and slow-down significantly.

      Thanks!

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            psergey Sergei Petrunia added a comment -

            Re: Multiple fsync()s when sync_binlog=N (>0)
            Arjen,

            Could you please point at the offending fsync() calls or provide some evidence that there are multiple syncs being done for one transaction? (i.e. what has led you to suspect that there are more fsync calls done when necessary?)

            Show
            psergey Sergei Petrunia added a comment - Re: Multiple fsync()s when sync_binlog=N (>0) Arjen, Could you please point at the offending fsync() calls or provide some evidence that there are multiple syncs being done for one transaction? (i.e. what has led you to suspect that there are more fsync calls done when necessary?)
            Hide
            arjenlentz Arjen Lentz added a comment -

            Re: [Bug 470590] Re: Multiple fsync()s when sync_binlog=N (>0)
            Hi Sergey

            On 24/11/2009, at 7:24 PM, Sergey Petrunia wrote:
            > Could you please point at the offending fsync() calls or provide some
            > evidence that there are multiple syncs being done for one transaction?
            > (i.e. what has led you to suspect that there are more fsync calls done
            > when necessary?)

            Hearsay from people with a clue. Hadn't browsed the code for this
            myself.
            However, just doing a quick grep/less finds them within a few seconds.
            There's mysys/my_sync.c that contains my_sync()

            my_sync() gets called from sql/log.cc in several places, inside
            functions that do something... for instance when binlog is written, if
            sync_binlog is 1 or reaches its configured number, it's fsynced. This,
            by definition, implies that it's a separate sync from an InnoDB
            transaction or MariaDB action. That's two syncs already, that should
            in fact be one.

            And the binlog index should really also be part of that, to be
            resilient to crashes. It would also be less overhead than it is now,
            provided fsync/my_sync is only called once for a commit.

            Similarly, the relay log and relay index should be synced at the same
            time, and possibly master.info with it.

            I hope this provides you with sufficient detail to address the problem.
            Thanks

            Cheers,
            Arjen.

            Show
            arjenlentz Arjen Lentz added a comment - Re: [Bug 470590] Re: Multiple fsync()s when sync_binlog=N (>0) Hi Sergey On 24/11/2009, at 7:24 PM, Sergey Petrunia wrote: > Could you please point at the offending fsync() calls or provide some > evidence that there are multiple syncs being done for one transaction? > (i.e. what has led you to suspect that there are more fsync calls done > when necessary?) Hearsay from people with a clue. Hadn't browsed the code for this myself. However, just doing a quick grep/less finds them within a few seconds. There's mysys/my_sync.c that contains my_sync() my_sync() gets called from sql/log.cc in several places, inside functions that do something... for instance when binlog is written, if sync_binlog is 1 or reaches its configured number, it's fsynced. This, by definition, implies that it's a separate sync from an InnoDB transaction or MariaDB action. That's two syncs already, that should in fact be one. And the binlog index should really also be part of that, to be resilient to crashes. It would also be less overhead than it is now, provided fsync/my_sync is only called once for a commit. Similarly, the relay log and relay index should be synced at the same time, and possibly master.info with it. I hope this provides you with sufficient detail to address the problem. Thanks Cheers, Arjen.
            Hide
            hakanküçükyılmaz Hakan Küçükyılmaz added a comment -

            Re: Multiple fsync()s when sync_binlog=N (>0)
            We have to investigate the use of fsync(s) and whether it is feasable to reduce the number of fsync() calls.

            Show
            hakanküçükyılmaz Hakan Küçükyılmaz added a comment - Re: Multiple fsync()s when sync_binlog=N (>0) We have to investigate the use of fsync(s) and whether it is feasable to reduce the number of fsync() calls.
            Hide
            knielsen Kristian Nielsen added a comment -

            Re: Multiple fsync()s when sync_binlog=N (>0)
            The issue is more complex than just saying that things are "ridiculous".

            There are several worklogs that describe ideas for improving this. For example:

            http://askmonty.org/worklog/Server-RawIdeaBin/?tid=164
            http://askmonty.org/worklog/Server-RawIdeaBin/?tid=187
            http://askmonty.org/worklog/Server-Sprint/?tid=175

            Show
            knielsen Kristian Nielsen added a comment - Re: Multiple fsync()s when sync_binlog=N (>0) The issue is more complex than just saying that things are "ridiculous". There are several worklogs that describe ideas for improving this. For example: http://askmonty.org/worklog/Server-RawIdeaBin/?tid=164 http://askmonty.org/worklog/Server-RawIdeaBin/?tid=187 http://askmonty.org/worklog/Server-Sprint/?tid=175
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 470590

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 470590

              People

              • Assignee:
                knielsen Kristian Nielsen
                Reporter:
                arjenlentz Arjen Lentz
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: