From c22a767c81c25b93aae72c7b0c5a7565b09fa08f Mon Sep 17 00:00:00 2001 From: Aaron Son Date: Tue, 18 Nov 2025 12:13:42 -0800 Subject: [PATCH] go/store/nbs: Fix NomsBlockStore Conjoin against AWS S3 when the AWS S3 endpoint requires a Content-Length header. AWS Go SDK needs an io.ReadSeeker in the UploadPartInput in order to supply a Content-Length header. Supplying an io.MultiReader was resulting in an error. Fix this for now by making a temporary copy of the data and using a bytes.NewReader instead. --- go/store/nbs/aws_table_persister.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/go/store/nbs/aws_table_persister.go b/go/store/nbs/aws_table_persister.go index 5d9037b3dc..c60a0ff01e 100644 --- a/go/store/nbs/aws_table_persister.go +++ b/go/store/nbs/aws_table_persister.go @@ -373,10 +373,14 @@ func (s3p awsTablePersister) assembleTable(ctx context.Context, plan compactionP } else if end < lbuf { rdr = bytes.NewReader(buff[start:end]) } else { - rdr = io.MultiReader( - bytes.NewReader(buff[start:]), - bytes.NewReader(tail[:end-lbuf]), - ) + // UploadPart needs a ReadSeeker, so we can't use a simple + // io.MultiReader here. We can revisit this later, but for + // now we make an unquota'd copy of these two buffers which + // must live until the upload is done. + data := make([]byte, 0, len(buff[start:])+len(tail[:end-lbuf])) + data = append(data, buff[start:]...) + data = append(data, tail[:end-lbuf]...) + rdr = bytes.NewReader(data) } uploadWg.Add(1) go func(data io.Reader, partNum int32) {