Introducing a new way to review your PRs.

Read the announcement

floci-io / floci

Light, fluffy, and always free - The AWS Local Emulator alternative

View on GitHub

38 documents · Updated Nov 23, 2026

docs / svc-dynamodb

DynamoDB tables and streams

Floci provides a DynamoDB-compatible service for table metadata, keyed items, alternate reads, expressions, projections, validation, and change streams. Clients use DynamoDB JSON values within an account and Region scope. Successful item changes can feed DynamoDB Streams and a separate Kinesis delivery path for downstream consumers. Durable state follows the storage backend, exports use S3, and event-driven consumers can connect through EventBridge and Step Functions or the Lambda execution platform.

Service boundary

The DynamoDB service exposes one data model through JSON actions and typed service calls. A native path uses Floci state. A Local path forwards requests to DynamoDB Local while preserving the public table and stream identity. Both paths apply the same table and item concepts where their capabilities overlap.

Request boundary

The public boundary maps an action and JSON document to a response or an AWS-style error. It covers table control, item access, query and scan, transactions, PartiQL, vector search, backups, recovery, imports, exports, and stream-related settings.

This diagram shows the common request path from a client to table state or an external Local engine.

flowchart LR
    A[JSON action] --> B[Account and Region scope]
    B --> C{Execution path}
    C -->|native| D[Shape and semantic validation]
    D --> E[Table and item state]
    C -->|Local| F[DynamoDB Local]
    E --> G[Response or AWS error]
    F --> G

References: src/…/NativeDynamoDbJsonHandler.java• L114-173 src/…/NativeDynamoDbBackend.java• L98-116

Backend selection

The backend choice hides where table and item data runs. Native calls use Floci storage. Local calls use an external DynamoDB Local endpoint while preserving the public table and stream identity expected by callers. Local requests translate public table and stream ARNs into DynamoDB Local's fixed namespace, then translate response fields back to the caller's account and Region.

The selected engine is fixed when the service starts. Native calls expose the JSON handlers and typed table access under the request account and Region. Local calls use DynamoDB Local for its supported operations while Floci keeps compatibility state that the external engine does not provide. Transaction-conflict emulation is a native-only option, so enabling it with the Local backend is rejected during selection. Java stream consumers use process-lived checkpoints with the native engine and stream-lived checkpoints with Local.

References: src/…/DynamoDbBackendSelector.java• L11-75 src/…/NativeDynamoDbBackend.java• L29-35 src/…/NativeDynamoDbBackend.java• L98-116

Service lifecycle

The selected backend owns startup, reset, and shutdown. Native startup loads durable table and item state, rebuilds stream metadata and in-process stream buffers, recovers jobs, and starts the TTL sweep. Reset clears native process state and stream records while durable table and item data remains until a table or recovery operation removes it. Stream sequence counters remain monotonic across a native reset. The Local backend cannot reset external data through Floci.

Native stream history and transaction-conflict marks are process state. A reset removes both, while a Local stream keeps its history outside the Floci process. Shutdown stops TTL work and Kinesis delivery before the final storage flush.

References: src/…/NativeDynamoDbBackend.java• L60-95 src/…/DynamoDbService.java• L362-382 src/…/DynamoDbStreamService.java• L224-237 src/…/DynamoDbBackendSelector.java• L67-75

Table identity

Most actions accept a short table name or a table ARN. The service resolves the name and checks that the resource belongs to the request's DynamoDB service, account, partition, and Region. CreateTable requires a short name so the stored table identity remains canonical. Item calls can resolve a table ARN, but they reject index and stream ARNs and reject an ARN whose Region differs from the request.

Resource tags follow the table named by a table ARN. An index ARN resolves to the tags of its table, which lets authorization and resource inspection use the same table-owned metadata for both resources.

References: src/…/DynamoDbTableNames.java• L25-86 src/…/DynamoDbTableNames.java• L89-131 src/…/DynamoDbStoredResourceArns.java• L12-40 src/…/DynamoDbTableAccess.java• L64-69

Protocol responses

The response boundary keeps wire concerns separate from table behavior. Modern JSON responses use the DynamoDB JSON media shape and carry an X-Amz-Crc32 header computed from the serialized response bytes. Legacy errors use the 2011-12-05 error namespace. SDK clients can therefore validate response integrity without changing table rules.

The native path can randomize the order of top-level attributes and nested map members in responses whose order is not part of the DynamoDB contract. Lists and sets keep their order. This behavior is enabled by default and applies to returned values, failed-condition items, and transaction result items; clients must use attribute names rather than JSON member position.

References: src/…/DynamoDbJsonHandler.java• L17-53 src/…/DynamoDbLegacyProtocol.java• L18-37 src/…/DynamoDbResponses.java• L24-93 src/…/DynamoDbAttributeOrder.java• L12-74 src/…/EmulatorConfig.java• L1791-1803

Request validation

Validation protects the API contract before the service reads or changes data. Shape validation checks the JSON type of known members. Semantic validation then checks values, schemas, expressions, projections, cursors, nesting, and size limits. The service keeps modern expression forms separate from legacy forms and rejects requests that mix them where DynamoDB does not allow the mix.

The validation order is part of the client contract. Deep or incomplete update requests can use an older validation path so required members, legacy fields, and expression fields fail in the expected order. Unknown members are ignored by shape checks. JSON null acts as an absent member for many shape checks.

References: src/…/DynamoDbRequestShapes.java• L61-95 src/…/NativeDynamoDbJsonHandler.java• L655-723 src/…/NativeDynamoDbJsonHandler.java• L843-875

Authorization condition context

The service derives DynamoDB IAM condition values from the request before authorization. This context describes leading partition-key values, attributes the request reads or changes, and the effective selection mode. It covers native actions, legacy forms, batch and transaction members, and PartiQL statements where the request can be understood.

The extractor is best effort. If a key or expression cannot be resolved, it omits that value rather than inventing one. Policies that require a resolved value must use the matching null guard.

References: src/…/DynamoDbConditionKeys.java• L43-182 src/…/DynamoDbConditionKeys.java• L184-269 src/…/DynamoDbConditionKeyMembers.java• L14-87

Table and index model

A table definition is the shared description of item identity and alternate access. It holds the base key schema, attribute types, secondary indexes, billing settings, stream settings, recovery settings, and other table state used by reads, writes, capacity, and change records.

Table definitions

The base table has a partition-key schema and may have sort-key attributes. Attribute definitions describe the attributes used by the table and its indexes. Table creation checks that schemas and definitions agree before it stores the table. The stored definition also carries TTL, recovery, encryption, replica, tag, and resource-policy state that describes the table to other service features.

Billing mode separates provisioned capacity from on-demand use. Provisioned table and global secondary index capacity counts against account and per-resource limits. On-demand tables use warm capacity values instead of those provisioned quotas. Table updates apply the same capacity checks before changing the definition.

References: src/…/TableDefinition.java• L21-67 src/…/DynamoDbService.java• L498-714 src/…/NativeDynamoDbTableService.java• L105-177 src/…/DynamoDbService.java• L2519-2685

Secondary indexes

Global secondary indexes and local secondary indexes provide alternate access to the same table items. A global secondary index can use a different partition key and can describe composite partition or sort-key parts. A local secondary index keeps the table partition key and uses a different sort key. PartiQL rejects an index with more than one attribute in either key part.

Each index stores a projection of the base item:

  • ALL stores the full item.
  • KEYS_ONLY stores key attributes.
  • INCLUDE stores keys and named non-key attributes.

An index is sparse. An item is absent from the index when any of its index-key attributes is missing or has a DynamoDB NULL value. A partial global index cannot return or filter on an attribute that it does not project. A local index can fetch a selected non-projected attribute from the base item, but its filter still sees the index view.

References: src/…/TableDefinition.java• L330-362 src/…/GlobalSecondaryIndex.java• L91-123 src/…/DynamoDbService.java• L692-717 src/…/DynamoDbAccessPathValidator.java• L79-125 src/…/DynamoDbPartiQLHandler.java• L47-66

Access paths

An access path is the common read model for the base table or one secondary index. Query and scan resolve the selected path before they validate key conditions, projections, consistency, and pagination. The path keeps all partition-key and sort-key attributes in schema order.

The cursor for a table read contains the table key. The cursor for an index read contains the index key and the base table key. This lets the service resume in a stable order when several items share an index key. A scan of the table also checks starting-key values against the table's secondary indexes so an invalid index key is not accepted by accident.

References: src/…/DynamoDbAccessPathValidator.java• L171-247 src/…/DynamoDbAccessPathValidator.java• L534-615 src/…/DynamoDbService.java• L1593-1669

Key placement and ordering

The native service assigns items to a stable logical partition count derived from billing mode and orders ties on an index with the remaining base-table key values. This preserves DynamoDB-like scan segmentation and deterministic results when several items share an index key. Numeric key values use a normalized numeric byte form so equivalent number text has the same placement.

References: src/…/DynamoDbKeyHash.java• L20-62 src/…/DynamoDbKeyHash.java• L64-118

Contributor Insights

Contributor Insights tracks access and throttle patterns for a table or global secondary index. Its state belongs to the table definition, so the service can describe one target or list enabled targets without changing item access. A local secondary index is not a monitoring target.

Enabling a target creates its monitoring state. Re-enabling an enabled target keeps its creation time unless the mode changes. Disabling removes it from enabled listings while describe calls report it as disabled.

References: src/…/TableDefinition.java• L65-67 src/…/DynamoDbService.java• L2940-3053 src/…/NativeDynamoDbJsonHandler.java• L2098-2225

Vector indexes

A vector index defines search over a vector attribute. It declares the vector dimension, distance rule, optional search fields, and result projection. An index created with its table is active. An index added later moves through allocation and backfill before search can use it.

Writes validate a vector when the item has the vector attribute. An item without the vector or a required search field remains valid table data but does not join the vector index. Table and index status show the build state as callers observe the table.

References: src/…/DynamoDbService.java• L698-899 src/…/NativeDynamoDbJsonHandler.java• L303-324 src/…/NativeDynamoDbJsonHandler.java• L1641-1654

Item access paths

Item operations address one item by its complete base key or read a set of items through a table or index access path. The service validates the path and values first. It then selects and filters items before it shapes the response.

Keyed item operations

PutItem, GetItem, UpdateItem, and DeleteItem use the full base-table key. A table with sort-key attributes requires every key attribute. Writes normalize numbers, validate index keys on the resulting item, reject key changes, and publish side effects only after the item change succeeds.

An update can use an expression or the legacy attribute-update form. Conditions run against the item under its item lock. A failed condition leaves the item unchanged and can return the old item when requested. If an update operand needs a missing attribute or the wrong type, the service returns a validation error; the same problem inside a transaction becomes a member cancellation reason.

Native deployments can optionally model contention between transactions. With this setting enabled, a committed write transaction keeps its items busy for a short window. An overlapping single-item write fails with TransactionConflictException, while an overlapping write or read transaction receives a TransactionConflict cancellation reason. GetItem is not blocked by this emulation, and the setting is not available with the Local backend.

References: src/…/DynamoDbService.java• L1152-1265 src/…/DynamoDbService.java• L1284-1391 src/…/DynamoDbService.java• L1411-1568 src/…/DynamoDbTransactionConflicts.java• L11-26 src/…/DynamoDbTransactionConflicts.java• L80-145

Query reads

Query reads a table or index by requiring equality on every partition-key attribute. It can then apply supported sort-key conditions. A composite sort key must use equality on earlier sort-key parts before it constrains a later part.

The read stops at the requested Limit or the simulated 1 MB boundary. A LastEvaluatedKey resumes the read after the last processed key. Filters run after the access path selects items, so they reduce returned items without changing the path or scanned count. Global secondary indexes do not support strongly consistent reads.

References: src/…/DynamoDbAccessPathValidator.java• L202-304 src/…/DynamoDbService.java• L1587-1721 src/…/NativeDynamoDbJsonHandler.java• L1330-1485

Scan reads

Scan reads the selected table or index without requiring a partition-key match. It uses the same limit, 1 MB boundary, cursor, filter, projection, and index visibility rules as other reads. A segmented scan divides the scan into caller-selected segments.

References: src/…/NativeDynamoDbJsonHandler.java• L1495-1613 src/…/DynamoDbAccessPathValidator.java• L534-593 src/…/DynamoDbService.java• L1723-1848

SearchVectors finds the closest stored table items for a query vector. It checks the active vector index, query dimension, search conditions, and result count. It then keeps valid index members, scores and sorts them, and applies the index and response projections.

Cosine and Euclidean search prefer lower distance. Dot-product search prefers a higher score. A malformed stored vector is omitted from the result rather than failing the whole search. Items expired but not yet removed by TTL remain visible in this stored-item view.

This diagram shows the vector search flow.

flowchart LR
    A[SearchVectors request] --> B[Resolve active index]
    B --> C[Validate vector and filters]
    C --> D[Read stored items]
    D --> E[Keep index members]
    E --> F[Score and sort]
    F --> G[Keep TopK]
    G --> H[Apply projection]
    H --> I[Search results]

References: src/…/NativeDynamoDbJsonHandler.java• L1641-1654 src/…/DynamoDbService.java• L927-952

Pagination keys

An ExclusiveStartKey must contain exactly the scalar attributes required by the selected path. The service checks names, types, empty strings or binaries, number form, and binary encoding before it navigates. An incomplete or mismatched key fails instead of silently repeating or skipping items. Table scans also check the supplied values against each secondary index before accepting the cursor.

PartiQL uses an opaque NextToken. The token is bound to the statement text and parameter values that created it. It cannot be reused for another statement, table, or access path. A changed page limit does not change that binding.

References: src/…/DynamoDbAccessPathValidator.java• L536-655 src/…/DynamoDbPartiQLHandler.java• L475-519

Expressions and projections

Expressions decide which items qualify or how an item changes. Projections decide which parts of a valid item appear in a response. These are separate stages: validation and evaluation happen before response shaping.

Expression evaluation

The expression system tokenizes and parses a condition into a structured expression before it evaluates the expression against an item. It resolves expression-name aliases and typed value placeholders. It supports Boolean logic, comparisons, IN, BETWEEN, document paths, list indexes, and DynamoDB functions such as attribute_exists, begins_with, contains, attribute_type, and size.

Semantic checks reject undefined names or values, invalid function operands, invalid ordered types, reversed BETWEEN bounds, redundant parentheses, reserved bare attribute names, and malformed paths before item evaluation. Key conditions require the selected path's partition-key equalities. Filter expressions cannot replace key conditions or refer to a primary key.

References: src/…/ExpressionEvaluator.java• L63-180 src/…/ExpressionEvaluator.java• L408-648 src/…/DynamoDbReservedWords.java• L108-165 src/…/DynamoDbAccessPathValidator.java• L152-249

Update expressions

An update expression describes changes to an item through SET, REMOVE, ADD, and DELETE sections. The syntax checker validates section shape, document paths, operands, reserved names, and the limited form of arithmetic expressions before the service applies the change.

All right-hand operands read the item state before the update. if_not_exists and list_append are the supported update functions. Numeric addition and set operations require compatible values. The finished item must still have valid keys, valid index values, allowed nesting, and a size within the item limit. The service tracks touched paths so update responses can return old or new changed attributes. Maps changed along an update path are ordered by code point in the resulting item, while unrelated maps keep their existing order.

References: src/…/DynamoDbUpdateExpressionSyntax.java• L50-65 src/…/DynamoDbUpdateExpressionSyntax.java• L163-279 src/…/DynamoDbService.java• L1345-1568 src/…/DynamoDbService.java• L4351-4365 src/…/DynamoDbMapOrder.java• L13-17

Projection evaluation

ProjectionExpression creates a new item from named top-level or nested paths. It supports aliases, map paths, and list indexes. Paths that overlap fail before the read. Separate paths that share a parent merge into one reconstructed map or list. Selected list elements compact in source order.

AttributesToGet remains a top-level attribute form. If an index read has no explicit selection, the index projection controls the returned item. PartiQL follows the same visibility model: filters use the index view, and SELECT * over a partial index returns the stored projection. An LSI can fetch a selected non-projected column from its base item.

References: src/…/ProjectionEvaluator.java• L31-135 src/…/ProjectionEvaluator.java• L194-337 src/…/NativeDynamoDbJsonHandler.java• L890-925 src/…/DynamoDbPartiQLHandler.java• L119-146

Value and size rules

DynamoDB values use one typed member. Keys must use their schema type and a non-empty string or binary value. Sets cannot be empty or contain duplicate members. Binary values must be valid base64 at the JSON boundary. Numbers are checked and normalized before storage, key construction, comparison, arithmetic, pagination, and PartiQL conversion.

Items and expression values have nesting limits. The item limit is 400 KB. Normal writes and finished updates check the stored item. An UpdateExpression also has a statement-size limit before its condition is evaluated. Read and write capacity use the size of the data seen by the selected table or index projection.

Plain DynamoDB JSON input sorts keys inside nested map values by code point before storage or evaluation. PartiQL map literals keep the order in which they are written. This ordering is separate from response-order randomization and does not change list or set order.

References: src/…/DynamoDbAttributeValueValidator.java• L18-22 src/…/DynamoDbAttributeValueValidator.java• L155-227 src/…/DynamoDbAttributeValueValidator.java• L309-349 src/…/DynamoDbItemSize.java• L21-96 src/…/DynamoDbItemSize.java• L205-304 src/…/DynamoDbMapOrder.java• L13-49

PartiQL and transactions

PartiQL and transaction actions provide alternate entry points to the same table and item rules. They do not create a separate item model. Key checks, conditions, projections, size limits, and mutation side effects remain aligned with ordinary JSON operations.

PartiQL operations

PartiQL supports SQL-like SELECT, INSERT, UPDATE, and DELETE statements. A SELECT with a usable partition-key equality follows a query-like path. Other shapes follow a scan-like path and apply conditions as filters. IN and OR key conditions can expand into separate keyed reads when each branch remains key-readable. If a branch cannot be read by key, the statement falls back to a scan-like read. A vector index is not a PartiQL read path.

The key plan rejects overlapping sort-key ranges and limits decomposed reads. ORDER BY requires a key-bound WHERE clause and orders only by access-path key attributes. Index-qualified reads use the selected index view. Inserts, updates, and deletes use the normal item mutation path, so their size checks, operand errors, and change events remain consistent.

NextToken carries the last key or ordering position together with a binding for the statement text and parameter values. A token from another statement, table, or access path is rejected.

References: src/…/DynamoDbPartiQLHandler.java• L69-146 src/…/DynamoDbPartiQLHandler.java• L211-385 src/…/DynamoDbPartiQLKeyPlan.java• L61-225 src/…/DynamoDbPartiQLHandler.java• L475-519

Transaction operations

Transactional writes validate and stage all member changes before commit. A failed condition or member check returns cancellation reasons and applies no partial write. After commit, the service persists the changed items and emits their stream and Kinesis events.

Transactional retries use a client token. A matching request can replay as a successful no-op. A changed request with the same token fails with an idempotency mismatch. A validation failure in an update member is reported as a cancellation reason rather than as a top-level update error.

When native transaction-conflict emulation is enabled, a write transaction marks all participant items busy only after its checks pass and keeps them busy briefly after commit. Overlapping writes and transaction reads observe the conflict contract instead of partially entering the transaction. With the setting off, item locks still serialize overlapping transactions without producing these conflict errors.

References: src/…/NativeDynamoDbJsonHandler.java• L2877-3165 src/…/DynamoDbPartiQLHandler.java• L749-895 src/…/DynamoDbService.java• L2171-2313 src/…/DynamoDbTransactionConflicts.java• L89-145

Import operations

ImportTable creates a table from DynamoDB JSON objects in S3. The asynchronous job tracks progress, counts, errors, and failure details. Valid records use the normal item-size, number, key, index, and vector checks.

The table stays in a creating state until the load finishes. A matching client token returns the existing import. An unfinished native import becomes failed after restart because its worker state is not durable.

References: src/…/NativeDynamoDbJsonHandler.java• L3451-3464 src/…/DynamoDbService.java• L3721-3915

Expiry and export operations

TTL removes expired items in the background. An expired item remains visible to normal reads and vector search until the sweep removes it. The removal uses the normal delete side effects, including stream and Kinesis records.

Point-in-time export reads a table snapshot or a bounded change window and writes compressed data and manifest files to S3. Full exports contain DynamoDB JSON or ION items. Incremental exports contain records for items whose final value differs from its initial value. Export jobs expose status, item count, billed size, manifest location, and failure details.

References: src/…/DynamoDbService.java• L3445-3474 src/…/DynamoDbService.java• L4960-5263 src/…/ExportDescription.java• L13-76

Backups and recovery

Backup and recovery features preserve a table definition and its items for later use. On-demand backups are independent snapshots. Point-in-time recovery keeps a change history so a new table can be built from an allowed time in the recovery window.

On-demand backups

CreateBackup captures the source table metadata and item set at one time. The backup has a DynamoDB backup ARN, a user or system type, and a Region scope. User backups can be described, listed, restored, and deleted. Deleting a table with point-in-time recovery enabled also creates a system backup that expires after 35 days and cannot be deleted by the user.

References: src/…/TableBackup.java• L11-59 src/…/DynamoDbBackupArns.java• L12-81 src/…/DynamoDbService.java• L1016-1047

Point-in-time recovery

Point-in-time recovery records the item state that a successful write replaced. A restore starts with the live table and reverses changes after the requested time, so the result contains the table as it existed at that time. The recovery window is bounded by retention and a latest-restorable lag.

Enabling recovery starts a new history window when recovery was disabled. Disabling it removes stored history. A point-in-time restore creates a new table from the source schema and supported settings. It does not copy stream, TTL, point-in-time recovery, tags, deletion protection, or table-class settings.

This diagram shows how a point-in-time restore derives a new table state.

flowchart LR
    A[Live table] --> B[Item changes before writes]
    B --> C[Recovery history]
    A --> D[Select restore time]
    C --> D
    D --> E[Undo later changes]
    E --> F[Create restored table]

References: src/…/DynamoDbPointInTimeRecovery.java• L25-44 src/…/DynamoDbPointInTimeRecovery.java• L74-167 src/…/NativeDynamoDbTableService.java• L180-225

Restore operations

Restore from a backup or a point in time creates a distinct target table. The target copies keys, indexes, capacity, encryption, and item data. Request overrides can change supported capacity, index, vector, or encryption settings. The source and target names must not collide.

References: src/…/NativeDynamoDbTableService.java• L180-225 src/…/DynamoDbService.java• L2780-2853

Stream state

DynamoDB Streams records successful table mutations as a per-table change feed. Stream metadata records whether the feed is enabled and which item images it exposes. Kinesis destinations are a separate delivery path and do not enable DynamoDB Streams.

Stream lifecycle

Streams can expose KEYS_ONLY, NEW_IMAGE, OLD_IMAGE, or NEW_AND_OLD_IMAGES. When direct service provisioning omits the view type, the service uses NEW_AND_OLD_IMAGES so table creation and typed provisioning agree.

The table definition durably stores stream enabled state, view type, and stream ARN. Native startup rebuilds stream metadata from that definition, but native record history is in-process. Disabling a native stream closes its open shards and stops new records while existing records remain readable. Re-enabling with a new view type retargets the live stream. Deleting a table removes its stream state. A Local backend may create a new stream ARN when it must retarget a live external stream.

Reset clears native stream records and shard state but leaves sequence counters monotonic. Native Java stream consumers therefore lose process-local history and use process-lived checkpoints, while Local consumers can keep checkpoints for the lifetime of the external stream.

References: src/…/TableDefinition.java• L45-51 src/…/DynamoDbService.java• L1013-1047 src/…/DynamoDbStreamService.java• L149-205 src/…/DynamoDbStreamService.java• L208-237 src/…/DynamoDbBackendSelector.java• L67-75

Mutation records

Each successful item mutation becomes an INSERT, MODIFY, or REMOVE record. The record contains the table key and the item images allowed by the stream view. Direct writes can emit the record at once. Batch and transaction paths defer emission until their changes succeed.

TTL removal follows the normal delete side effects and marks the record as a TTL deletion. The table owner's account and Region are captured before deferred delivery so a later worker cannot use the wrong request scope.

References: src/…/DynamoDbService.java• L1214-1263 src/…/DynamoDbService.java• L1359-1387 src/…/DynamoDbService.java• L2301-2305 src/…/DynamoDbStreamService.java• L239-291

Stream records

The stream API exposes records through shards and iterators. Native streams can use a configured number of shards. A partition key keeps one item's changes on one shard and in order. Optional shard rollover creates child shards, optional iterator expiry limits iterator lifetime, and optional retention trims records after 24 hours. Every native stream still bounds its retained record window at a configured count, which is 1,000 by default.

Consumers use TRIM_HORIZON, LATEST, or a sequence-bound iterator. A sequence outside the shard's held range fails as invalid, while a sequence that was held and later trimmed fails with TrimmedDataAccessException. A closed shard returns no next iterator after its records are consumed. The native reader can fill a requested page across multiple stream reads and reports a later trim without discarding records already returned to its caller.

References: src/…/DynamoDbStreamService.java• L41-86 src/…/DynamoDbStreamService.java• L363-521 src/…/DynamoDbStreamService.java• L523-558 src/…/RingBuffer.java• L7-11 src/…/DynamoDbStreamReader.java• L24-90

Kinesis destinations

Native Kinesis forwarding queues serialized change events after a successful mutation. The write path only adds events to an in-memory queue. A separate drain sends them without blocking table writes and preserves FIFO order for each destination. Each destination has bounded buffering and retry limits, so invalid records, slow destinations, or long outages can drop buffered events. A destination can also stamp event time at the configured millisecond or microsecond precision.

The destination's status is separate from DynamoDB Streams state. Enabling Kinesis forwarding checks that the Kinesis stream exists but does not turn on a DynamoDB stream. Updating precision changes later events without stopping delivery. Disabling a destination or deleting its table discards buffered records for that destination. The Local backend accepts the destination lifecycle shape but does not forward records.

References: src/…/KinesisStreamingForwarder.java• L31-50 src/…/KinesisStreamingForwarder.java• L133-209 src/…/KinesisStreamingForwarder.java• L220-301 src/…/NativeDynamoDbTableService.java• L535-661 src/…/DynamoDbService.java• L1246-1263 src/…/DynamoDbLocalBackend.java• L585-615

Change checklist

When these files or sections are changed, remember to consider these:

  • If request-shape or validation order changes, check modern and legacy item writes, transactions, PartiQL actions, null handling, and error envelopes together.
  • If table identity rules change, check short names, table ARNs, Region checks, CreateTable canonicalization, Local backend translation, tags, and IAM resource matching.
  • If table or index schema rules change, check sparse index membership, composite key order, multi-attribute index limits, query routing, scan cursors, PartiQL index visibility, and capacity sizing.
  • If key placement or ordering changes, check scan segments, index tie ordering, numeric normalization, pagination, and PartiQL branch ordering.
  • If map or response ordering changes, check plain JSON input, PartiQL literals, update-touched paths, nested maps, random response ordering, lists, sets, and transaction result items.
  • If projection rules change, check GSI rejection of unprojected fields, LSI base-item reads, PartiQL filters, index response shaping, list compaction, and read charging.
  • If expression syntax changes, check reserved names, condition precedence, key-condition extraction, update sections, arithmetic shape, aliases, placeholders, unused expression entries, and statement size.
  • If update operand behavior changes, check ordinary updates, PartiQL updates, transaction cancellation reasons, missing attributes, wrong types, and post-update key validation.
  • If value or item-size rules change, check normal writes, updates, transactions, PartiQL, imported records, numeric normalization, base64 errors, nesting, and capacity calculations.
  • If capacity rules change, check DescribeLimits, table creation, table updates, GSI changes, billing-mode changes, and account-scope locking.
  • If IAM condition extraction changes, check leading keys for each access path, attributes read by filters and projections, legacy members, PartiQL statements, and unsupported or malformed expressions.
  • If transaction locking changes, check single-item conflict errors, transaction cancellation reasons, GetItem, client-token replay, item-lock order, reset, and native-versus-Local backend validation.
  • If stream state changes, check durable table metadata, startup rebuild, view-type replacement, disable behavior, shard rollover, retention, deletion, mutation timing, TTL removal, transaction commit, sequence counters, reader checkpoints, and reset behavior.
  • If Kinesis forwarding changes, check separation from DynamoDB Streams, owner account capture, queue overflow, retries, event-time precision, Local backend behavior, disable, and table deletion.
  • If PartiQL pagination changes, check token binding against statement text, parameters, table, access path, and decomposed-read cursors.

Important failure modes

TriggerConsequenceGuard
A request member has the wrong JSON typeThe API returns SerializationException before the operation runsRequest shape validation
A binary value is not valid base64The request fails with SerializationException before storage or expression evaluationDynamoDbAttributeValueValidator
An attribute value has more than one type, an empty set, or duplicate set membersThe request fails with ValidationExceptionDynamoDbAttributeValueValidator
A key is missing, empty, malformed, or has the wrong typeThe item request or cursor fails without changing dataDynamoDbAccessPathValidator and key validation
A table ARN names another Region or an index or stream resourceThe table reference fails instead of crossing resource boundariesDynamoDbTableNames and Local ARN translation
A query lacks required partition-key equality or breaks composite sort-key orderThe query fails before item matchingDynamoDbAccessPathValidator
A partial GSI read asks for an unprojected fieldThe read fails instead of reading the base itemGSI projection validation
A filter uses a non-projected index fieldThe query or PartiQL read fails before filteringAccess-path projection checks
A PartiQL branch creates overlapping ranges, too many decomposed reads, or a multi-attribute index key is selectedThe statement fails before or during access-path selectionDynamoDbPartiQLKeyPlan and DynamoDbPartiQLHandler
An expression has an undefined alias, value, reserved bare name, invalid function operand, or bad syntaxThe request fails before item evaluationExpressionEvaluator, DynamoDbReservedWords, and DynamoDbUpdateExpressionSyntax
A projection has overlapping paths or an invalid list indexThe request fails before response shapingProjectionEvaluator
An update operand refers to a missing attribute or wrong typeThe update fails; a transaction reports a member cancellation reasonUpdateOperandException and transaction staging
An item or update statement exceeds its limitThe write or update fails before storageDynamoDbItemSize and expression-size validation
A provisioned table or index exceeds its account or resource quotaCreate or update fails with LimitExceededExceptionDynamoDbCapacityQuotas
A transaction condition or member check failsCancellation reasons are returned and no partial write is committedTransaction staging
An overlapping request reaches an item held by native transaction-conflict emulationA single-item write fails with TransactionConflictException, or a transaction is cancelled with TransactionConflictDynamoDbTransactionConflicts and native-only backend selection
The Local backend is started with transaction-conflict emulation enabledService startup fails because Local supplies its own transaction behaviorDynamoDbBackendSelector
A PartiQL NextToken is invalid or belongs to another statement or parameter setThe next page fails instead of crossing request boundariesDynamoDbPartiQLHandler token binding
A mutation is staged but not committedNo stream or Kinesis event is emittedDeferred mutation side effects
A stream iterator expires, names an unknown sequence, or falls behind retentionThe stream read fails with an iterator, validation, or trimmed-data errorIterator and retention checks
A native process resets while a consumer relies on its stream historyRecords and process-local checkpoints are lost, while sequence numbers remain monotonicNative lifecycle and stream-reader checkpoint contract
A Kinesis destination is slow, invalid, full, or disabledEvents retry or drop without blocking table writesBounded forwarding queue
A Local backend reset is requestedFloci returns UnsupportedOperation; external DynamoDB Local data remainsLocal backend reset contract

Key files

FileWhy to read it
src/…/NativeDynamoDbJsonHandler.javaShows the DynamoDB JSON action boundary and validation-to-operation flow
src/…/DynamoDbService.javaShows table state, item access, query and scan, updates, transactions, quotas, recovery, and mutation side effects
src/…/NativeDynamoDbTableService.javaShows table creation and update sequencing, capacity settings, stream configuration, and Kinesis destination state
src/…/TableDefinition.javaDefines the table metadata shared by keys, indexes, settings, tags, replicas, and streams
src/…/GlobalSecondaryIndex.javaDefines the GSI schema and its projection and capacity state, including composite key parts
src/…/DynamoDbAccessPathValidator.javaDefines query, filter, projection, index, and pagination-key rules
src/…/DynamoDbKeyHash.javaDefines logical partition placement and deterministic index tie ordering
src/…/ExpressionEvaluator.javaDefines expression parsing, semantic checks, path lookup, comparison, and functions
src/…/DynamoDbUpdateExpressionSyntax.javaDefines update-expression syntax and operand shape
src/…/ProjectionEvaluator.javaDefines nested document projection and path validation
src/…/DynamoDbMapOrder.javaDefines nested map ordering for plain JSON values and update paths
src/…/DynamoDbAttributeOrder.javaDefines optional random response ordering for map and item results
src/…/DynamoDbPartiQLHandler.javaDefines PartiQL access-path selection, projection, ordering, mutation reuse, and token behavior
src/…/DynamoDbPartiQLKeyPlan.javaDefines PartiQL key branching, range overlap checks, and read limits
src/…/DynamoDbTransactionConflicts.javaDefines the optional native contention behavior for item and transaction requests
src/…/DynamoDbStreamService.javaDefines stream metadata, shards, mutation records, iterators, rollover, retention, and sequence state
src/…/RingBuffer.javaDefines the ordered retained-record buffer used by native stream shards
src/…/KinesisStreamingForwarder.javaDefines the non-blocking Kinesis delivery queue, retry behavior, and destination health
src/…/NativeDynamoDbStreamsJsonHandler.javaDefines the DynamoDB Streams JSON API and stream-scope checks
src/…/DynamoDbBackendSelector.javaDefines native-versus-Local selection and stream checkpoint lifetime
src/…/NativeDynamoDbBackend.javaShows native lifecycle, account scoping, and JSON-versus-typed service access
src/…/DynamoDbLocalBackend.javaShows external Local forwarding, public ARN translation, tag storage, and Local capability limits
src/…/DynamoDbStreamReader.javaDefines the common stream reader contract and page behavior for Java consumers
src/…/DynamoDbTableAccess.javaDefines the typed table operations used by Java consumers