[SERVER-42300] listCollections can miss collections Created: 19/Jul/19  Updated: 29/Oct/23  Resolved: 25/Jul/19

Status: Closed
Project: Core Server
Component/s: Catalog, Storage
Affects Version/s: 4.2.0-rc3
Fix Version/s: 4.2.0-rc5, 4.3.1

Type: Bug Priority: Critical - P2
Reporter: Judah Schvimer Assignee: Geert Bosch
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-42301 Add ability to run a setup function o... Backlog
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.2
Steps To Reproduce:

On 28d9deadde968ed2025923d497f4bac9ed6f02bc:

diff --git a/jstests/concurrency/fsm_workloads/rename_collection_chain.js b/jstests/concurrency/fsm_workloads/rename_collection_chain.js
index cd6a541c17..cf2f6f4942 100644
--- a/jstests/concurrency/fsm_workloads/rename_collection_chain.js
+++ b/jstests/concurrency/fsm_workloads/rename_collection_chain.js
@@ -9,7 +9,6 @@
  */
 
 var $config = (function() {
-
     var data = {
         // Use the workload name as a prefix for the collection name,
         // since the workload name is assumed to be unique.
@@ -17,7 +16,6 @@ var $config = (function() {
     };
 
     var states = (function() {
-
         function uniqueCollectionName(prefix, tid, num) {
             return prefix + tid + '_' + num;
         }
@@ -35,11 +33,30 @@ var $config = (function() {
             this.fromCollName = toCollName;
         }
 
-        return {init: init, rename: rename};
+        function listCollections(db, collName) {
+            const collectionInfos = db.getCollectionInfos();
+            if (!this.allCollectionsInitialized) {
+                if (collectionInfos.length === this.threadCount) {
+                    this.allCollectionsInitialized = true;
+                    jsTestLog(`All collections visible to thread ${this.tid}: ${
+                        tojsononeline(collectionInfos)}`);
+                }
+            } else {
+                const numColls =
+                    collectionInfos.filter((collInfo) => collInfo.name.startsWith(this.prefix))
+                        .length;
+                assertAlways.eq(numColls, this.threadCount, () => tojson(collectionInfos));
+            }
+        }
 
+        return {init: init, rename: rename, listCollections: listCollections};
     })();
 
-    var transitions = {init: {rename: 1}, rename: {rename: 1}};
+    var transitions = {
+        init: {rename: 1},
+        rename: {rename: 0.9, listCollections: 0.1},
+        listCollections: {rename: 1},
+    };
 
     return {
         threadCount: 10,
@@ -48,5 +65,4 @@ var $config = (function() {
         states: states,
         transitions: transitions,
     };
-
 })();

Sprint: Execution Team 2019-07-15, Execution Team 2019-07-29
Participants:
Linked BF Score: 54

 Description   

listCollections may not see all active UUIDs. This breaks a key invariant required for initial sync.



 Comments   
Comment by Githook User [ 26/Jul/19 ]

Author:

{'name': 'Geert Bosch', 'username': 'GeertBosch', 'email': 'geert@mongodb.com'}

Message: SERVER-42300 Retry, not skip, renamed ns in forEachCollectionFromDb

(cherry picked from commit 917d338c4bf52dc8dce2c0e585a676385e81ed1c)
Branch: v4.2
https://github.com/mongodb/mongo/commit/911a2117e9b75d51dafa2d6dc5ba97bd8b85dc55

Comment by Githook User [ 25/Jul/19 ]

Author:

{'name': 'Geert Bosch', 'username': 'GeertBosch', 'email': 'geert@mongodb.com'}

Message: SERVER-42300 Retry, not skip, renamed ns in forEachCollectionFromDb
Branch: master
https://github.com/mongodb/mongo/commit/917d338c4bf52dc8dce2c0e585a676385e81ed1c

Comment by Kelsey Schubert [ 19/Jul/19 ]

milkie, I've marked this a GA blocker, could you assign it out?

cc geert.bosch

Generated at Thu Feb 08 05:00:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.