Repository navigation
Respect the DynamoDB scan page size - #1538
dajiaohuang wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Invalid input bypasses the stream error channel, and publisher cancellation lacks regression coverage.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Updates DynamoDB scans to honor configured page sizes and cancel publishers when streams end.
Changes:
- Applies
pageSizeto scan requests. - Requests one response at a time with backpressure.
- Adds page-size regression coverage and updates the parallel-scan example.
| File | Description |
|---|---|
DynamoParallelScan.scala |
Passes the configured page size unchanged. |
StreamScanSpec.scala |
Verifies page sizing and complete results. |
StreamScan.scala |
Enforces request limits, demand, validation, and cancellation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| pageSize: Int | ||
| ): Stream[F, Chunk[JMap[String, AttributeValue]]] = | ||
| for { | ||
| if (pageSize <= 0) throw new IllegalArgumentException("pageSize must be greater than 0") |
There was a problem hiding this comment.
Updated invalid page-size validation to Stream.raiseError and added two tests using an observable publisher subscription: invalid sizes are captured by attempt, and take(1) invokes cancel(). The project compiles and both StreamScanCancellationSuite tests pass with sbt 1.13.0 / Scala 3.3.8. The standard formatting task is blocked by the existing incompatible AsciiSortImports / Imports(sort=original) configuration; I have kept that unrelated config unchanged.
|
Thanks! Happy to help. |


Change
Set the DynamoDB request limit from
pageSize, request one scan response at a time, and cancel the publisher when the FS2 stream ends. The parallel-scan example now passes its configured page size through unchanged.Validation
Prior DynamoDB compilation and both StreamScanCancellationSuite tests passed: nonpositive pageSize fails through Stream.raiseError, and early take(1) invokes cancel(). The LocalStack page-size/full-result assertion was added; it is not represented as an executed LocalStack acceptance test. This reassessment reuses the delivered focused test evidence; no new test run claimed.
Standard scalafmt was blocked by the existing incompatible import-rewrite configuration; no formatter success claimed.