Browse Source

filer: leveldb, rocksdb auto create store directory

fix https://github.com/chrislusf/seaweedfs/issues/1901
pull/1905/head
Chris Lu 4 years ago
parent
commit
2d4c2db81d
  1. 2
      weed/filer/leveldb/leveldb_store.go
  2. 1
      weed/filer/leveldb2/leveldb2_store.go
  3. 1
      weed/filer/leveldb3/leveldb3_store.go
  4. 2
      weed/filer/rocksdb/rocksdb_store.go

2
weed/filer/leveldb/leveldb_store.go

@ -8,6 +8,7 @@ import (
leveldb_errors "github.com/syndtr/goleveldb/leveldb/errors"
"github.com/syndtr/goleveldb/leveldb/opt"
leveldb_util "github.com/syndtr/goleveldb/leveldb/util"
"os"
"github.com/chrislusf/seaweedfs/weed/filer"
"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) {
glog.Infof("filer store dir: %s", dir)
os.MkdirAll(dir, 0755)
if err := weed_util.TestFolderWritable(dir); err != nil {
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
}

1
weed/filer/leveldb2/leveldb2_store.go

@ -38,6 +38,7 @@ func (store *LevelDB2Store) Initialize(configuration weed_util.Configuration, pr
func (store *LevelDB2Store) initialize(dir string, dbCount int) (err error) {
glog.Infof("filer store leveldb2 dir: %s", dir)
os.MkdirAll(dir, 0755)
if err := weed_util.TestFolderWritable(dir); err != nil {
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
}

1
weed/filer/leveldb3/leveldb3_store.go

@ -45,6 +45,7 @@ func (store *LevelDB3Store) Initialize(configuration weed_util.Configuration, pr
func (store *LevelDB3Store) initialize(dir string) (err error) {
glog.Infof("filer store leveldb3 dir: %s", dir)
os.MkdirAll(dir, 0755)
if err := weed_util.TestFolderWritable(dir); err != nil {
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
}

2
weed/filer/rocksdb/rocksdb_store.go

@ -8,6 +8,7 @@ import (
"crypto/md5"
"fmt"
"io"
"os"
"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) {
glog.Infof("filer store rocksdb dir: %s", dir)
os.MkdirAll(dir, 0755)
if err := weed_util.TestFolderWritable(dir); err != nil {
return fmt.Errorf("Check Level Folder %s Writable: %s", dir, err)
}

Loading…
Cancel
Save