fix: ListColumnFamilies 先创建.rocksdb 和 default columnfamilies
This commit is contained in:
parent
5a6d78bfb9
commit
d08133a3a3
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
.rocksdb
|
||||
log
|
||||
main
|
||||
rocksdb-api
|
9
main.go
9
main.go
|
@ -63,9 +63,10 @@ func OpenDataBase() (*gorocksdb.DB, []*gorocksdb.ColumnFamilyHandle) {
|
|||
log.SetOutput(f)
|
||||
|
||||
log.Println(timeCFStr)
|
||||
names, err := gorocksdb.ListColumnFamilies(opts, "./.rocksdb")
|
||||
names, err := gorocksdb.ListColumnFamilies(opts, ".rocksdb")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Println(".rocksdb 文件不存在")
|
||||
names = append(names, "default")
|
||||
}
|
||||
|
||||
isadd := true
|
||||
|
@ -85,7 +86,7 @@ func OpenDataBase() (*gorocksdb.DB, []*gorocksdb.ColumnFamilyHandle) {
|
|||
|
||||
log.Println(names)
|
||||
|
||||
db, cfs, err := gorocksdb.OpenDbColumnFamilies(opts, "./.rocksdb", names, opslist)
|
||||
db, cfs, err := gorocksdb.OpenDbColumnFamilies(opts, ".rocksdb", names, opslist)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -96,7 +97,7 @@ func CreateData() {
|
|||
|
||||
db, cfs := OpenDataBase()
|
||||
|
||||
GCOUNT := 100
|
||||
GCOUNT := 10
|
||||
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(GCOUNT)
|
||||
|
|
Loading…
Reference in New Issue
Block a user