mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 10:57:51 +00:00
add linux OS check and the way mmap limit is read
This commit is contained in:
parent
8c36da9eeb
commit
927db378b4
2 changed files with 14 additions and 10 deletions
2
lattice
2
lattice
|
|
@ -1 +1 @@
|
|||
Subproject commit 36f453c1ea3bf86c546a8ad4a88f2a926724d683
|
||||
Subproject commit 28c2313ecfcd7e083d42d4e409483e968b4c421b
|
||||
|
|
@ -23,16 +23,16 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/binary"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
|
@ -154,13 +154,17 @@ func (m *Command) Start() (err error) {
|
|||
return errors.Wrap(err, "setting up server")
|
||||
}
|
||||
|
||||
result, err := exec.Command("sysctl", "vm.max_map_count").Output()
|
||||
if err != nil {
|
||||
m.logger.Printf("Tried unsuccessfully to check system mmap limit: %v", err)
|
||||
} else {
|
||||
sysMmapLimit := binary.BigEndian.Uint64(result)
|
||||
if m.Config.MaxMapCount > sysMmapLimit {
|
||||
m.logger.Printf("WARNING: Config max map limit (%v) is greater than current system limits (%v)", m.Config.MaxMapCount, sysMmapLimit)
|
||||
if runtime.GOOS == "linux" {
|
||||
result, err := ioutil.ReadFile("/proc/sys/vm/max_map_count")
|
||||
if err != nil {
|
||||
m.logger.Printf("Tried unsuccessfully to check system mmap limit: %v", err)
|
||||
} else {
|
||||
sysMmapLimit, err := strconv.ParseUint(strings.TrimSuffix(string(result), "\n"), 10, 64)
|
||||
if err != nil {
|
||||
m.logger.Printf("Tried unsuccessfully to check system mmap limit: %v", err)
|
||||
} else if m.Config.MaxMapCount > sysMmapLimit {
|
||||
m.logger.Printf("WARNING: Config max map limit (%v) is greater than current system limits (%v)", m.Config.MaxMapCount, sysMmapLimit)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue