Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a partSize parameter. #537

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ type FlagStorage struct {
DebugFuse bool
DebugS3 bool
Foreground bool

// MPU
MPUPartSize uint64
}

func (flags *FlagStorage) GetMimeType(fileName string) (retMime *string) {
Expand Down
6 changes: 3 additions & 3 deletions internal/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ func (fh *FileHandle) partSize() uint64 {
var size uint64

if fh.lastPartId < 1000 {
size = 5 * 1024 * 1024
size = fh.inode.fs.flags.MPUPartSize
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior may confuse users. Instead, how about using a fixed size when provided by the flag and this gradually increasing size when not provided?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we can further discussing this after we accept this proposal

} else if fh.lastPartId < 2000 {
size = 25 * 1024 * 1024
size = 5 * fh.inode.fs.flags.MPUPartSize
} else {
size = 125 * 1024 * 1024
size = 5 * 5 * fh.inode.fs.flags.MPUPartSize
}

maxPartSize := fh.cloud.Capabilities().MaxMultipartSize
Expand Down
8 changes: 8 additions & 0 deletions internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ func NewApp() (app *cli.App) {
Usage: "GID owner of all inodes.",
},

cli.IntFlag{
Name: "MPUPartSize",
Value: 5 * 1024 * 1024,
Usage: "MPU part size.",
},
/////////////////////////
// S3
/////////////////////////
Expand Down Expand Up @@ -341,6 +346,9 @@ func PopulateFlags(c *cli.Context) (ret *FlagStorage) {
DebugFuse: c.Bool("debug_fuse"),
DebugS3: c.Bool("debug_s3"),
Foreground: c.Bool("f"),

// MPU
MPUPartSize: uint64(c.Int("MPUPartSize")),
}

// S3
Expand Down