-
Notifications
You must be signed in to change notification settings - Fork 102
storage: extend the ExternalStorage
interface and implements
#446
Conversation
/run-all-tests |
1 similar comment
/run-all-tests |
pkg/storage/flags.go
Outdated
func DefineFlags(flags *pflag.FlagSet) { | ||
defineS3Flags(flags) | ||
DefineS3Flags(flags) | ||
defineGCSFlags(flags) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the rationale of only exposing S3 but not GCS?
@kennytm Shall we change the |
@glorv we don't really need those flags since they can be passed via URL parameters ( Given that pflag refuses to support |
// FIXME: we test in minio, when request with Range, the result.AcceptRanges is a bare string 'range', | ||
// not sure whether this is a feature or bug | ||
//if rangeOffset != nil && (result.AcceptRanges == nil || *result.AcceptRanges != *rangeOffset) { | ||
// return nil, errors.Errorf("open file '%s' failed, expected range: %s, got: %v", | ||
// name, *rangeOffset, result.AcceptRanges) | ||
//} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we tested in AWS S3?
// export for test. | ||
func NewLocalStorage(base string) (*LocalStorage, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used in lightning tests
pkg/storage/s3.go
Outdated
return realOffset, nil | ||
} | ||
|
||
// if seek ahead no more than 64k, we read add drop these data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// if seek ahead no more than 64k, we read add drop these data | |
// if seek ahead no more than 64k, we discard these data |
pkg/storage/s3.go
Outdated
return 0, err | ||
} | ||
|
||
newReader, err := r.storage.open(context.Background(), r.name, realOffset, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid use Background context.
/run-all-tests |
1 similar comment
/run-all-tests |
LGTM |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
/run-all-tests |
…ap#446) * update storage * update * fix * export s3 flags * fix local path * fix s3 reader * fix range offset * fix the req range errors * fix comments * fix review comments * fix some comments * update * fix * update Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
…#462) * update storage * update * fix * export s3 flags * fix local path * fix s3 reader * fix range offset * fix the req range errors * fix comments * fix review comments * fix some comments * update * fix * update Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com> Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
What problem does this PR solve?
extend the
ExternalStorage
interface and implement the new methods for local and s3 storage. This extension is currently used in lightning to support restore from s3 storage.What is changed and how it works?
Add new methods for ExternalStorage:
Since s3 GetObject does not provide seek directly, we implement this by: 1) read and skip the bytes if the distance is small, else we open a new reader set the start position to the seek position.
Check List
Tests
Code changes
Side effects
Related changes
Release Note