From c901d0fb32a412a8ce21cac41e11e7162ac0e7cb Mon Sep 17 00:00:00 2001 From: "Frederick F. Kautz IV" Date: Fri, 27 Mar 2015 23:49:04 -0700 Subject: [PATCH] Fix for readers closing in erasure early --- pkg/storage/donut/erasure.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/storage/donut/erasure.go b/pkg/storage/donut/erasure.go index 459984fd2..8a5f34bb7 100644 --- a/pkg/storage/donut/erasure.go +++ b/pkg/storage/donut/erasure.go @@ -15,6 +15,7 @@ import ( "github.com/minio-io/minio/pkg/encoding/erasure" "github.com/minio-io/minio/pkg/utils/split" "hash" + "log" ) // getErasureTechnique - convert technique string into Technique type @@ -75,6 +76,7 @@ func erasureReader(readers []io.ReadCloser, donutMetadata map[string]string, wri } encoder := erasure.NewEncoder(params) for i := 0; i < totalChunks; i++ { + log.Println(i) totalLeft, err = decodeChunk(writer, readers, encoder, hasher, k, m, totalLeft, blockSize) if err != nil { errParams := map[string]string{ @@ -106,7 +108,6 @@ func decodeChunk(writer *io.PipeWriter, readers []io.ReadCloser, encoder *erasur curChunkSize := erasure.GetEncodedBlockLen(curBlockSize, uint8(k)) encodedBytes := make([][]byte, 16) for i, reader := range readers { - defer reader.Close() var bytesBuffer bytes.Buffer written, err := io.CopyN(&bytesBuffer, reader, int64(curChunkSize)) if err != nil {