From 92a9f2e200e83fd0b3ddef177f9a454b0273c17e Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Tue, 27 May 2014 11:31:55 -0600 Subject: Remove DB.Check(). Allow read-only Tx.Check(). This commit removes the DB.Check() function and instead makes the user decide whether a transaction should be writable or read-only. Tx.Check() is not safe to use concurrently on a read-only transaction, however, it significantly improves the performance of it. --- cmd/bolt/check.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd/bolt') diff --git a/cmd/bolt/check.go b/cmd/bolt/check.go index ec2ea69..1436aba 100644 --- a/cmd/bolt/check.go +++ b/cmd/bolt/check.go @@ -21,7 +21,12 @@ func Check(path string) { defer db.Close() // Perform consistency check. - if err := db.Check(); err != nil { + err = db.View(func(tx *bolt.Tx) error { + return tx.Check() + }) + + // Print out any errors that occur. + if err != nil { if errors, ok := err.(bolt.ErrorList); ok { for _, err := range errors { println(err) -- cgit v1.2.3