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

Move primary operation doesn't drop db.system.views on the donor

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.1, 7.3.0-rc0, 6.0.13, 5.0.24, 7.0.6
    • Affects Version/s: 5.0.6, 6.0.12, 7.0.4, 7.2.0-rc3
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v7.2, v7.0, v6.0, v5.0
    • Hide
      const st = new ShardingTest({mongos: 1, shards: 2, rs: {nodes: 1}});
      const dbName = "test";
      const coll = st.s.getDB(dbName).getCollection("coll");
      assert.commandWorked(
          st.s.adminCommand({enableSharding: dbName, primaryShard: st.shard0.shardName}));
      const timeField = 'time';
      const metaField = 'meta';
      assert.commandWorked(st.s.adminCommand(
      {     shardCollection: coll.getFullName(),     key: \{[metaField]: 1, [timeField]: 1}
      ,
          timeseries: {timeField: timeField, metaField: metaField}
      }));
      assert.commandWorked(st.s.adminCommand({movePrimary: dbName, to: st.shard1.shardName}));
      assert.commandWorked(st.s.adminCommand({movePrimary: dbName, to: st.shard0.shardName}));
      st.stop(); 
      Show
      const st = new ShardingTest({mongos: 1, shards: 2, rs: {nodes: 1}}); const dbName = "test"; const coll = st.s.getDB(dbName).getCollection("coll"); assert.commandWorked(     st.s.adminCommand({enableSharding: dbName, primaryShard: st.shard0.shardName})); const timeField = 'time'; const metaField = 'meta'; assert.commandWorked(st.s.adminCommand( {     shardCollection: coll.getFullName(),     key: \{[metaField]: 1, [timeField]: 1} ,     timeseries: {timeField: timeField, metaField: metaField} })); assert.commandWorked(st.s.adminCommand({movePrimary: dbName, to: st.shard1.shardName})); assert.commandWorked(st.s.adminCommand({movePrimary: dbName, to: st.shard0.shardName})); st.stop();
    • CAR Team 2023-12-25
    • 2

      The movePrimay donor performs a drop of all the cloned collections at the end of the DDL operation.

      Currently, the drop of <db>.system.views collection may fail if sharded views live on the donor shard. The error msg of the drop is this: "cannot drop collection <nss> when time-series collections are present".

      Therefore, if another movePrimary tries to move back the DBPrimary to the original shard, the operation will fail with the error "Found orphaned collection <db>.system.views on recipient" error.

      To fix it, we need to force the drop of any system collections on MovePrimaryCoordinator::dropStaleDataOnDonor().

            Assignee:
            silvia.surroca@mongodb.com Silvia Surroca
            Reporter:
            silvia.surroca@mongodb.com Silvia Surroca
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: