Skip to content

Commit

Permalink
fix: inject more specific error message for bolt on shared FS (#20489)
Browse files Browse the repository at this point in the history
  • Loading branch information
danxmoran authored Jan 11, 2021
1 parent 1bae673 commit 1fa321d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Replacement `tsi1` indexes will be automatically generated on startup for shards
1. [20442](https://github.com/influxdata/influxdb/pull/20442): Don't return 500 codes for partial write failures.
1. [20440](https://github.com/influxdata/influxdb/pull/20440): Add confirmation step w/ file sizes before copying data files in `influxd upgrade`.
1. [20409](https://github.com/influxdata/influxdb/pull/20409): Improve messages in DBRP API validation errors.
1. [20489](https://github.com/influxdata/influxdb/pull/20489): Improve error message when opening BoltDB with unsupported file system options.

## v2.0.3 [2020-12-14]

Expand Down
11 changes: 10 additions & 1 deletion bolt/bbolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@ func (c *Client) Open(ctx context.Context) error {
// Open database file.
db, err := bolt.Open(c.Path, 0600, &bolt.Options{Timeout: 1 * time.Second})
if err != nil {
return fmt.Errorf("unable to open boltdb; is there a chronograf already running? %v", err)
// Hack to give a slightly nicer error message for a known failure mode when bolt calls
// mmap on a file system that doesn't support the MAP_SHARED option.
//
// See: https://github.com/boltdb/bolt/issues/272
// See: https://stackoverflow.com/a/18421071
if err.Error() == "invalid argument" {
return fmt.Errorf("unable to open boltdb: mmap of %q may not support the MAP_SHARED option", c.Path)
}

return fmt.Errorf("unable to open boltdb: %w", err)
}
c.db = db

Expand Down

0 comments on commit 1fa321d

Please sign in to comment.