Add missing unlock, run debug endpoint in benchmark

This commit is contained in:
Fabian Reinartz 2017-03-02 21:53:11 +01:00
parent 21b97d1e04
commit ffb24a98f4
3 changed files with 7 additions and 1 deletions

View File

@ -5,6 +5,8 @@ import (
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http"
_ "net/http/pprof"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
@ -21,6 +23,9 @@ import (
) )
func main() { func main() {
// Start HTTP server for pprof endpoint.
go http.ListenAndServe(":9999", nil)
root := &cobra.Command{ root := &cobra.Command{
Use: "tsdb", Use: "tsdb",
Short: "CLI tool for tsdb", Short: "CLI tool for tsdb",

1
db.go
View File

@ -229,6 +229,7 @@ func (db *DB) compact() error {
select { select {
case <-db.stopc: case <-db.stopc:
db.mtx.RUnlock()
return nil return nil
default: default:
} }

2
wal.go
View File

@ -58,7 +58,7 @@ type WAL struct {
const ( const (
walDirName = "wal" walDirName = "wal"
walSegmentSizeBytes = 64 * 1000 * 1000 // 64 MB walSegmentSizeBytes = 256 * 1024 * 1024 // 256 MB
) )
// OpenWAL opens or creates a write ahead log in the given directory. // OpenWAL opens or creates a write ahead log in the given directory.