Skip to content

Commit

Permalink
cmd/bosun: fix for migration when nothing exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Peterson committed Feb 9, 2016
1 parent 150a576 commit 02dcb89
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/bosun/sched/bolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ func decode(db *bolt.DB, name string, dst interface{}) error {
if err != nil {
return err
}
if len(data) == 0 {
return nil
}
gr, err := gzip.NewReader(bytes.NewReader(data))
if err != nil {
return err
Expand Down Expand Up @@ -584,7 +587,8 @@ func isMigrated(db *bolt.DB, name string) (bool, error) {
err := db.View(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(dbBucket))
if b == nil {
return fmt.Errorf("unknown bucket: %v", dbBucket)
found = true
return nil
}
if dat := b.Get([]byte("isMigrated:" + name)); dat != nil {
found = true
Expand Down

0 comments on commit 02dcb89

Please sign in to comment.