Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #970 from codysoyland/release-v0.8.1
Browse files Browse the repository at this point in the history
Release v0.8.1
  • Loading branch information
codysoyland authored Nov 15, 2017
2 parents fbd5f16 + a595d80 commit 0d4b790
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 20 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions diagnostics/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
5 changes: 5 additions & 0 deletions diagnostics/diagnostics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
22 changes: 13 additions & 9 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
10 changes: 7 additions & 3 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
}

Expand Down

0 comments on commit 0d4b790

Please sign in to comment.