Fix orphaned config.tags cleanup for timeseries resharding in viewful timeseries collections

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Cluster Scalability
    • Fully Compatible
    • v8.3, v8.0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      In mixed-version clusters where a last-continuous (pre-9.0) mongos is present, reshardCollection for timeseries collections is routed using the bucket namespace (e.g. db.system.buckets.coll), while updateZoneKeyRange stores zone tags under the user-facing namespace (e.g. db.coll). When resharding commits, writeDecisionPersistedState only deletes config.tags entries for sourceNss (the bucket namespace), leaving behind orphaned tag documents under the user-facing namespace.

      Root Cause

      In src/mongo/db/s/resharding/resharding_coordinator_service_util.cpp, the writeDecisionPersistedState function calls removeTagsDocs with a query for coordinatorDoc.getSourceNss(). When a pre-9.0 mongos routes the reshardCollection command, sourceNss is the bucket namespace (system.buckets.X). Zone tags written via updateZoneKeyRange on a new-binary mongos use the user-facing namespace — those entries are never cleaned up on commit.

      Fix

      After deleting tags for sourceNss, additionally check sourceNss.isTimeseriesBucketsCollection(). If true, derive the user-facing view namespace and delete any config.tags entries under that namespace as well.

      Testing

      The assertion verifying zero orphaned tags is in jstests/sharding/resharding_timeseries/reshard_timeseries_update_tag_zones.js (postCheckFn). It is temporarily disabled in SERVER-126221 (which introduces the test infrastructure) with a TODO to re-enable it here.

      Depends on

      SERVER-126221 (introduces the resharding timeseries zone test infrastructure that exercises this bug)

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

              Created:
              Updated:
              Resolved: