Skip to content

fix(mongodb): answer 503 when the key-info lookup cannot reach the backend - #486

Merged
robinnsc merged 9 commits into
mainfrom
fix/mongodb-key-info-transient
Nov 26, 2026
Merged

robinnsc merged 9 commits into
mainfrom
fix/mongodb-key-info-transient

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

Seven commits on top of 1b7430d, the head demohan reviewed on 24 Nov:

  • 0048aad merges origin/main (a417b2f) into the branch.
  • 2ed233e puts the require_active_table read back on Internal. The read runs only inside update_table_impl, whose mapper answers 500 for Transient as for Internal, so the substitution changed nothing on the wire. UpdateTable's 500 on an unreachable deployment is UpdateTable answers 500 when the storage backend cannot be reached #1451.
  • 8ba7e56 adds a test for the indexes find in table_key_info_from_doc, which the key-info test did not reach. The closed-port connection string and the engine built on it move into one place in error_class.rs.
  • 828ffe4 takes the wire test's table from the scoped_table helper, so a failed assertion deletes it too, and gives the runner command that runs the file.
  • a6bdd00 makes the wire test compare status, code and message, and adds BatchGetItem to the requests it sends.
  • 19c5314 rewords the comments. The change is a classification, and no comment carries an issue number.
  • 84b3a79 drops the comparison with the SQL classifiers from the module doc. After the merge of main, read_err serves five backup and restore reads, so the doc named the wrong read. Its message also fixes a claim in the message of a6bdd00. The runner builds the server without the dev-mode feature. So BatchGetItem reads its key info in the authorization path first, as the other three requests do.

What

The MongoDB backend's key-info and index-info lookups mapped every driver error from the catalog read to StorageError::Internal, which the engine answers as 500 InternalServerError. The new module crates/storage-mongodb/src/error_class.rs holds catalog_read_err, which classifies a driver error that means the read could not reach a server as StorageError::Transient. storage_err_to_dynamo answers Transient as 503 ServiceUnavailable with the message Service is temporarily unavailable. The module is a new file rather than an addition to table_engine.rs, which is 2018 lines on main. The change to that file is five map_err substitutions and one test.

catalog_read_err answers Transient for these driver errors and leaves everything else Internal:

driver error why it is transient
ErrorKind::ServerSelection a stopped or unreachable deployment, the error the reproduction produces
ErrorKind::Io one of the two kinds the driver itself treats as a network error
ErrorKind::ConnectionPoolCleared the other one
ErrorKind::DnsResolve a name lookup that did not answer
ErrorKind::Command with code 6, 7, 89, 91, 134, 189, 262, 9001, 10107, 11600, 11602, 13435, 13436 the driver's own retryable-read code set: a node that is shutting down, stepping down or recovering, a network fault, or an exceeded time limit

The driver has predicates for this, is_network_error and is_read_retryable. They are pub(crate) to the driver and cannot be called from this repository, so the classification is written out against ErrorKind. A label check would not cover the reported case. The error a stopped deployment produces carries an empty label set of its own, because the RetryableError label sits on the inner per-server error.

Transient rather than Connection, because Transient is the variant the SQL backends produce for a runtime read fault and the variant the queue workers read. crates/storage-sqlite/src/workers.rs matches StorageError::Transient to abort a batch without committing and treats any other error as poison. Both variants reach ServiceUnavailable through storage_err_to_dynamo.

The classification errs narrow, for the reason map_sqlx_err gives in the SQLite backend. A client retries a permanent fault classified as transient and cannot succeed, and a queue worker holds a row that can never be applied. One case is wider. When another operation's authentication failure clears a connection pool, a read that waits on that pool gets ConnectionPoolCleared, which this classifies as transient. The driver retries that read once, and the retry reports the authentication failure as 500 unless the pool is cleared again. This comes from the driver's code and is not measured.

The five reads reclassified, all in crates/storage-mongodb/src/table_engine.rs:

function read
table_key_info_impl tables document by account and table name
table_key_info_by_table_id_impl tables document by table_id
table_key_info_from_doc indexes cursor for the table, and each batch the cursor pulls
index_info_by_table_id_impl one indexes document

Conflicts

git merge-tree of this head against main is clean. It conflicts with #454 (Backfilling on a CREATING GSI) in crates/storage-mongodb/src/lib.rs: both add mod lines after mod data_engine;. Whichever of the two merges second merges main again and keeps both sets of lines.

Why

Fixes #441

A deployment that could not be reached answered 500 InternalServerError, the status of a server fault, for a fault that clears when the deployment comes back. Both the server's authorization path and the engine's own lookup pass that storage error through storage_err_to_dynamo. The SDKs retry 500 and 503 alike, so this is a classification fix. 503 ServiceUnavailable is the status of a transient fault. Two SQL classifiers already produce it for an I/O or pool fault. They are map_sqlx_err on the SQLite index paths and read_err on the PostgreSQL backup and restore reads in backup_engine.rs. The SQL backends' own key-info reads still map to Internal, as "Not changed here" says.

Service measurements

The hosted service's behaviour on an induced metadata-backend fault cannot be measured, because there is no way to make its metadata backend fail on request. No live measurement is encoded in a test here. The expected status follows this engine's own classification of a transient backend fault, the one map_sqlx_err and read_err produce for an I/O or pool fault.

What is measured is this server against a MongoDB deployment that was stopped mid-run. The setup is a mongo:7 replica set in a container published on loopback, a binary built from this branch, and the server's own config. The credential cache and the key-info cache share one hard TTL of 60 seconds. One request before the fault leaves the access key cached, and the faulted requests name tables the key-info cache has never seen. They run concurrently to finish inside that window. Without that setup the credential lookup fails first and the status reports an authentication failure instead.

Before, binary at main 744ea291 with no source change, 2026-10-24 UTC:

time request response
00:48:02 GetItem on a known table, backend up HTTP 200
00:48:09 mongod stopped
00:48:39 GetItem, cold key info, authorization path HTTP 500 InternalServerError "Internal server error"
00:48:39 PutItem, cold key info, authorization path HTTP 500 InternalServerError "Internal server error"
00:48:39 Query, cold key info, authorization path HTTP 500 InternalServerError "Internal server error"
00:48:39 BatchGetItem, cold key info HTTP 500 InternalServerError "Internal server error"

After, same procedure, binary rebuilt from this branch, 2026-10-24 UTC:

time request response
00:57:27 GetItem on a known table, backend up HTTP 200
00:57:31 mongod stopped
00:58:01 GetItem, cold key info, authorization path HTTP 503 ServiceUnavailable "Service is temporarily unavailable"
00:58:01 PutItem, cold key info, authorization path HTTP 503 ServiceUnavailable "Service is temporarily unavailable"
00:58:01 Query, cold key info, authorization path HTTP 503 ServiceUnavailable "Service is temporarily unavailable"
00:58:01 BatchGetItem, cold key info HTTP 503 ServiceUnavailable "Service is temporarily unavailable"
00:58:03 mongod back to PRIMARY

Each faulted request takes 30 seconds, which is the driver's server-selection timeout at its default. That latency is the same before and after this change.

The driver error behind both runs, from the server log:

Kind: Server selection timeout: No available servers. Topology: { Type: Single,
Set Name: rs0, Servers: [ { Address: localhost:19603, Type: Unknown, Error:
Kind: I/O error: Connection refused (os error 111), labels: {"RetryableError",
"SystemOverloadedError"}, source: None, server response: None } ] }, labels: {}

The wire test below repeated the "after" run on 2026-11-25 at this head, with BatchGetItem among the four requests. All four answered 503 at 03:58:20 UTC with the message Service is temporarily unavailable. That binary has no dev-mode feature, so all four requests read their key info in the authorization path first.

Not changed here

UpdateTable answers 500 InternalServerError when the deployment cannot be reached. update_table_err_to_dynamo has no Transient arm, and the catalog reads in update_table_impl, require_active_table among them, map driver errors to Internal. #1451 tracks it.

describe_table_impl and name_taken_error read the same tables collection with the same Internal mapping. Neither is a key-info lookup, and DescribeTable is a different operation, so both keep their current classification.

MongoCredentialStore's access-key lookup maps the same driver fault to InternalServerError("Internal error during authentication"). Measured on the same stopped deployment at 00:45:37, 00:46:07 and 00:46:37 UTC on 2026-10-24, with the credential cache cold. Query, BatchGetItem and DescribeTable all answered 500 with that message before reaching any key-info lookup. The SQL backends' credential stores build the same error. This is one classification decision across four backends rather than a MongoDB gap, and it belongs in its own change.

The key-info lookups in the SQL backends map their own row read to Internal as well: fetch_table_key_info in crates/storage-postgres/src/data/ddl.rs (line 385) and in crates/storage-sqlite/src/data/ddl.rs (line 355). The issue's premise that the SQL backends classify this fault correctly holds for map_sqlx_err and read_err, and not for these two reads. Those two are a code-level finding. No PostgreSQL or SQLite server was stood up to measure them.

The 30 second cost of a request that reaches an unreachable deployment comes from the driver's default serverSelectionTimeoutMS, which this change does not touch.

Testing done

Seven Rust tests, five on the classifier and two on the production lookups. They need no MongoDB, so they run in cargo test --workspace on every job.

The classifier tests in crates/storage-mongodb/src/error_class.rs cover five cases. Four of them cover a stopped deployment, a dropped socket, every code in the retryable-read set, and the driver message surviving the classification. The fifth checks four command codes outside that set and three other driver error kinds. The stopped-deployment case takes its error from the driver rather than building one by hand. ErrorKind::ServerSelection is #[non_exhaustive] and cannot be constructed outside the driver crate. The test points a client at a port nothing listens on, with a 50 millisecond server-selection timeout, and asserts on what comes back.

an_unreachable_deployment_makes_the_key_info_lookups_transient drives the production functions. MongoEngine::new builds client options and a lazy client and performs no I/O. The test points an engine at a closed port and calls table_key_info, table_key_info_by_table_id_impl and index_info_by_table_id_impl. Each fails at its first read, the tables document. The indexes find in table_key_info_from_doc therefore has a test of its own in table_engine.rs. an_unreachable_deployment_makes_the_index_list_read_transient hands the function a catalog document as create_table writes one. The index list is then the first read that reaches the driver. With the indexes find alone reverted, that test fails with Internal("Kind: Server selection timeout: No available servers..."). With all five substitutions reverted, both production-lookup tests fail the same way and the five classifier tests pass. With the classifier disabled instead, six of the seven fail.

tests/test_mongodb_backend_unreachable.py measures the status over the wire with the procedure above. It stops the shared MongoDB container, so every other request to that server fails for about 35 seconds, and devtools/run-tests --parallel distributes test files across workers. The test therefore runs only when EXTENDDB_TEST_BACKEND_FAULT=1 is set:

EXTENDDB_TEST_BACKEND_FAULT=1 devtools/run-mongodb-tests -- --pytest --filter backend_unreachable

No CI job sets that variable, so in CI pytest collects the file and skips it. The CI guard is the Rust tests above, which run in cargo test --workspace in .github/workflows/test.yml and fail on main's mapping. A serial step after the parallel MongoDB suite, on its own ports, would run the wire test in CI too. It is not added here.

The wire test sends GetItem, PutItem, Query and BatchGetItem concurrently while the container is down and compares each answer with (503, "ServiceUnavailable", "Service is temporarily unavailable"). The message tells a key-info 500 (Internal server error) from an authentication 500 (Internal error during authentication), which status and code alone cannot. The table comes from scoped_table, which deletes it when the block ends, a failed assertion included. The container restart and the wait for PRIMARY stay in a finally block, so a failure does not leave the deployment down for later tests. The client has retries disabled. 503 is retryable, and four attempts at the driver's 30 second timeout outlast the 60 second credential cache. The attempt that finally reports back then fails authentication instead.

At this head the wire test passes in 40 seconds against a mongo:7 replica set on 127.0.0.1 and a binary built from this branch with --no-default-features --features mongodb-test-hooks. Against a binary with the five substitutions reverted it fails with GetItem answered (500, 'InternalServerError', 'Internal server error') while the backend was unreachable.

Gates on this head, all clean:

cargo +1.97.0 fmt --all -- --check                                                    clean
cargo +1.97.0 clippy -p extenddb-storage-mongodb --all-targets --features test-hooks -- -D warnings   0 warnings
cargo +1.91.1 check -p extenddb-storage-mongodb --all-targets                         clean
cargo +1.97.0 test -p extenddb-storage-mongodb --lib                                  197 passed, 0 failed, 84 ignored
python3 -m pytest --collect-only -q tests/                                            6661 tests collected
python3 -m pytest --collect-only -q tests/python                                      672 tests collected

Cargo.lock does not change, so the license-notice checks do not apply.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC: n/a

Breaking changes

A client of a MongoDB-backed deployment whose database cannot be reached sees 503 ServiceUnavailable with the message Service is temporarily unavailable. It saw 500 InternalServerError with the message Internal server error. The change covers every request whose key-info or index-info lookup runs into the fault. GetItem, PutItem, Query and BatchGetItem with cold key info are the measured cases. The answer while the deployment is reachable, the 30 second latency of a faulted request, and UpdateTable's 500 do not change.


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

… as transient

The key-info and index-info lookups in the MongoDB backend mapped every
driver error from the catalog read to StorageError::Internal, which
storage_err_to_dynamo answers as InternalServerError. A deployment that
could not be reached therefore returned 500 on a retryable condition, on
both the server's authorization path and the engine's own lookup, where
the SQL backends classify the same fault as transient and answer 503.

catalog_read_err classifies a driver error that means the read could not
reach a server as StorageError::Transient: ServerSelection, Io,
ConnectionPoolCleared, DnsResolve, and the server codes in the driver's
own retryable-read set. Everything else stays Internal, erring narrow for
the reason map_sqlx_err gives: a permanent fault called transient is
retried by a client that cannot succeed, and holds a queue row forever.

Transient rather than Connection, because that is the variant the SQL
backends produce for a runtime read fault and the variant the queue
workers read. Both reach ServiceUnavailable at the engine boundary.

Measured against a stopped mongod with the credential cache warm: GetItem,
PutItem, Query and BatchGetItem answered 500 InternalServerError before
and 503 ServiceUnavailable after.

Fixes #441
The classifier comment said the GSI and TTL queue workers retry a Transient
row instead of dropping it. That is the SQLite worker. This backend's
workers log every error and continue, so the comment now says so.

@demohan demohan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With mongod stopped, paused or killed, and the key info cold, ten request types answer 503 ServiceUnavailable at this head and 500 before: GetItem, PutItem, Query, Scan, a GSI Query, BatchGetItem, BatchWriteItem, TransactWriteItems, TransactGetItems and GetItem on a missing table. A GSI Query with warm key info also moves to 503, because the index lookup is not cached. Every request type answers 200 again as soon as mongod returns, so no error is cached. Injected with failCommand, the 13 retryable codes answer 503 and other codes stay 500, and the list matches RETRYABLE_READ_CODES in the 3.8.0 driver. A failed lookup still blocks the request, and BatchWriteItem answers 503 with no UnprocessedItems.

The branch is 309 commits behind main and merges with no conflict. On the merge, the 17 request shapes answer as at this head, and main without the change still answers 500.

I will approve once the UpdateTable item is settled and the test covers the other three sites.

crates/engine/src/update_table.rs:342

UpdateTable still answers 500 with mongod stopped, at this head and merged onto main, two runs each. This mapper's catch-all has no Transient or Connection arm, so the require_active_table read (table_engine.rs:1147) still becomes "Internal server error". Before that, with builtin authorization, the resource-tag lookup (authorization_store.rs:345) fails and answers "Internal error during authorization". Past both, the other reads in update_table_impl (table_engine.rs:771, 802, 815, 873, 935 and 963) map to Internal. Either the UpdateTable path answers 503, or the PR body drops UpdateTable from the set.

/// the result through `storage_err_to_dynamo`, which answers `Transient`
/// as `ServiceUnavailable`; that mapping has its own test in
/// `crates/server/src/request_helpers.rs`, so what is asserted here is the
/// classification this backend produces.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test guards 3 of the 6 changed sites. With require_active_table (table_engine.rs:1147) and the two indexes cursor sites (:1255, :1260) reverted, alone and together, the 6 error_class tests and the full storage-mongodb and server suites pass (368 passed). The closed-port engine fails on the first tables read, so it never reaches them. The ConnectionPoolCleared and DnsResolve arms have no test either.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guard site is gone with the UpdateTable change (2ed233e). The indexes find now has a test of its own (8ba7e56). It hands table_key_info_from_doc on the closed-port engine a catalog document as create_table writes one, so the function fails at that read. With the site reverted the test fails.

The try_next site cannot see a network fault under the default limits. A table has at most 25 index documents (20 GSIs and 5 LSIs), and the first batch of a find holds 101. The cursor never sends a getMore. It stays so both reads of the cursor map alike.

ConnectionPoolCleared and DnsResolve are #[non_exhaustive] struct variants in mongodb 3.8.0 (src/error.rs:767 and :747), so a test cannot build them, and a stopped loopback server surfaces as ServerSelection. The arms stay because the driver itself counts ConnectionPoolCleared as a network error (is_network_error, src/error.rs:384). It raises DnsResolve when a host name gets no DNS answer while it opens a connection (src/runtime/stream.rs:117).

files' requests inside this window, so the test only runs when
``EXTENDDB_TEST_BACKEND_FAULT=1`` is set:

EXTENDDB_TEST_BACKEND_FAULT=1 devtools/run-mongodb-tests \\

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devtools/run-mongodb-tests --filter backend_unreachable exits 1 with unknown option: --filter, at this head and on main. devtools/run-mongodb-tests -- --pytest --filter backend_unreachable runs it. The table is deleted outside the finally (lines 157 to 167), so a failed run leaves it behind.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the runner takes --filter only after --. The docstring and the body now give EXTENDDB_TEST_BACKEND_FAULT=1 devtools/run-mongodb-tests -- --pytest --filter backend_unreachable, and the table comes from scoped_table, so a failed assertion deletes it too (828ffe4).

whatever the backend classified the driver error as. A transient backend fault
is a retryable ``ServiceUnavailable`` (503), which is what the SQL backends
produce for the same fault; before the fix this backend answered 500
``InternalServerError``, so a client saw a non-retryable error for a retryable

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional. botocore 1.43.127 retries a 500 InternalServerError as it retries a 503: 10 attempts in the default mode and 3 in standard. So the change is a classification fix, and "non-retryable" does not hold.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. botocore keeps 500 and 503 in the same transient status list, so it retries both. The docstring and the body now describe the change as a classification and no longer say non-retryable (19c5314).


# Leaves the access key in the credential cache, so the faulted requests
# below fail on the key-info lookup rather than on authentication.
no_retry_client.get_item(TableName=unique_table_name, Key={"pk": {"S": "warmup"}})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional. One of 7 runs at this head failed after 148.6 s. The server log shows a credential lookup after the 60 s cache expired, so the 500 came from authentication, and the assertion on status and code cannot tell that apart from a key-info regression. BatchGetItem is in the PR's table and not in the test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test now compares status, code and message, so an authentication 500 (Internal error during authentication) and a key-info 500 (Internal server error) fail with different text. BatchGetItem is in the set (a6bdd00). Against a binary with the five substitutions reverted it fails with GetItem answered (500, 'InternalServerError', 'Internal server error') while the backend was unreachable.

require_active_table runs only inside update_table_impl, and that path
answers through update_table_err_to_dynamo. The mapper has no Transient
arm: its catch-all turns Transient into the same 500 InternalServerError
as Internal. So the substitution at this read changed nothing on the wire,
and UpdateTable answers 500 with the deployment stopped before and after.

The read goes back to Internal. The change now covers the five key-info
and index-info reads, which answer through storage_err_to_dynamo and its
Transient arm. UpdateTable's own answer on an unreachable deployment is
tracked in #1451.
The closed-port engine fails at the first tables read. The test of the
key-info lookups therefore never reached the indexes find in
table_key_info_from_doc. That site could go back to Internal with every
test passing. The new test hands the function a catalog document as
create_table writes one, so the index list is the first read that reaches
the driver. It asserts that the read comes back Transient. With the find
site reverted the test fails with Internal("Kind: Server selection
timeout...").

The closed-port connection string and the engine built on it move into
one place in error_class.rs, where the three tests that need them share
them.
…fix the run command

devtools/run-mongodb-tests takes --filter only after --, as an argument it
passes to devtools/run-tests. On its own it exits 1 with "unknown option:
--filter". The docstring now gives the command that runs the file:
EXTENDDB_TEST_BACKEND_FAULT=1 devtools/run-mongodb-tests -- --pytest
--filter backend_unreachable.

The test created its table by hand and deleted it after the assertion
loop, so a failed assertion left the table behind. The table now comes
from the scoped_table helper in conftest.py, which deletes it on exit
whichever way the block ends. The container restart stays in the inner
finally, so the delete runs with the backend up.
…ted set

The assertion compared status and code only. A credential lookup that
runs into the stopped deployment answers 500 "Internal error during
authentication". A key-info lookup that goes back to Internal answers
500 "Internal server error". Both failed the test with the same text, so
a failure could not say which one it was. The helper now returns the
message as well. The loop compares the full triple against
(503, "ServiceUnavailable", "Service is temporarily unavailable"), the
answer the engine's Transient arm gives.

BatchGetItem resolves the key info through the engine's own lookup rather
than the authorization path, and the body measures it. It joins the four
requests that run concurrently while the container is down.
…QL reads it matches

botocore retries a 500 InternalServerError as it retries a 503, so the
test docstring's "non-retryable error for a retryable condition" did not
hold. The docstring and the module comment now say what the two statuses
mean. 503 is the status of a fault that clears when the deployment comes
back, and 500 the status of a server fault.

The module comment also said the SQL backends classify the same faults as
Transient. Only two of their classifiers do: map_sqlx_err on the SQLite
index paths and read_err on the PostgreSQL DescribeBackup definition read.
Their key-info reads map every driver error to Internal, and the comment
now says so.

The comments carry no issue numbers any more.
The module doc named read_err as the PostgreSQL DescribeBackup definition
read. After the merge of main, read_err serves five backup and restore
reads in backup_engine.rs, and the definition read does not use it. The
comparison with the SQL backends stays in the pull request description.
The doc of CLOSED_PORT_URI keeps the two facts the tests use.

This corrects the message of a6bdd00. devtools/run-mongodb-tests builds
the server without the dev-mode feature. So BatchGetItem's first key-info
read is the authorization path's, as for the other three requests. Both
paths pass the storage error through storage_err_to_dynamo, so the 503
holds on each.
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

You're right about UpdateTable. require_active_table runs only inside update_table_impl, and the catch-all of update_table_err_to_dynamo answers 500 for Transient as it does for Internal, so that substitution changed nothing on the wire. 2ed233e puts the read back on Internal, and the PR now reclassifies the five key-info and index-info reads. UpdateTable's 500 on an unreachable deployment is #1451.

0048aad merges main in, and the four inline threads have their answers below.

@demohan demohan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The items from the earlier review are resolved at 84b3a79. 2ed233e puts require_active_table back on Internal, the body says UpdateTable still answers 500 and points to #1451, and with mongod stopped UpdateTable answers 500 at this head and at 1b7430d, so no client sees a change there.

With mongod stopped and key info cold, 13 request shapes answer 503 Service is temporarily unavailable after 30.0 s, the 10 key-info request types, GetItem on a missing table, and GSI Query and Scan with warm key info, as at 1b7430d; with the backend up, this head answers as 1b7430d on all 8 shapes. Through failCommand the 11 retryable codes answer 503 and the 7 others 500, and after docker start every shape answers normally once the node is PRIMARY. Authorization still fails closed, errors are not cached, and BatchWriteItem fails a key-info error before any write. The test now compares status, code and message, fails with the credential cache off and against a build with the five changes reverted, and covers BatchGetItem; the run command works and a failed run leaves no table behind. fmt, clippy with and without test-hooks and the 1.91.1 check are clean, the MongoDB crate passes 197 tests, and CI is green on 58 checks with one still queued.

.try_next()
.await
.map_err(|e| StorageError::Internal(e.to_string()))?
.map_err(|e| crate::error_class::catalog_read_err(&e))?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional. With this try_next reverted, or the ConnectionPoolCleared or DnsResolve arm deleted, the 197 tests pass. Under the default limits the index cursor fits in its first batch, so no getMore reaches this line, and both driver variants are #[non_exhaustive], so no test outside the driver can build them. A comment saying why the line goes through read_err would keep it from being changed back.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I'll leave this line as it is. It makes the same catalog_read_err call as the find above it. The message of f1aaa95 gives the reason for both calls. A read of these lookups that cannot reach a server is transient, and every other driver error stays Internal.

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Nov 25, 2026
@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Nov 25, 2026
@robinnsc robinnsc mentioned this pull request Nov 25, 2026
6 of 8 tasks
@LeeroyHannigan
LeeroyHannigan removed this pull request from the merge queue due to the queue being cleared Nov 25, 2026
@robinnsc
robinnsc added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit d9c587d Nov 26, 2026
59 checks passed
@robinnsc
robinnsc deleted the fix/mongodb-key-info-transient branch November 26, 2026 02:52
robinnsc added a commit that referenced this pull request Nov 26, 2026
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has two features (#468,
#1009) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194 and #1375, next to the existing entries for #398, #526 and
#1166. The #526 entry now gives the old TransactWriteItems mismatch
message, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.
robinnsc added a commit that referenced this pull request Nov 27, 2026
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has three features (#468,
#1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194, #1375 and #1522, next to the existing entries for #398, #526,
#1166, #1449 and #1523. The #526 entry now gives the old
TransactWriteItems mismatch message, the #1523 heading takes the
v1.1.0: prefix, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.
robinnsc added a commit that referenced this pull request Nov 27, 2026
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has three features (#468,
#1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194, #1375 and #1522, next to the existing entries for #398, #526,
#1166, #1449 and #1523. The #526 entry now gives the old
TransactWriteItems mismatch message, the #1523 heading takes the
v1.1.0: prefix, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.

docs/troubleshooting.md: the bus error entry names 1.0.0 as the release
that has the bug, so its line carries a version-literal-ok marker.
LeeroyHannigan added a commit that referenced this pull request Nov 27, 2026
* chore(release): bump version to 1.1.0

Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has three features (#468,
#1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194, #1375 and #1522, next to the existing entries for #398, #526,
#1166, #1449 and #1523. The #526 entry now gives the old
TransactWriteItems mismatch message, the #1523 heading takes the
v1.1.0: prefix, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.

docs/troubleshooting.md: the bus error entry names 1.0.0 as the release
that has the bug, so its line carries a version-literal-ok marker.

* docs(upgrade): add the v1.1.0 entry of #1290, put #1349's in order

#1290 merged after this branch was rebased. It changes the answer to a
request with no Authorization header, so it gets a v1.1.0 entry. The
merge of main put the #1349 entry after the #1523 entry. It moves to
the place of its number, beside the new #1290 entry.

---------

Co-authored-by: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com>
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
Main is at c8e66fb. This branch last had main at 3534c9e. Since
then, 42 PRs merged into main, #1482 among them, which fixes the
WebAssembly build.

Seven files conflicted. The merge keeps both sides in each:

- crates/core/src/settings_keys.rs: #1449 adds the
  search_inequality_filters keys where this branch adds the GSI phase
  hold key. Both blocks stay, the hold first.
- crates/app/src/cmd_settings.rs: #1449 imports server_setting_default
  and this branch imports writable_key_validator from the same module.
  The import names both.
- crates/server/src/management/ops_settings.rs: #1449 adds the
  search_tests module where this branch adds its tests module. Both
  stay.
- crates/storage-mongodb/src/lib.rs: #486 adds mod error_class where
  this branch adds its two GSI modules. All three stay.
- crates/storage-postgres/src/delete_table.rs: #1411 refuses a table
  that is already DELETING before the indexes are read, where this
  branch built its description with the backfill set. The merge keeps
  the refusal of #1411 and reads the backfill set after it, before the
  index rows, as this branch does.
- crates/storage-sqlite/src/delete_table.rs: the same change of #1411.
  The second hunk keeps the backfill set before the index rows and the
  sqlx::AssertSqlSafe query of #1166.
- crates/storage-sqlite/src/table_helpers.rs: the backfill set before
  the catalog rows, and the sqlx::AssertSqlSafe query of #1166.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MongoDB key-info lookup maps a connection fault to InternalServerError instead of ServiceUnavailable

3 participants