This commit is contained in:
Chris Lu 2019-07-21 21:51:38 -07:00
parent 79762385bd
commit 862c2cb8e6
6 changed files with 9 additions and 13 deletions

View file

@ -21,7 +21,7 @@ func init() {
} }
type LevelDB2Store struct { type LevelDB2Store struct {
dbs []*leveldb.DB dbs []*leveldb.DB
dbCount int dbCount int
} }
@ -46,7 +46,7 @@ func (store *LevelDB2Store) initialize(dir string, dbCount int) (err error) {
CompactionTableSizeMultiplier: 4, CompactionTableSizeMultiplier: 4,
} }
for d := 0 ; d < dbCount; d++ { for d := 0; d < dbCount; d++ {
dbFolder := fmt.Sprintf("%s/%02d", dir, d) dbFolder := fmt.Sprintf("%s/%02d", dir, d)
os.MkdirAll(dbFolder, 0755) os.MkdirAll(dbFolder, 0755)
db, dbErr := leveldb.OpenFile(dbFolder, opts) db, dbErr := leveldb.OpenFile(dbFolder, opts)
@ -204,5 +204,5 @@ func hashToBytes(dir string, dbCount int) ([]byte, int) {
x := b[len(b)-1] x := b[len(b)-1]
return b, int(x)%dbCount return b, int(x) % dbCount
} }

View file

@ -13,7 +13,7 @@ func TestCreateAndFind(t *testing.T) {
dir, _ := ioutil.TempDir("", "seaweedfs_filer_test") dir, _ := ioutil.TempDir("", "seaweedfs_filer_test")
defer os.RemoveAll(dir) defer os.RemoveAll(dir)
store := &LevelDB2Store{} store := &LevelDB2Store{}
store.initialize(dir,2) store.initialize(dir, 2)
filer.SetStore(store) filer.SetStore(store)
filer.DisableDirectoryCache() filer.DisableDirectoryCache()
@ -68,7 +68,7 @@ func TestEmptyRoot(t *testing.T) {
dir, _ := ioutil.TempDir("", "seaweedfs_filer_test2") dir, _ := ioutil.TempDir("", "seaweedfs_filer_test2")
defer os.RemoveAll(dir) defer os.RemoveAll(dir)
store := &LevelDB2Store{} store := &LevelDB2Store{}
store.initialize(dir,2) store.initialize(dir, 2)
filer.SetStore(store) filer.SetStore(store)
filer.DisableDirectoryCache() filer.DisableDirectoryCache()

View file

@ -101,9 +101,9 @@ func (s3a *S3ApiServer) completeMultipartUpload(ctx context.Context, input *s3.C
output = &CompleteMultipartUploadResult{ output = &CompleteMultipartUploadResult{
CompleteMultipartUploadOutput: s3.CompleteMultipartUploadOutput{ CompleteMultipartUploadOutput: s3.CompleteMultipartUploadOutput{
Location: aws.String(fmt.Sprintf("http://%s%s/%s", s3a.option.Filer, dirName, entryName)), Location: aws.String(fmt.Sprintf("http://%s%s/%s", s3a.option.Filer, dirName, entryName)),
Bucket: input.Bucket, Bucket: input.Bucket,
ETag: aws.String("\"" + filer2.ETag(finalParts) + "\""), ETag: aws.String("\"" + filer2.ETag(finalParts) + "\""),
Key: objectKey(input.Key), Key: objectKey(input.Key),
}, },
} }

View file

@ -151,4 +151,4 @@ func objectKey(key *string) *string {
return &t return &t
} }
return key return key
} }

View file

@ -49,12 +49,10 @@ func (c *commandFsMv) Do(args []string, commandEnv *CommandEnv, writer io.Writer
ctx := context.Background() ctx := context.Background()
sourceDir, sourceName := filer2.FullPath(sourcePath).DirAndName() sourceDir, sourceName := filer2.FullPath(sourcePath).DirAndName()
destinationDir, destinationName := filer2.FullPath(destinationPath).DirAndName() destinationDir, destinationName := filer2.FullPath(destinationPath).DirAndName()
return commandEnv.withFilerClient(ctx, filerServer, filerPort, func(client filer_pb.SeaweedFilerClient) error { return commandEnv.withFilerClient(ctx, filerServer, filerPort, func(client filer_pb.SeaweedFilerClient) error {
// collect destination entry info // collect destination entry info
@ -77,7 +75,6 @@ func (c *commandFsMv) Do(args []string, commandEnv *CommandEnv, writer io.Writer
targetName = destinationName targetName = destinationName
} }
request := &filer_pb.AtomicRenameEntryRequest{ request := &filer_pb.AtomicRenameEntryRequest{
OldDirectory: sourceDir, OldDirectory: sourceDir,
OldName: sourceName, OldName: sourceName,

View file

@ -34,7 +34,6 @@ type Topology struct {
Configuration *Configuration Configuration *Configuration
RaftServer raft.Server RaftServer raft.Server
} }
func NewTopology(id string, seq sequence.Sequencer, volumeSizeLimit uint64, pulse int) *Topology { func NewTopology(id string, seq sequence.Sequencer, volumeSizeLimit uint64, pulse int) *Topology {