mirror of
https://github.com/minio/minio.git
synced 2025-01-14 08:15:01 -05:00
fix: support prefix when batchJob replicate enable the snowball (#20178)
This commit is contained in:
parent
a60267501d
commit
c87a489514
@ -540,7 +540,7 @@ func toObjectInfo(bucket, object string, objInfo miniogo.ObjectInfo) ObjectInfo
|
|||||||
return oi
|
return oi
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r BatchJobReplicateV1) writeAsArchive(ctx context.Context, objAPI ObjectLayer, remoteClnt *minio.Client, entries []ObjectInfo) error {
|
func (r BatchJobReplicateV1) writeAsArchive(ctx context.Context, objAPI ObjectLayer, remoteClnt *minio.Client, entries []ObjectInfo, prefix string) error {
|
||||||
input := make(chan minio.SnowballObject, 1)
|
input := make(chan minio.SnowballObject, 1)
|
||||||
opts := minio.SnowballOptions{
|
opts := minio.SnowballOptions{
|
||||||
Opts: minio.PutObjectOptions{},
|
Opts: minio.PutObjectOptions{},
|
||||||
@ -562,6 +562,10 @@ func (r BatchJobReplicateV1) writeAsArchive(ctx context.Context, objAPI ObjectLa
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if prefix != "" {
|
||||||
|
entry.Name = pathJoin(prefix, entry.Name)
|
||||||
|
}
|
||||||
|
|
||||||
snowballObj := minio.SnowballObject{
|
snowballObj := minio.SnowballObject{
|
||||||
// Create path to store objects within the bucket.
|
// Create path to store objects within the bucket.
|
||||||
Key: entry.Name,
|
Key: entry.Name,
|
||||||
@ -1135,7 +1139,7 @@ func (r *BatchJobReplicateV1) Start(ctx context.Context, api ObjectLayer, job Ba
|
|||||||
batch := make([]ObjectInfo, 0, *r.Source.Snowball.Batch)
|
batch := make([]ObjectInfo, 0, *r.Source.Snowball.Batch)
|
||||||
writeFn := func(batch []ObjectInfo) {
|
writeFn := func(batch []ObjectInfo) {
|
||||||
if len(batch) > 0 {
|
if len(batch) > 0 {
|
||||||
if err := r.writeAsArchive(ctx, api, cl, batch); err != nil {
|
if err := r.writeAsArchive(ctx, api, cl, batch, r.Target.Prefix); err != nil {
|
||||||
batchLogOnceIf(ctx, err, job.ID+"writeAsArchive")
|
batchLogOnceIf(ctx, err, job.ID+"writeAsArchive")
|
||||||
for _, b := range batch {
|
for _, b := range batch {
|
||||||
slowCh <- itemOrErr[ObjectInfo]{Item: b}
|
slowCh <- itemOrErr[ObjectInfo]{Item: b}
|
||||||
|
Loading…
Reference in New Issue
Block a user