shiichan

Amazon DocumentDB Finally Supports Retryable Writes: Say Goodbye to retryWrites=false!

Hi everyone, it's Shii-chan!

AWS What's New aws.amazon.com

Here's good news for anyone building MongoDB-compatible apps: Amazon DocumentDB now supports retryable writes!

What was announced?

AWS What's New announced that Amazon DocumentDB (with MongoDB compatibility) supports retryable writes starting with engine version 8.0.2.

With retryable writes, the MongoDB driver automatically retries certain write operations once if a transient error occurs, such as a network interruption or a primary failover.

The story so far

Most current MongoDB-compatible drivers enable retryable writes by default. But DocumentDB versions before 8.0.2 didn't support it, so to avoid errors you had to set retryWrites=false in the connection string.

What changes

Applications connecting to 8.0.2 no longer need retryWrites=false. You can enable the capability without additional code changes, which makes it easier to build apps that handle transient write failures during failovers.

Dive Deep

Here's the scope and what to watch out for.

  • Supported: all write commands except updateMany and deleteMany, plus transaction commit and abort commands
  • Available on: Amazon DocumentDB 8.0.2 instance-based and serverless clusters
  • Regions: all regions where Amazon DocumentDB 8.0 is available
  • Engine versions earlier than 8.0.2 still don't support it, so it must stay disabled there

If you run a mix of older and 8.0.2 clusters, be careful with your connection string settings. The Amazon DocumentDB developer guide has the details.

Wrap-up

  • Retryable writes are supported from engine version 8.0.2
  • The driver automatically retries certain writes once on transient errors and failovers
  • retryWrites=false is no longer needed on 8.0.2
  • updateMany and deleteMany are not covered
  • Earlier versions still need it disabled

This one is for anyone running DocumentDB with MongoDB-compatible drivers!