boltoption_unix.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2015 CoreOS, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // +build linux
  15. package backend
  16. import (
  17. "syscall"
  18. "github.com/coreos/etcd/Godeps/_workspace/src/github.com/boltdb/bolt"
  19. )
  20. // syscall.MAP_POPULATE on linux 2.6.23+ does sequential read-ahead
  21. // which can speed up entire-database read with boltdb. We want to
  22. // enable MAP_POPULATE for faster key-value store recovery in storage
  23. // package. If your kernel version is lower than 2.6.23
  24. // (https://github.com/torvalds/linux/releases/tag/v2.6.23), mmap might
  25. // silently ignore this flag. Please update your kernel to prevent this.
  26. var boltOpenOptions = &bolt.Options{
  27. MmapFlags: syscall.MAP_POPULATE,
  28. InitialMmapSize: int(InitialMmapSize),
  29. }