Skip to content

MongoDB: a TTL enable whose index build lands after DeleteTable dropped the collection recreates it #605

Open

Description

@LeeroyHannigan

Summary

On MongoDB, UpdateTimeToLive enable runs update_ttl on the catalog document, then create_ttl_index, which reads the document and runs create_index on _ddb_<table_id>. A DeleteTable that marks the document and drops the collection between those two steps lets create_index create the collection again to hold the index; the delete then removes the only document that names it, and nothing sweeps orphaned data collections.

Measured (MongoDB 7, single-node replica set, 2026-10-26)

DeleteTable and UpdateTimeToLive enable raced through the API, twenty rounds per build: an orphaned _ddb_<id> collection with idx_ttl_ttl after 4 of 20 rounds on main. With #599 (no index DDL for a document read as DELETING, and an ACTIVE filter on create_ttl_index's catalog read) the window narrows to a catalog read taken before the mark with the create_index after the drop: 1 of 20 in one run and 0 of 80 in another.

Notes

The remaining case needs the collection drop and the index build to be ordered, or a sweep for data collections with no catalog document (worker_store.rs reconciles CREATING to ACTIVE only). list_collection_names on the data database shows the orphan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:mongodbRelated to the MongoDB backend specifically.bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions