mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
filer: leveldb, rocksdb auto create store directory
fix https://github.com/chrislusf/seaweedfs/issues/1901
This commit is contained in:
parent
6d3a96eb56
commit
2d4c2db81d
|
@ -8,6 +8,7 @@ import (
|
||||||
leveldb_errors "github.com/syndtr/goleveldb/leveldb/errors"
|
leveldb_errors "github.com/syndtr/goleveldb/leveldb/errors"
|
||||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||||
leveldb_util "github.com/syndtr/goleveldb/leveldb/util"
|
leveldb_util "github.com/syndtr/goleveldb/leveldb/util"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/filer"
|
"github.com/chrislusf/seaweedfs/weed/filer"
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
|
@ -38,6 +39,7 @@ func (store *LevelDBStore) Initialize(configuration weed_util.Configuration, pre
|
||||||
|
|
||||||
func (store *LevelDBStore) initialize(dir string) (err error) {
|
func (store *LevelDBStore) initialize(dir string) (err error) {
|
||||||
glog.Infof("filer store dir: %s", dir)
|
glog.Infof("filer store dir: %s", dir)
|
||||||
|
os.MkdirAll(dir, 0755)
|
||||||
if err := weed_util.TestFolderWritable(dir); err != nil {
|
if err := weed_util.TestFolderWritable(dir); err != nil {
|
||||||
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
|
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ func (store *LevelDB2Store) Initialize(configuration weed_util.Configuration, pr
|
||||||
|
|
||||||
func (store *LevelDB2Store) initialize(dir string, dbCount int) (err error) {
|
func (store *LevelDB2Store) initialize(dir string, dbCount int) (err error) {
|
||||||
glog.Infof("filer store leveldb2 dir: %s", dir)
|
glog.Infof("filer store leveldb2 dir: %s", dir)
|
||||||
|
os.MkdirAll(dir, 0755)
|
||||||
if err := weed_util.TestFolderWritable(dir); err != nil {
|
if err := weed_util.TestFolderWritable(dir); err != nil {
|
||||||
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
|
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ func (store *LevelDB3Store) Initialize(configuration weed_util.Configuration, pr
|
||||||
|
|
||||||
func (store *LevelDB3Store) initialize(dir string) (err error) {
|
func (store *LevelDB3Store) initialize(dir string) (err error) {
|
||||||
glog.Infof("filer store leveldb3 dir: %s", dir)
|
glog.Infof("filer store leveldb3 dir: %s", dir)
|
||||||
|
os.MkdirAll(dir, 0755)
|
||||||
if err := weed_util.TestFolderWritable(dir); err != nil {
|
if err := weed_util.TestFolderWritable(dir); err != nil {
|
||||||
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
|
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/tecbot/gorocksdb"
|
"github.com/tecbot/gorocksdb"
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ func (store *RocksDBStore) Initialize(configuration weed_util.Configuration, pre
|
||||||
|
|
||||||
func (store *RocksDBStore) initialize(dir string) (err error) {
|
func (store *RocksDBStore) initialize(dir string) (err error) {
|
||||||
glog.Infof("filer store rocksdb dir: %s", dir)
|
glog.Infof("filer store rocksdb dir: %s", dir)
|
||||||
|
os.MkdirAll(dir, 0755)
|
||||||
if err := weed_util.TestFolderWritable(dir); err != nil {
|
if err := weed_util.TestFolderWritable(dir); err != nil {
|
||||||
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
|
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue