Skip to content

Commit

Permalink
Fix version pagination by adding default batch size
Browse files Browse the repository at this point in the history
**Issue:**

We realised that whilst bumping `aws-sdk-go-v2/services/s3` to version
`1.44.0` we found a breaking change where a default value for `MaxKeys`
in the `ListObjectVersionsInput` struct was being set to `0`, resulting
in 0 versions being returned. It should have been `1 000`.

```
input := &s3.ListObjectVersionsInput{
	Bucket:  aws.String("tf-acc-test-7828939106372858870"),
	MaxKeys: aws.Int32(1000),
}
```

More details: aws/aws-sdk-go-v2#2379

**Workaround:**

We are explicitly setting the `MaxKeys` to `1_000` as it should be.

[#186503787]

Signed-off-by: Diego Lemos <dlemos@vmware.com>
  • Loading branch information
Konstantin Semenov authored and dlresende committed Nov 23, 2023
1 parent f4ab685 commit 1340c0b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/s3-blobstore-backup-restore/s3bucket/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ func (b Bucket) ListVersions() ([]Version, error) {
var versions []Version

paginator := s3.NewListObjectVersionsPaginator(b.s3Client, &s3.ListObjectVersionsInput{
Bucket: aws.String(b.name),
Bucket: aws.String(b.name),
MaxKeys: aws.Int32(1000),
})

for paginator.HasMorePages() {
Expand Down

0 comments on commit 1340c0b

Please sign in to comment.