mirror of
https://github.com/minio/minio.git
synced 2025-02-03 09:55:59 -05:00
Fix cleanup of pipe in GetObjectNInfo handlers (#6509)
This commit is contained in:
parent
36e51d0cee
commit
3c8fabd116
@ -259,7 +259,8 @@ func (c cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string,
|
||||
}()
|
||||
|
||||
cleanupBackend := func() { bkReader.Close() }
|
||||
gr = NewGetObjectReaderFromReader(teeReader, bkReader.ObjInfo, cleanupBackend)
|
||||
cleanupPipe := func() { pipeReader.Close() }
|
||||
gr = NewGetObjectReaderFromReader(teeReader, bkReader.ObjInfo, cleanupBackend, cleanupPipe)
|
||||
return gr, nil
|
||||
}
|
||||
|
||||
|
@ -634,7 +634,10 @@ func (a *azureObjects) GetObjectNInfo(ctx context.Context, bucket, object string
|
||||
err := a.GetObject(ctx, bucket, object, startOffset, length, pw, objInfo.ETag, minio.ObjectOptions{})
|
||||
pw.CloseWithError(err)
|
||||
}()
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo), nil
|
||||
// Setup cleanup function to cause the above go-routine to
|
||||
// exit in case of partial read
|
||||
pipeCloser := func() { pr.Close() }
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo, pipeCloser), nil
|
||||
}
|
||||
|
||||
// GetObject - reads an object from azure. Supports additional
|
||||
|
@ -414,7 +414,10 @@ func (l *b2Objects) GetObjectNInfo(ctx context.Context, bucket, object string, r
|
||||
err := l.GetObject(ctx, bucket, object, startOffset, length, pw, objInfo.ETag, minio.ObjectOptions{})
|
||||
pw.CloseWithError(err)
|
||||
}()
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo), nil
|
||||
// Setup cleanup function to cause the above go-routine to
|
||||
// exit in case of partial read
|
||||
pipeCloser := func() { pr.Close() }
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo, pipeCloser), nil
|
||||
}
|
||||
|
||||
// GetObject reads an object from B2. Supports additional
|
||||
|
@ -755,7 +755,10 @@ func (l *gcsGateway) GetObjectNInfo(ctx context.Context, bucket, object string,
|
||||
err := l.GetObject(ctx, bucket, object, startOffset, length, pw, objInfo.ETag, minio.ObjectOptions{})
|
||||
pw.CloseWithError(err)
|
||||
}()
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo), nil
|
||||
// Setup cleanup function to cause the above go-routine to
|
||||
// exit in case of partial read
|
||||
pipeCloser := func() { pr.Close() }
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo, pipeCloser), nil
|
||||
}
|
||||
|
||||
// GetObject - reads an object from GCS. Supports additional
|
||||
|
@ -525,7 +525,10 @@ func (t *tritonObjects) GetObjectNInfo(ctx context.Context, bucket, object strin
|
||||
err := t.GetObject(ctx, bucket, object, startOffset, length, pw, objInfo.ETag, minio.ObjectOptions{})
|
||||
pw.CloseWithError(err)
|
||||
}()
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo), nil
|
||||
// Setup cleanup function to cause the above go-routine to
|
||||
// exit in case of partial read
|
||||
pipeCloser := func() { pr.Close() }
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo, pipeCloser), nil
|
||||
}
|
||||
|
||||
// GetObject - Reads an object from Manta. Supports additional parameters like
|
||||
|
@ -565,7 +565,10 @@ func (l *ossObjects) GetObjectNInfo(ctx context.Context, bucket, object string,
|
||||
err := l.GetObject(ctx, bucket, object, startOffset, length, pw, objInfo.ETag, minio.ObjectOptions{})
|
||||
pw.CloseWithError(err)
|
||||
}()
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo), nil
|
||||
// Setup cleanup function to cause the above go-routine to
|
||||
// exit in case of partial read
|
||||
pipeCloser := func() { pr.Close() }
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo, pipeCloser), nil
|
||||
}
|
||||
|
||||
// GetObject reads an object on OSS. Supports additional
|
||||
|
@ -346,7 +346,10 @@ func (l *s3Objects) GetObjectNInfo(ctx context.Context, bucket, object string, r
|
||||
err := l.GetObject(ctx, bucket, object, startOffset, length, pw, objInfo.ETag, minio.ObjectOptions{})
|
||||
pw.CloseWithError(err)
|
||||
}()
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo), nil
|
||||
// Setup cleanup function to cause the above go-routine to
|
||||
// exit in case of partial read
|
||||
pipeCloser := func() { pr.Close() }
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo, pipeCloser), nil
|
||||
}
|
||||
|
||||
// GetObject reads an object from S3. Supports additional
|
||||
|
@ -450,7 +450,10 @@ func (s *siaObjects) GetObjectNInfo(ctx context.Context, bucket, object string,
|
||||
err := s.GetObject(ctx, bucket, object, startOffset, length, pw, objInfo.ETag, minio.ObjectOptions{})
|
||||
pw.CloseWithError(err)
|
||||
}()
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo), nil
|
||||
// Setup cleanup function to cause the above go-routine to
|
||||
// exit in case of partial read
|
||||
pipeCloser := func() { pr.Close() }
|
||||
return minio.NewGetObjectReaderFromReader(pr, objInfo, pipeCloser), nil
|
||||
}
|
||||
|
||||
func (s *siaObjects) GetObject(ctx context.Context, bucket string, object string, startOffset int64, length int64, writer io.Writer, etag string, opts minio.ObjectOptions) error {
|
||||
|
@ -211,8 +211,11 @@ func (xl xlObjects) GetObjectNInfo(ctx context.Context, bucket, object string, r
|
||||
err := xl.getObject(ctx, bucket, object, off, length, pw, "", ObjectOptions{})
|
||||
pw.CloseWithError(err)
|
||||
}()
|
||||
// Cleanup function to cause the go routine above to exit, in
|
||||
// case of incomplete read.
|
||||
pipeCloser := func() { pr.Close() }
|
||||
|
||||
return fn(pr, h)
|
||||
return fn(pr, h, pipeCloser)
|
||||
}
|
||||
|
||||
// GetObject - reads an object erasured coded across multiple
|
||||
|
Loading…
x
Reference in New Issue
Block a user