Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-22271

Invalid use of MS_ASYNC in msync() call

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.3.2
    • Affects Version/s: None
    • Component/s: MMAPv1, Storage
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Integration F (02/01/16), Integration 10 (02/22/16)

      I was taking a look through some old code momentarily today, and noticed an invalid use of msync(). I'm not sure how many people are using the old V1 storage implementation these days, but worth knowing about nonetheless.

      mongo/src/mongo/db/storage/mmap_v1/mmap_posix.cpp:271 calls msync() with an option to use MS_ASYNC or MS_SYNC based on the "bool sync" parameter.

      Unfortunately for everyone involved, MS_ASYNC is a no-op since the late 2.6 Linux days (as background sync is always enabled). So this doesn't expedite the process of flushing. Instead, the best option (if flushing is really that necessary under the async case) is probably to spawn a thread and perform the msync(MS_SYNC) there.

      Cheers!

      – Christian Hergert

            Assignee:
            kyle.suarez@mongodb.com Kyle Suarez
            Reporter:
            chergert Christian Hergert
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: