Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions pkg/storage/s3storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (s *S3StorageInteractor) CatFileFromStorage(name string, offset int64, sett
return nil, err
}
input := &s3.GetObjectInput{
Bucket: &bucket,
Bucket: aws.String(bucket),
Key: aws.String(objectPath),
Range: aws.String(fmt.Sprintf("bytes=%d-", offset)),
}
Expand Down Expand Up @@ -346,14 +346,25 @@ func (s *S3StorageInteractor) SScopyObject(from, to, fromStoragePrefix, fromStor
to = path.Join(s.cnf.StoragePrefix, to)
}
to = strings.TrimLeft(to, "/")

sourceInput := &s3.HeadObjectInput{
Bucket: aws.String(fromStorageBucket),
Key: aws.String(from),
}
sourceObject, err := sess.HeadObject(sourceInput)
if err != nil {
return err
}

from = path.Join(fromStorageBucket, from)

ylogger.Zero.Debug().Str("to", to).Str("from", from).Msg("requesting server-side copy")

inp := s3.CopyObjectInput{
Bucket: &toStorageBucket,
CopySource: aws.String(from),
Key: aws.String(to),
Bucket: &toStorageBucket,
CopySource: aws.String(from),
Key: aws.String(to),
StorageClass: sourceObject.StorageClass,
}

_, err = sess.CopyObject(&inp)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1
Object: {Name: "/red_red_file", size: 13}
Object: {Name: "/trash/segments_005/seg0/basebackups_005/yezzey/red_red_file", size: 13}
Storage: REDUCED_REDUNDANCY
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -ex

echo 'garbage data' | yp-client --config test/regress/conf/yproxy_vacuum.yaml -l fatal put --storage-class REDUCED_REDUNDANCY 'red_red_file'
yp-client --config test/regress/conf/yproxy_vacuum.yaml -l fatal list ''
yp-client --config test/regress/conf/yproxy_vacuum.yaml -l fatal delete --garbage --confirm --port 5432 --segnum 0 'red_red_file'
yp-client --config test/regress/conf/yproxy_vacuum.yaml -l fatal list ''

s3cmd --access_key some_key --secret_key some_key --host minio:9000 --host-bucket '' --no-ssl info s3://gpyezzey/trash/segments_005/seg0/basebackups_005/yezzey/red_red_file | grep Storage