mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
[Tiering] Support remote tiers with object versioning (#12342)
- Adds versioning support for S3 based remote tiers that have versioning enabled. This ensures that when reading or deleting we specify the specific version ID of the object. In case of deletion, this is important to ensure that the object version is actually deleted instead of simply being marked for deletion. - Stores the remote object's version id in the tier-journal. Tier-journal file version is not bumped up as serializing the new struct version is compatible with old journals without the remote object version id. - `storageRESTVersion` is bumped up as FileInfo struct now includes a `TransitionRemoteVersionID` member. - Azure and GCS support for this feature will be added subsequently. Co-authored-by: Krishnan Parthasarathi <krisis@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
41d4d650e4
commit
30a3921d3e
@@ -36,9 +36,9 @@ type WarmBackendGetOpts struct {
|
||||
|
||||
// WarmBackend provides interface to be implemented by remote tier backends
|
||||
type WarmBackend interface {
|
||||
Put(ctx context.Context, object string, r io.Reader, length int64) error
|
||||
Get(ctx context.Context, object string, opts WarmBackendGetOpts) (io.ReadCloser, error)
|
||||
Remove(ctx context.Context, object string) error
|
||||
Put(ctx context.Context, object string, r io.Reader, length int64) (remoteVersionID, error)
|
||||
Get(ctx context.Context, object string, rv remoteVersionID, opts WarmBackendGetOpts) (io.ReadCloser, error)
|
||||
Remove(ctx context.Context, object string, rv remoteVersionID) error
|
||||
InUse(ctx context.Context) (bool, error)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ const probeObject = "probeobject"
|
||||
// to perform all operations defined in the WarmBackend interface.
|
||||
func checkWarmBackend(ctx context.Context, w WarmBackend) error {
|
||||
var empty bytes.Reader
|
||||
err := w.Put(ctx, probeObject, &empty, 0)
|
||||
rv, err := w.Put(ctx, probeObject, &empty, 0)
|
||||
if err != nil {
|
||||
return tierPermErr{
|
||||
Op: tierPut,
|
||||
@@ -56,7 +56,7 @@ func checkWarmBackend(ctx context.Context, w WarmBackend) error {
|
||||
}
|
||||
}
|
||||
|
||||
_, err = w.Get(ctx, probeObject, WarmBackendGetOpts{})
|
||||
_, err = w.Get(ctx, probeObject, rv, WarmBackendGetOpts{})
|
||||
if err != nil {
|
||||
switch {
|
||||
case isErrBucketNotFound(err):
|
||||
@@ -71,7 +71,7 @@ func checkWarmBackend(ctx context.Context, w WarmBackend) error {
|
||||
}
|
||||
}
|
||||
|
||||
if err = w.Remove(ctx, probeObject); err != nil {
|
||||
if err = w.Remove(ctx, probeObject, rv); err != nil {
|
||||
return tierPermErr{
|
||||
Op: tierDelete,
|
||||
Err: err,
|
||||
@@ -115,6 +115,10 @@ func errIsTierPermError(err error) bool {
|
||||
return errors.As(err, &tpErr)
|
||||
}
|
||||
|
||||
// remoteVersionID represents the version id of an object in the remote tier.
|
||||
// Its usage is remote tier cloud implementation specific.
|
||||
type remoteVersionID string
|
||||
|
||||
// newWarmBackend instantiates the tier type specific WarmBackend, runs
|
||||
// checkWarmBackend on it.
|
||||
func newWarmBackend(ctx context.Context, tier madmin.TierConfig) (d WarmBackend, err error) {
|
||||
|
||||
Reference in New Issue
Block a user