Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoLevelDB/dbstress: More verbosity, minor fixes. #240

Closed
wants to merge 4 commits into from
Closed
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
21 changes: 11 additions & 10 deletions goleveldb/manualtest/dbstress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import (
)

var (
dbPath = path.Join(os.TempDir(), "goleveldb-testdb")
src cryptoSource
dbPath = path.Join(os.TempDir(), strconv.Itoa(rand.New(src).Int()%9999), strconv.Itoa(rand.New(src).Int()%9999), "-goleveldb-testdb")
openFilesCacheCapacity = 500
keyLen = 63
valueLen = 256
Expand Down Expand Up @@ -155,13 +156,13 @@ type testingStorage struct {
func (ts *testingStorage) scanTable(fd storage.FileDesc, checksum bool) (corrupted bool) {
r, err := ts.Open(fd)
if err != nil {
log.Fatal(err)
panic(fmt.Sprintf("testingStorage scanTable Open failure: %v", err))
}
defer r.Close()

size, err := r.Seek(0, os.SEEK_END)
if err != nil {
log.Fatal(err)
panic(fmt.Sprintf("testingStorage scanTable Seek failure: %v", err))
}

o := &opt.Options{
Expand All @@ -173,7 +174,7 @@ func (ts *testingStorage) scanTable(fd storage.FileDesc, checksum bool) (corrupt
}
tr, err := table.NewReader(r, size, fd, nil, bpool, o)
if err != nil {
log.Fatal(err)
panic(fmt.Sprintf("testingStorage scanTable NewReader failure: %v", err))
}
defer tr.Release()

Expand Down Expand Up @@ -225,7 +226,7 @@ func (ts *testingStorage) scanTable(fd storage.FileDesc, checksum bool) (corrupt

log.Printf("FATAL: [%v] Corruption detected: %v", fd, err)
} else {
log.Fatal(err)
panic(fmt.Sprintf("Panic: iter.Error: err: %v, fd: %v", err, fd))
}
}

Expand Down Expand Up @@ -314,17 +315,17 @@ func main() {
runtime.SetBlockProfileRate(1)
go func() {
if err := http.ListenAndServe(httpProf, nil); err != nil {
log.Fatalf("HTTPPROF: %v", err)
panic(fmt.Sprintf("Panic: HTTPPROF: %v", err))
}
}()
}

runtime.GOMAXPROCS(runtime.NumCPU())
runtime.GOMAXPROCS(runtime.NumCPU()*2)

os.RemoveAll(dbPath)
stor, err := storage.OpenFile(dbPath, false)
if err != nil {
log.Fatal(err)
panic(fmt.Sprintf("Panic: OpenFile: %v", err))
}
tstor := &testingStorage{stor}
defer tstor.Close()
Expand Down Expand Up @@ -362,7 +363,7 @@ func main() {

db, err := leveldb.Open(tstor, o)
if err != nil {
log.Fatal(err)
panic(fmt.Sprintf("leveldb.Open failure: %v", err))
}
defer db.Close()

Expand Down Expand Up @@ -645,7 +646,7 @@ func (s cryptoSource) Int63() int64 {
func (s cryptoSource) Uint64() (v uint64) {
err := binary.Read(crand.Reader, binary.BigEndian, &v)
if err != nil {
log.Fatal(err)
panic(fmt.Sprintf("Panic: cryptoSource: CSPRNG failure", err))
}
return v
}