Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG/CHANGELOG-1.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
- [Add support for data file size limit](https://github.com/etcd-io/bbolt/pull/929)
- [Remove the unused txs list](https://github.com/etcd-io/bbolt/pull/973)
- [Add option `NoStatistics` to make the statistics optional](https://github.com/etcd-io/bbolt/pull/977)
- [Move panic handling from goroutine to the parent function](https://github.com/etcd-io/bbolt/pull/1153)

<hr>
13 changes: 8 additions & 5 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -1253,13 +1253,16 @@ func (db *DB) freepages() []common.Pgid {
reachable := make(map[common.Pgid]*common.Page)
nofreed := make(map[common.Pgid]bool)
ech := make(chan error)

go func() {
for e := range ech {
panic(fmt.Sprintf("freepages: failed to get all reachable pages (%v)", e))
}
defer close(ech)
tx.recursivelyCheckBucket(&tx.root, reachable, nofreed, HexKVStringer(), ech)
}()
tx.recursivelyCheckBucket(&tx.root, reachable, nofreed, HexKVStringer(), ech)
close(ech)
// following for loop will exit once channel is closed in the above goroutine.
// we don't need to wait explictly with a waitgroup
for e := range ech {
panic(fmt.Sprintf("freepages: failed to get all reachable pages (%v)", e))
}

// TODO: If check bucket reported any corruptions (ech) we shouldn't proceed to freeing the pages.

Expand Down
Loading