Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-91090

moveCollection and unshardCollection do sampling on the source collection despite creating a single chunk, leading to error response for small capped collections

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 8.1.0-rc0, 8.0.0-rc8
    • Affects Version/s: 8.0.0-rc7
    • Component/s: Sharding
    • None
    • Cluster Scalability
    • Fully Compatible
    • ALL
    • v8.0
    • Cluster Scalability 2024-6-10, Cluster Scalability 06/24/24
    • 0

      moveCollection and unshardCollection configure the resharding machinery to use numInitialChunks == 1 which runs a {$sample: {size: 10}} aggregation on the source collection. This is mostly harmless but for capped collections it can fail with CappedPositionLost due to the sampling being concurrent with the capped truncation. We should consider having numInitialChunks == 1 skip using SamplingBasedSplitPolicy and to instead initialize the single [MinKey(), MaxKey()] chunk range directly.

      [j0:s1:prim] | 2024-05-29T10:20:14.412+01:00 E  ASSERT   4457000 [S] [Balancer] "Tripwire assertion","attr":{"error":{"code":8959500,"codeName":"Location8959500","errmsg":"An unexpected error occured while moving a random unsharded collection, from: shard-rs0, to: config, nss: test15_fsmdb0.create_capped_collection_maxdocs2_1, error: CappedPositionLost: Command request failed on source shard. :: caused by :: PlanExecutor error during aggregation :: caused by :: CollectionScan died due to position in capped collection being deleted. Last seen record id: RecordId(788)"},"location":"{fileName:\"src\\mongo\\db\\s\\balancer\\move_unsharded_policy.cpp\", line:292, functionName:\"applyActionResult\"}"}
      

      https://parsley.mongodb.com/resmoke/mongodb_mongo_master_windows_debug_suggested_concurrency_sharded_with_balancer_and_auto_bootstrap_1_windows_0e7b90b1c6f0d388f78afc0e53063241581b5aeb_24_05_29_04_19_06/0/job0/all?bookmarks=0,4680293&shareLine=3881595

            Assignee:
            kshitij.gupta@mongodb.com Kshitij Gupta
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: