tecbot / gorocksdb

gorocksdb is a Go wrapper for RocksDB

Home Page:http://rocksdb.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A strange blocking problem when reconnecting an existing dB.

af913337456 opened this issue · comments

commented

When my program safely exits after running for some time, it calls“ db.stop ”Class. Then when you run the same program again, 100% of them will be blocked when connecting to the database. It will be blocked for a long time, and finally you have to delete the entire database directory to recover.

connected code below:

func NewDefaultRocksNormalDb(dataDir string) (*gorocksdb.DB, error) {
	rateLimiter := defaultRateLimiter()
	opts := gorocksdb.NewDefaultOptions()
	opts.SetRateLimiter(rateLimiter)
	opts.SetCreateIfMissing(true)
	db, err := gorocksdb.OpenDb(opts, dataDir)  // break point tells me, it will block here
	if err != nil {
		return nil, fmt.Errorf("NewDefaultRocksNormalDb failed: (%s)", err.Error())
	}
	return db, nil
}

key words:

  1. After a long run, stop the program;
  2. run again

some pictures 👇

commented

image

commented

image