Fix removeTagsMetadataFromConfig namespace mismatch in DropCollectionCoordinator for viewful timeseries collections

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 8.0.0, 8.1.0, 9.0 Required, 8.2.0, 8.3.0
    • Component/s: Sharding
    • None
    • Catalog and Routing
    • ALL
    • πŸŸ₯ DDL
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      DropCollectionCoordinator::removeTagsMetadataFromConfig has the same namespace mismatch bug as SERVER-127450, but is triggered by a plain drop β€” no resharding required.

      Root Cause

      In src/mongo/db/global_catalog/ddl/drop_collection_coordinator.cpp:412, the coordinator calls sharding_ddl_util::removeTagsMetadataFromConfig(opCtx, nss(), session). For a viewful timeseries collection, nss() resolves to the bucket namespace (e.g. db.system.buckets.coll) because _translateTimeseriesNss sets bucketNss on the coordinator metadata. Zone tags written via updateZoneKeyRange / sh.addTagRange() are always stored under the user-facing namespace (e.g. db.coll). The drop therefore only removes tags for the bucket namespace, leaving user-facing tags orphaned in config.tags.

      Impact

      Steps to reproduce:

      1. Call updateZoneKeyRange on testDb.testColl (a viewful timeseries collection) β†’ tag stored under testDb.testColl
      2. Drop testDb.testColl β†’ removeTagsMetadataFromConfig is called with the bucket nss β†’ tag under testDb.testColl is not removed
      3. Recreate testDb.testColl as a non-timeseries collection β†’ the balancer looks up zones by exact namespace, finds the orphaned tag, and incorrectly applies it to the new collection

      This reproduces without resharding and without a version upgrade, broadening the surface area relative to SERVER-127450.

      Β 

      Pre-existing orphaned config.tags entries β€” created either by this drop bug or by the resharding bug (SERVER-127450) β€” are also dormant until a v9.0 FCV upgrade, at which point viewless timeseries means config.tags is queried by user-facing namespace and the orphans become live. Since CAR already performs namespace migrations in src/mongo/db/global_catalog/ddl/timeseries_upgrade_downgrade_coordinator.cpp (see updateZonesInTransaction), the scrubbing logic to clean up pre-existing orphans is a natural fit there and is tracked inΒ SERVER-129106.

      Related

      • SERVER-127450 β€” resharding variant of the same namespace mismatch (CS-owned fix)
      • PR #54371 β€” discussion thread where both bugs were identified

            Assignee:
            Unassigned
            Reporter:
            Anja Kalaba
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: