Commit Graph

12 Commits (514ec57fe7d7855cafc2599bbce43646a19b417c)

Author SHA1 Message Date
Ben Johnson 694a82a959 Merge branch 'grow' of https://github.com/xiang90/bolt into xiang90-grow 2016-01-11 14:47:01 -07:00
Gyu-Ho Lee d97579c399 Add MmapFlags option for MAP_POPULATE (unix)
This adds MmapFlags to DB.Options in case we need syscall.MAP_POPULATE
flag in Linux 2.6.23+ to do the sequential read-ahead, as discussed in [1].

---

[1]: https://github.com/coreos/etcd/issues/3786
2015-11-08 18:07:10 -08:00
Xiang Li e67705ed63 do not grow dbsize agressively
Only grow the database size when the high watermark increases.
We also grows the database size a little bit aggressively to
save a few ftruncates.

I have tested this on various environments. The performance impact
is ignorable with 16MB over allocation. Without over allocation,
the performance might decrease 100% when each Tx.Commit needs a new
page on a very slow disk (seek time dominates the total write).
2015-11-06 09:39:17 -08:00
Ken Sedgwick 2f4ba1c533 solaris: fix issues with mmap, munmap, madvise and flock 2015-08-21 14:44:13 -07:00
Ben Johnson 88f777f332 Add madvise() after mmap().
This commit advises the mmapped data file to use MADV_RANDOM to avoid
readahead. This can provide a performance boost to Bolt databases that
are larger than memory by avoiding unnecessary disk i/o.
2015-06-02 13:04:44 -06:00
sasha-s aa13f7f94f make ignoring Truncate() explicit
https://github.com/boltdb/bolt/pull/371#issuecomment-103176330
2015-05-18 12:00:40 -07:00
sasha-s fda75748b5 use a shared lock in read-only mode
https://github.com/boltdb/bolt/pull/371#issuecomment-103119486
2015-05-18 11:07:19 -07:00
sasha-s 019bf5b010 open read-only databases in read-only mode 2015-05-14 15:43:13 -07:00
Ben Johnson b107b35f19 Add DB.NoGrowSync flag.
This commit adds the DB.NoGrowSync flag to optionally revert mmap()
calls to how they were implemented before the ext3/ext4 fix. When
NoGrowSync is true, remapping the data file will not force the file
system to resize it immediately. This works for non-ext3/4 file
systems.

The default value of NoGrowSync is false so it is still safe for
ext3/ext4 file systems by default.

See also: https://github.com/boltdb/bolt/issues/284
2015-05-06 09:23:32 -06:00
Ben Johnson 6bb25854a1 Add truncate() and sync() on resize.
This commit fixes an issue with ext3/ext4 filesystems where metadata file size is not synced
when resizing a file. It also resizes the entire resize instead of updating the size during
individual page writes.

Thanks to @tv42 for the fix.
2015-01-18 08:24:53 -07:00
Dave Collins 8cdba50ea1 Rework build to support more liberal unix variants.
Rather than having the build setup such that it will only work on the
specifically defined operating systems, this commit modifies it to use
more liberal !windows,!plan9 build tag for the unix specific bits.

This means bolt will compile on more Operating Systems such as OpenBSD,
FreeBSD, and NetBSD.

See boltdb/bolt#257 for discussion.
2014-09-18 14:04:59 -05:00
Ben Johnson 00ee0da528 Add Open() options, flock timeout.
This commit changes Open() to provide an additional Options argument. The options
argument currently only has a Timeout which will cause the Open() to return
ErrTimeout if a file lock cannot be obtained in time.

Fixes #207.
2014-06-21 14:44:28 -06:00