diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..addec88 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.rocksdb +log +main +rocksdb-api \ No newline at end of file diff --git a/main.go b/main.go index 6437d3a..4a75265 100644 --- a/main.go +++ b/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)