Refactor FilteringMetadataCache into ShardMetadataRecoveryHandler facade with domain-specific sub-handlers

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • CAR Team 2026-04-13
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      FilteringMetadataCache is a monolithic class that handles collection metadata recovery, database metadata recovery, lifecycle management, and shared utilities all in a single flat interface.

      This ticket decomposes the class into a facade pattern:

      • ShardMetadataRecoveryHandler becomes the facade. It owns the CatalogCache and ShardServerCatalogCacheLoader, remains registered as a ServiceContext decoration, and handles lifecycle operations. It delegates recovery work to two domain-specific handlers.
      • ShardCollectionMetadataRecoveryHandler handles collection version mismatch recovery (onShardVersionMismatch), collection flush, end-marker notifications, and forced collection refresh. It internally dispatches between authoritative and non-authoritative code paths based on feature flags.
      • ShardDatabaseMetadataRecoveryHandler handles database version mismatch recovery (onDbVersionMismatch), database flush, and forced database refresh, with the same authoritative/non-authoritative dispatch.

      This is a pure structural refactor with no behavioral changes.

            Assignee:
            Pol Pinol
            Reporter:
            Pol Pinol
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: