Skip to content

v0.3.0

Latest

Choose a tag to compare

@github-actions github-actions released this 27 May 14:00
93b8cdd

Changed

  • 🛠 Migrated from aws-sdk-go (v1, end-of-support as of v1.55.8) to aws-sdk-go-v2 (#22). New() now accepts *dynamodb.Client from github.com/aws/aws-sdk-go-v2/service/dynamodb instead of *dynamodb.DynamoDB from github.com/aws/aws-sdk-go. Attribute marshaling moves to feature/dynamodb/attributevalue. AttributeValue becomes an interface with types.AttributeValueMember* concrete members. ExpressionAttributeNames is now map[string]string, since v2 dropped *string. Errors are matched with errors.As against *types.ConditionalCheckFailedException and *types.ResourceInUseException instead of awserr.Error.Code(). Queries page through dynamodb.NewQueryPaginator. Every *WithContext method collapses to its ctx-first equivalent.

    Action required. Build clients with the v2 SDK and pass them to ddbds.New:

    // before
    sess := session.Must(session.NewSession(&aws.Config{Region: aws.String("us-east-1")}))
    ddbDS := ddbds.New(dynamodb.New(sess), "datastore-table")
    
    // after
    cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion("us-east-1"))
    if err != nil {
        return err
    }
    ddbDS := ddbds.New(dynamodb.NewFromConfig(cfg), "datastore-table")
  • Bumped non-AWS direct dependencies: go-datastore v0.8.2 to v0.9.1, go-log/v2 v2.5.1 to v2.9.2, testify v1.10.0 to v1.11.1.

Fixed

  • Scan worker no longer panics on Scan errors. v1 returned a zero-value response on error, so the post-error iteration over res.Items was harmless; v2 returns nil and the iteration crashed. The worker now sends the error and returns. d2b4528
  • Batch commit no longer races on a shared *rand.Rand. Jitter uses math/rand/v2, whose top-level functions are safe for concurrent use. f93f955
  • Put on a sort-key table returns ErrInvalidKey for keys with too few namespaces, instead of panicking in putKey with "assignment to entry in nil map". 669f8e7
  • Batch retry backoff stops when the Commit context is cancelled. Used to sleep through the full backoff. d1a78a5
  • Batch retry exhaustion error reads "batch had unprocessed items after N attempts" instead of the previous last error: %!w(<nil>) produced by wrapping a nil error with %w. When a real error is present it is still wrapped as last error: <err>. 9f93267 52addd0
  • DiskUsage and EntryCount nil-check res.Table and use aws.ToInt64 for the *int64 fields, instead of dereferencing them blindly. 3538832
  • Query no longer relies on an unchecked type assertion on the partition-key AttributeValue. queryKey now returns the value directly. 95e0498
  • Batch Commit no longer deadlocks when cancelled mid-retry. The internal error channel is buffered to the chunk count, so the chunk goroutine's deferred send always completes without racing against <-ctx.Done(). b7486ea
  • SetTTL works on tables whose partition key has been renamed via WithPartitionkey. The UpdateItem request used to include a stray DSKey attribute and DynamoDB rejected every call with ValidationException. c1a28ca

Full Changelog: v0.2.2...v0.3.0

Note

This release was brought to you by the Shipyard team.