• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dgraph-io / badger / 902
61%
main: 61%

Build:
Build:
LAST BUILD BRANCH: dependabot/github_actions/actions-eb8e6b6abe
DEFAULT BRANCH: main
Ran 21 Sep 2017 05:47AM UTC
Jobs 2
Files 21
Run time 9min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
902

push

travis-ci

manishrjain
Handle mmaping files on Windows

    Handle truncation while mmap-ing (esp. on Windows)

    mmap on Windows works differntly from mmap on Linux.

    * We cannot mmap to a size beyond the size of the file. So we need to
    truncate to that size and then map.

    * We cannot truncate a file while a section of it has been mapped.

    This has implications for how we manage value logs. This change fixes
    mmap-ing on Windows with the following changes:

    * When badger.NewKV() function is called, which in turn calls
    valueLog.Open() method, we don’t immediately mmap the writable log
    files (read-only log files are not a problem). We mmap the writable log
    after replay has happened.

    * Whenever the valueLog.iterate() method is called, and it determines
    that a file needs to be truncated - we need to either make sure that
    there are no open mmaps, or we need to munmap and then re-map the file
    after truncation.

    * Whenever a writable log file is mmap-ed, its size increases to
    ValueLogFileSize * 2 (because of truncation in y.Mmap() function). We
    need to ensure that once it has filled up, it is truncated back to the
    actual size before it is closed and opened as a read-only file. We also
    need to truncate if back if the value log is closed before it fills up.

    * Fix a few tests on AppVeyor that were running out of memory by
    reducing ValueLogFileSize option value.

    Fixes #212.

    * Only truncate if the file isn't mmapped.

    Fix mmap-ing on Windows.

    The previous code we checked in for mmap on Windows was broken. Cleaned
    up the code after looking at the way BoltDB does mmap-ing on Windows.

    The most important thing to note is that in Windows, unlike Linux we
    cannot map beyond the size of the file. So the workaround is to truncate
    the file to a bigger size before mmap-ing it. Special care needs to be
    taken when calling this function, because read-only file descriptors
    cannot be truncated.

3335 of 4241 relevant lines covered (78.64%)

62426.99 hits per line

Jobs
ID Job ID Ran Files Coverage
1 902.1 21 Sep 2017 05:47AM UTC 0
78.52
Travis Job 902.1
2 902.2 21 Sep 2017 05:57AM UTC 0
78.64
Travis Job 902.2
Source Files on build 902
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #902
  • 273f40c6 on github
  • Prev Build on master (#893)
  • Next Build on master (#934)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc