storagenode/piecestore: respect maximum chunk size requests

See https://review.dev.storj.io/c/storj/common/+/10297 for
more details.

Change-Id: Id5d19f029ae872780a554874592679191c1b5b2f
This commit is contained in:
Jeff Wendling 2023-04-28 16:25:46 -04:00
parent 3f1166b5aa
commit 80b3edf1d1
7 changed files with 14 additions and 11 deletions

2
go.mod
View File

@ -59,7 +59,7 @@ require (
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
gopkg.in/segmentio/analytics-go.v3 v3.1.0
gopkg.in/yaml.v3 v3.0.1
storj.io/common v0.0.0-20230419134608-0971ce717d0c
storj.io/common v0.0.0-20230428200501-099739f940f7
storj.io/drpc v0.0.33-0.20230417171205-2ca712ef4ab5
storj.io/monkit-jaeger v0.0.0-20220915074555-d100d7589f41
storj.io/private v0.0.0-20230405095015-9e5bbc1c7ca8

4
go.sum
View File

@ -974,8 +974,8 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ=
storj.io/common v0.0.0-20230419134608-0971ce717d0c h1:v7SwkKqxtTp4w0tKpqeBu5d/8Dqd0Rxy/L1HT7O0qAY=
storj.io/common v0.0.0-20230419134608-0971ce717d0c/go.mod h1:j5YdcshmpJL+oW1+3IyBnCsv/HGbFkbzNDtuZg24KF0=
storj.io/common v0.0.0-20230428200501-099739f940f7 h1:2EIBMx6+bv52uY5eWE6GDFLOm5zwqkxu00jEDCTGp/E=
storj.io/common v0.0.0-20230428200501-099739f940f7/go.mod h1:j5YdcshmpJL+oW1+3IyBnCsv/HGbFkbzNDtuZg24KF0=
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
storj.io/drpc v0.0.33-0.20230417171205-2ca712ef4ab5 h1:4iOQovjXb6oAMLrjf0Qc4MuRRLd9hXC7+CWqOt+AzCw=
storj.io/drpc v0.0.33-0.20230417171205-2ca712ef4ab5/go.mod h1:vR804UNzhBa49NOJ6HeLjd2H3MakC1j5Gv8bsOQT6N4=

View File

@ -583,6 +583,11 @@ func (endpoint *Endpoint) Download(stream pb.DRPCPiecestore_DownloadStream) (err
"requested more that order limit allows, limit=%v requested=%v", limit.Limit, chunk.ChunkSize)
}
maximumChunkSize := 1 * memory.MiB.Int64()
if memory.KiB.Int32() < message.MaximumChunkSize && message.MaximumChunkSize < memory.MiB.Int32() {
maximumChunkSize = int64(message.MaximumChunkSize)
}
actionSeriesTag := monkit.NewSeriesTag("action", limit.Action.String())
remoteAddr := getRemoteAddr(ctx)
@ -692,8 +697,6 @@ func (endpoint *Endpoint) Download(stream pb.DRPCPiecestore_DownloadStream) (err
group, ctx := errgroup.WithContext(ctx)
group.Go(func() (err error) {
var maximumChunkSize = 1 * memory.MiB.Int64()
currentOffset := chunk.Offset
unsentAmount := chunk.ChunkSize

View File

@ -9,7 +9,7 @@ require (
github.com/zeebo/errs v1.3.0
go.uber.org/zap v1.21.0
golang.org/x/sync v0.1.0
storj.io/common v0.0.0-20230419134608-0971ce717d0c
storj.io/common v0.0.0-20230428200501-099739f940f7
storj.io/private v0.0.0-20230405095015-9e5bbc1c7ca8
storj.io/storj v1.63.1
storj.io/storjscan v0.0.0-20220926140643-1623c3b391b0

View File

@ -1229,8 +1229,8 @@ rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ=
storj.io/common v0.0.0-20230419134608-0971ce717d0c h1:v7SwkKqxtTp4w0tKpqeBu5d/8Dqd0Rxy/L1HT7O0qAY=
storj.io/common v0.0.0-20230419134608-0971ce717d0c/go.mod h1:j5YdcshmpJL+oW1+3IyBnCsv/HGbFkbzNDtuZg24KF0=
storj.io/common v0.0.0-20230428200501-099739f940f7 h1:2EIBMx6+bv52uY5eWE6GDFLOm5zwqkxu00jEDCTGp/E=
storj.io/common v0.0.0-20230428200501-099739f940f7/go.mod h1:j5YdcshmpJL+oW1+3IyBnCsv/HGbFkbzNDtuZg24KF0=
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
storj.io/drpc v0.0.33-0.20230417171205-2ca712ef4ab5 h1:4iOQovjXb6oAMLrjf0Qc4MuRRLd9hXC7+CWqOt+AzCw=
storj.io/drpc v0.0.33-0.20230417171205-2ca712ef4ab5/go.mod h1:vR804UNzhBa49NOJ6HeLjd2H3MakC1j5Gv8bsOQT6N4=

View File

@ -10,7 +10,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.2
go.uber.org/zap v1.23.0
storj.io/common v0.0.0-20230419134608-0971ce717d0c
storj.io/common v0.0.0-20230428200501-099739f940f7
storj.io/gateway-mt v1.51.1-0.20230417204402-7d9bb25bc297
storj.io/private v0.0.0-20230405095015-9e5bbc1c7ca8
storj.io/storj v0.12.1-0.20221125175451-ef4b564b82f7

View File

@ -1933,8 +1933,8 @@ sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ=
storj.io/common v0.0.0-20230419134608-0971ce717d0c h1:v7SwkKqxtTp4w0tKpqeBu5d/8Dqd0Rxy/L1HT7O0qAY=
storj.io/common v0.0.0-20230419134608-0971ce717d0c/go.mod h1:j5YdcshmpJL+oW1+3IyBnCsv/HGbFkbzNDtuZg24KF0=
storj.io/common v0.0.0-20230428200501-099739f940f7 h1:2EIBMx6+bv52uY5eWE6GDFLOm5zwqkxu00jEDCTGp/E=
storj.io/common v0.0.0-20230428200501-099739f940f7/go.mod h1:j5YdcshmpJL+oW1+3IyBnCsv/HGbFkbzNDtuZg24KF0=
storj.io/dotworld v0.0.0-20210324183515-0d11aeccd840 h1:oqMwoF6vaOrCe92SKRyr8cc2WSjLYAd8fjpAHA7rNqY=
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
storj.io/drpc v0.0.33-0.20230417171205-2ca712ef4ab5 h1:4iOQovjXb6oAMLrjf0Qc4MuRRLd9hXC7+CWqOt+AzCw=