Dynamodb hard
A 'Poison Pill' record in a DynamoDB Stream (a record that crashes the consumer Lambda) is blocking the shard. What is the most robust way to recover without losing data?
- A Delete the entire DynamoDB table and restore from backup.
- B Enable `BisectBatchOnFunctionError`: This causes the Lambda service to split the failing batch into two halves and retry them separately, recursively isolating and discarding only the single failing record while processing the rest.
- C Manually delete the poison record from the stream using the CLI.
- D Increase the Lambda's memory to 10GB to force-process the bad data.
Answer: B. Enable `BisectBatchOnFunctionError`: This causes the Lambda service to split the failing batch into two halves and retry them separately, recursively isolating and discarding only the single failing record while processing the rest.
In a stream, order is guaranteed. If record #5 fails, records #6-100 are blocked. Bisecting is a built-in 'Search' algorithm that finds the failure. Combined with a `DestinationConfig` (Dead Letter Queue), you can dump the bad record to SQS for manual inspection while allowing the stream to proceed.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- DynamoDB has a strict 400KB limit on the size of a single item. What is the recommended design pattern if you need to store larger documents (e.g., 5MB PDFs)?
- What is the primary role of the 'Partition Key' in ensuring DynamoDB's infinite horizontal scalability?
- Why is the `Query` operation generally preferred over `Scan` for production workloads in DynamoDB?
- DynamoDB is a 'fully managed' serverless database. What is a primary operational benefit of this model for an engineering team?
- In 'Provisioned Capacity' mode, how is the performance budget of a DynamoDB table defined?
- When would an architect choose to implement DAX (DynamoDB Accelerator) in front of an existing DynamoDB table?