[SERVER-83874] Move primary operation doesn't drop db.system.views on the donor Created: 05/Dec/23  Updated: 03/Jan/24  Resolved: 14/Dec/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.0.6, 6.0.12, 7.0.4, 7.2.0-rc3
Fix Version/s: 7.2.1, 7.3.0-rc0, 6.0.13, 5.0.24, 7.0.6

Type: Bug Priority: Major - P3
Reporter: Silvia Surroca Assignee: Silvia Surroca
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by SERVER-78852 Test movePrimary and $out running con... Closed
Problem/Incident
is caused by SERVER-58170 Prohibit dropping system.views if tim... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.2, v7.0, v6.0, v5.0
Steps To Reproduce:

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(); 

Sprint: CAR Team 2023-12-25
Participants:
Story Points: 2

 Description   

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().



 Comments   
Comment by Githook User [ 03/Jan/24 ]

Author:

{'name': 'Silvia Surroca', 'email': 'silvia.surroca@mongodb.com', 'username': 'silviasuhu'}

Message: SERVER-83874 Fix move primary operation doesn't drop db.system.views on the donor

GitOrigin-RevId: d929e2980ca1eb4a342048ba7a8041f055c61b37
Branch: v5.0
https://github.com/mongodb/mongo/commit/7fb89c429f52f5364734a6dcc8d7d9a41bd0f987

Comment by Githook User [ 02/Jan/24 ]

Author:

{'name': 'Silvia Surroca', 'email': 'silvia.surroca@mongodb.com', 'username': 'silviasuhu'}

Message: SERVER-83874 Move primary operation doesn't drop db.system.views on the donor

GitOrigin-RevId: 5947f85f4e0d93556befac3940e0c0b3486aa4a4
Branch: v6.0
https://github.com/mongodb/mongo/commit/079174718f1f967ebaa4cdee4aa532fb498b706a

Comment by Githook User [ 02/Jan/24 ]

Author:

{'name': 'Silvia Surroca', 'email': 'silvia.surroca@mongodb.com', 'username': 'silviasuhu'}

Message: SERVER-83874 Fix move primary operation doesn't drop db.system.views on the donor

(cherry picked from commit e5c597842397080d3c446a4535d5720f54e02835)
Branch: v7.2
https://github.com/mongodb/mongo/commit/7dd7f83d419e9758bade14fde33ac6df022c44a3

Comment by Githook User [ 02/Jan/24 ]

Author:

{'name': 'Silvia Surroca', 'email': 'silvia.surroca@mongodb.com', 'username': 'silviasuhu'}

Message: SERVER-83874 Fix move primary operation doesn't drop db.system.views on the donor

GitOrigin-RevId: 2635f414129539562f0cfd1871cb1c729927e296
Branch: v7.0
https://github.com/mongodb/mongo/commit/2fe5d1329165ffab8ce84d504079693fa81bf990

Comment by Githook User [ 14/Dec/23 ]

Author:

{'name': 'Silvia Surroca', 'email': 'silvia.surroca@mongodb.com', 'username': 'silviasuhu'}

Message: SERVER-83874 Fix move primary operation doesn't drop db.system.views on the donor

GitOrigin-RevId: 04f3688562f98359e27654086e84b3ebdf402548
Branch: master
https://github.com/mongodb/mongo/commit/cdb02e6d7c66aa8605693a32c3bfea4bb674dd47

Generated at Thu Feb 08 06:53:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.