mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-10 21:07:53 +00:00
commit
0d4b79068f
6 changed files with 42 additions and 20 deletions
|
|
@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [0.8.1] - 2017-11-15
|
||||
|
||||
This version contains 2 contributions from 2 contributors. There are 4 files changed, 27 insertions, and 14 deletions.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix CountOpenFiles() fatal crash ([#969](https://github.com/pilosa/pilosa/pull/969))
|
||||
- Fix version check when local is greater than pilosa.com ([#968](https://github.com/pilosa/pilosa/pull/968))
|
||||
|
||||
## [0.8.0] - 2017-11-15
|
||||
|
||||
This version contains 31 contributions from 8 contributors. There are 84 files changed, 3,732 insertions, and 1,428 deletions.
|
||||
|
|
|
|||
|
|
@ -172,9 +172,9 @@ func (d *Diagnostics) CompareVersion(value string) error {
|
|||
|
||||
if localVersion[0] < currentVersion[0] { //Major
|
||||
return fmt.Errorf("Warning: You are running Pilosa %s. A newer version (%s) is available: https://github.com/pilosa/pilosa/releases", d.version, value)
|
||||
} else if localVersion[1] < currentVersion[1] { // Minor
|
||||
} else if localVersion[1] < currentVersion[1] && localVersion[0] == currentVersion[0] { // Minor
|
||||
return fmt.Errorf("Warning: You are running Pilosa %s. The latest Minor release is %s: https://github.com/pilosa/pilosa/releases", d.version, value)
|
||||
} else if localVersion[2] < currentVersion[2] { // Patch
|
||||
} else if localVersion[2] < currentVersion[2] && localVersion[0] == currentVersion[0] && localVersion[1] == currentVersion[1] { // Patch
|
||||
return fmt.Errorf("There is a new patch release of Pilosa available: %s: https://github.com/pilosa/pilosa/releases", value)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,11 @@ func TestDiagnosticsVersion_Compare(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("Versions should match")
|
||||
}
|
||||
d.SetVersion("v1.7.0")
|
||||
err = d.CompareVersion("0.7.2")
|
||||
if err != nil {
|
||||
t.Fatalf("Local version is greater")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDiagnosticsVersion_Check(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -74,19 +74,19 @@ There are four ways to install Pilosa on MacOS: Use [Homebrew](https://brew.sh/)
|
|||
|
||||
1. Download the latest release:
|
||||
```
|
||||
curl -L -O https://github.com/pilosa/pilosa/releases/download/v0.8.0/pilosa-v0.8.0-darwin-amd64.tar.gz
|
||||
curl -L -O https://github.com/pilosa/pilosa/releases/download/v0.8.1/pilosa-v0.8.1-darwin-amd64.tar.gz
|
||||
```
|
||||
|
||||
Other releases can be downloaded from our Releases page on Github.
|
||||
|
||||
2. Extract the binary:
|
||||
```
|
||||
tar xfz pilosa-v0.8.0-darwin-amd64.tar.gz
|
||||
tar xfz pilosa-v0.8.1-darwin-amd64.tar.gz
|
||||
```
|
||||
|
||||
3. Move the binary into your PATH so you can run `pilosa` from any shell:
|
||||
```
|
||||
cp -i pilosa-v0.8.0-darwin-amd64/pilosa /usr/local/bin
|
||||
cp -i pilosa-v0.8.1-darwin-amd64/pilosa /usr/local/bin
|
||||
```
|
||||
|
||||
4. Make sure Pilosa is installed successfully:
|
||||
|
|
@ -228,19 +228,19 @@ There are three ways to install Pilosa on Linux: download the binary (recommende
|
|||
|
||||
1. To install the latest version of Pilosa, download the latest release:
|
||||
```
|
||||
curl -L -O https://github.com/pilosa/pilosa/releases/download/v0.8.0/pilosa-v0.8.0-linux-amd64.tar.gz
|
||||
curl -L -O https://github.com/pilosa/pilosa/releases/download/v0.8.1/pilosa-v0.8.1-linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
Note: This assumes you are using an `amd64` compatible architecture. Other releases can be downloaded from our Releases page on Github.
|
||||
|
||||
2. Extract the binary:
|
||||
```
|
||||
tar xfz pilosa-v0.8.0-linux-amd64.tar.gz
|
||||
tar xfz pilosa-v0.8.1-linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
3. Move the binary into your PATH so you can run `pilosa` from any shell:
|
||||
```
|
||||
cp -i pilosa-v0.8.0-linux-amd64/pilosa /usr/local/bin
|
||||
cp -i pilosa-v0.8.1-linux-amd64/pilosa /usr/local/bin
|
||||
```
|
||||
|
||||
4. Make sure Pilosa is installed successfully:
|
||||
|
|
|
|||
22
server.go
22
server.go
|
|
@ -534,7 +534,10 @@ func (s *Server) monitorDiagnostics() {
|
|||
s.diagnostics.Set("NumIndexes", len(s.Holder.Indexes()))
|
||||
s.diagnostics.Set("NumFrames", numFrames)
|
||||
s.diagnostics.Set("NumSlices", numSlices)
|
||||
s.diagnostics.Set("OpenFiles", CountOpenFiles())
|
||||
openFiles, err := CountOpenFiles()
|
||||
if err == nil {
|
||||
s.diagnostics.Set("OpenFiles", openFiles)
|
||||
}
|
||||
s.diagnostics.Set("GoRoutines", runtime.NumGoroutine())
|
||||
s.diagnostics.CheckVersion()
|
||||
s.diagnostics.Flush()
|
||||
|
|
@ -584,8 +587,11 @@ func (s *Server) monitorRuntime() {
|
|||
// Record the number of go routines.
|
||||
s.Holder.Stats.Gauge("goroutines", float64(runtime.NumGoroutine()), 1.0)
|
||||
|
||||
openFiles, err := CountOpenFiles()
|
||||
// Open File handles.
|
||||
s.Holder.Stats.Gauge("OpenFiles", float64(CountOpenFiles()), 1.0)
|
||||
if err == nil {
|
||||
s.Holder.Stats.Gauge("OpenFiles", float64(openFiles), 1.0)
|
||||
}
|
||||
|
||||
// Runtime memory metrics.
|
||||
runtime.ReadMemStats(&m)
|
||||
|
|
@ -606,26 +612,24 @@ func (s *Server) createDefaultClient() {
|
|||
}
|
||||
|
||||
// CountOpenFiles on operating systems that support lsof.
|
||||
func CountOpenFiles() int {
|
||||
count := 0
|
||||
|
||||
func CountOpenFiles() (int, error) {
|
||||
switch runtime.GOOS {
|
||||
case "darwin", "linux", "unix", "freebsd":
|
||||
// -b option avoid kernel blocks
|
||||
pid := os.Getpid()
|
||||
out, err := exec.Command("/bin/sh", "-c", fmt.Sprintf("lsof -b -p %v", pid)).Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return 0, fmt.Errorf("calling lsof: %s", err)
|
||||
}
|
||||
// only count lines with our pid, avoiding warning messages from -b
|
||||
lines := strings.Split(string(out), strconv.Itoa(pid))
|
||||
count = len(lines)
|
||||
return len(lines), nil
|
||||
case "windows":
|
||||
// TODO: count open file handles on windows
|
||||
return 0, errors.New("CountOpenFiles() on Windows is not supported")
|
||||
default:
|
||||
|
||||
return 0, errors.New("CountOpenFiles() on this OS is not supported")
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// StatusHandler specifies two methods which an object must implement to share
|
||||
|
|
|
|||
|
|
@ -373,10 +373,14 @@ func tempMkdir(t *testing.T) string {
|
|||
func TestCountOpenFiles(t *testing.T) {
|
||||
// Windows is not supported yet
|
||||
if runtime.GOOS == "windows" {
|
||||
return
|
||||
t.Skip("Skipping unsupported CountOpenFiles test on Windows.")
|
||||
}
|
||||
if pilosa.CountOpenFiles() == 0 {
|
||||
t.Error("Invalid open file handle count")
|
||||
count, err := pilosa.CountOpenFiles()
|
||||
if err != nil {
|
||||
t.Errorf("CountOpenFiles failed: %s", err)
|
||||
}
|
||||
if count == 0 {
|
||||
t.Error("CountOpenFiles returned invalid value 0.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue