DEV Community

Cover image for Dynoxide 1.9.0 release notes
Martin Hicks
Martin Hicks

Posted on Originally published at martinhicks.dev

Dynoxide 1.9.0 release notes

Dynoxide 1.9.0 runs three of the DynamoDB features AWS shipped in the run-up to re:Invent: bulk put items, the new vector search filters, and stream reads from a point in time. Backups and point-in-time restore work now as well, along with the last few operations that used to get UnknownOperationException.

Read the upgrade notes before you install it. The database file moves to a new schema version the first time 1.9.0 writes to it, and older releases can't open it after that.

Bulk put items

AWS launched StartBulkPutItems on 5th November. It loads files from S3 into a table that already exists, which until then meant an import into a brand new table or your own loop over BatchWriteItem.

Dynoxide reads the files from a folder on your machine instead. Start it with --s3-root and a bucket called landing is the folder landing inside it. The files can be DynamoDB JSON or Ion, plain or compressed with gzip or zstd. DescribeBulkOperation, ListBulkOperations and CancelBulkOperation work too, and the error reports are written back to the folder in the layout DynamoDB uses.

Vector search filters

When vector search launched in August, its filters only took =. On 20th November AWS added ranges and BETWEEN on numbers, IN, attribute_exists and attribute_not_exists, and OR and NOT to combine them.

Dynoxide 1.9.0 applies all of them. It also refuses the expressions DynamoDB refuses, with the same messages, so a filter that would fail on AWS fails in your tests first.

Streams from a point in time

Since 15th October, GetShardIterator takes AT_TIMESTAMP and starts a shard at the first record written at or after the time you give it. Dynoxide supports it, and compares times to the millisecond as DynamoDB does, even though a record's ApproximateCreationDateTime only shows whole seconds.

Backups and point-in-time restore

CreateBackup, DescribeBackup, ListBackups, DeleteBackup and RestoreTableFromBackup all work. A backup is a copy of the table's items inside the database file and it outlives the table, so you can delete a table and restore it under the same name.

Point-in-time recovery works through UpdateContinuousBackups, DescribeContinuousBackups and RestoreTableToPointInTime. With it on, Dynoxide journals every write to the table, and a restore makes a new table holding the items as they were at the time you ask for. The journal isn't free: a put to a table with recovery on took 20 to 25 µs longer on my laptop. Tables with it off cost nothing extra.

A restored table comes back the way DynamoDB returns one, with the same keys and billing mode and a RestoreSummary on DescribeTable, but without its tags, stream, time to live or deletion protection.

The rest of the missing operations

  • Resource-based policies. PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy store a table's policy and its revision, and ExpectedRevisionId behaves as it does on AWS. Dynoxide doesn't enforce the policy. It stores it so infrastructure code that sets one doesn't fall over locally.
  • Contributor Insights. The three operations keep the on/off switch for a table and its indexes. There's no CloudWatch, so nothing is published.
  • DescribeLimits returns DynamoDB's default quotas without enforcing them.
  • DescribeEndpoints returns the host and port you sent the request to. DynamoDB returns its regional endpoint, and a client that followed that would end up talking to AWS.

Strict timing

Dynoxide makes a new table ready before CreateTable returns, which is what most tests want. It also means code that writes to a table before it's ACTIVE passes locally and fails on AWS.

Start Dynoxide with --strict-timing (or set DYNOXIDE_STRICT_TIMING=1, or pass strictTiming: true to the npm package's start() or strict_timing=True to Python's) and new tables, new indexes and deleted tables go through CREATING, UPDATING and DELETING as they do on DynamoDB. Until they're done, Dynoxide refuses what DynamoDB would refuse. It's off by default.

In the browser

The WebAssembly build, @dynoxide/wasm-engine, now handles 44 of Dynoxide's 48 operations. The four it doesn't are the bulk put ones. Backups, point-in-time restore, TransactWriteItems, tags, time to live, streams, resource policies, Contributor Insights, DescribeLimits and DescribeEndpoints all work in the browser now, and it takes a strictTiming option too. It's also the engine accesspatterns.dev runs on, and the site is on 1.9.0. Its search schema lesson now runs a range filter inside a vector search, and the university portal model runs a real transaction: submit a grade twice and the second is refused whole.

Closer to DynamoDB

The Parity Suite turned up a long list of small differences in 1.8.1, and 1.9.0 fixes them. Table names are the one most likely to affect you. DynamoDB treats users and Users as two tables, where Dynoxide used to refuse the second with ResourceInUseException. It now creates it, with its own items, and index names that differ only in case work the same way.

On the Parity Suite board, 1.9.0 gets an A. It answers 0.3% of the suite differently from DynamoDB and implements 98.8% of it, leaving 33 tests it doesn't attempt. The suite changed how it measures between 1.8.1's run and this one, so the two scores don't compare directly.

The Python package went out with 1.8.1. pip install dynoxide gets you the binary, a start() and pytest fixtures, and it's at 1.9.0 along with everything else.

Upgrading {#upgrading}

The first time 1.9.0 opens a database file for writing, it moves the file to schema version 18. That copies every secondary index into a new layout and rewrites every item, so a big file takes a while: about 3 seconds on my laptop for a 255 MB file with 200,000 items, a GSI and an LSI. Dynoxide prints a line to stderr when it starts and another when it finishes, and doesn't answer requests in between. The npm and Python launchers wait for it.

There's no going back. Once 1.9.0 has opened a file, 1.3.0 to 1.8.x refuse it, and anything older than 1.3.0 opens it without checking and then fails every write that touches a secondary index. Before you upgrade, stop every older Dynoxide process using the file (a server left running in another terminal counts), and copy the file and its -wal file if you might want to go back.

A database file kept read-only, as a CI fixture or bundled with an app, needs opening once for writing with 1.9.0 before it'll work. Dynoxide tells you that when it refuses to open it.

One change could break a test. CreateTable with neither BillingMode nor ProvisionedThroughput is now refused, as it is on DynamoDB, where Dynoxide used to make a provisioned table with no throughput. Add BillingMode: PAY_PER_REQUEST and it goes through.

If you embed Dynoxide in Rust, the crate is now dynoxide-rs 5.0.0 and the changelog lists the API changes. There are fuller upgrade notes on dynoxide.dev.

It's npm install --save-dev dynoxide@1.9.0 on npm and pip install --upgrade dynoxide on Python. The installation page covers Homebrew, Cargo and Docker.

Top comments (0)