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

dropIndexes() on a timeseries view namespace doesn't fail with buckets UUID

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • ALL
    • Hide

       

      const tsViewName = "tsViewNs";
      db.createCollection(tsViewName, {timeseries: {timeField: "t", metaField: "m"}});
      const bucketsCollName = `system.buckets.${tsViewName}`;
      const bucketsUUID = db.getCollectionInfos({name: bucketsCollName})[0].info.uuid;
      
      // This fails, but not with CollectionUUIDMismatch 
      assert.commandWorked(
          db.runCommand({dropIndexes: tsViewName, index: {"myField": 1}, collectionUUID: bucketsUUID}));
           
      [js_test:myrepro] uncaught exception: Error: command failed: {
      [js_test:myrepro]     "ok" : 0,
      [js_test:myrepro]     "errmsg" : "can't find index with key: { control.min.myField: 1.0, control.max.myField: 1.0 }",
      [js_test:myrepro]     "code" : 27,
      [js_test:myrepro]     "codeName" : "IndexNotFound"
      [js_test:myrepro] } with original command request: {
      [js_test:myrepro]     "dropIndexes" : "tsViewNs",
      [js_test:myrepro]     "index" : {
      [js_test:myrepro]         "myField" : 1
      [js_test:myrepro]     },
      [js_test:myrepro]     "collectionUUID" : UUID("5c087717-6cb6-4492-92bc-2f683212be5e"),
      [js_test:myrepro]     "lsid" : {
      [js_test:myrepro]         "id" : UUID("f7bd74b5-a114-442c-8d48-292697d11f5d")
      [js_test:myrepro]     }
      [js_test:myrepro] }

       

      Show
        const tsViewName = "tsViewNs" ; db.createCollection(tsViewName, {timeseries: {timeField: "t" , metaField: "m" }}); const bucketsCollName = `system.buckets.${tsViewName}`; const bucketsUUID = db.getCollectionInfos({name: bucketsCollName})[0].info.uuid; // This fails, but not with CollectionUUIDMismatch assert .commandWorked(     db.runCommand({dropIndexes: tsViewName, index: { "myField" : 1}, collectionUUID: bucketsUUID}));     [js_test:myrepro] uncaught exception: Error: command failed: { [js_test:myrepro]     "ok" : 0, [js_test:myrepro]     "errmsg" : "can't find index with key: { control.min.myField: 1.0, control.max.myField: 1.0 }" , [js_test:myrepro]     "code" : 27, [js_test:myrepro]     "codeName" : "IndexNotFound" [js_test:myrepro] } with original command request: { [js_test:myrepro]     "dropIndexes" : "tsViewNs" , [js_test:myrepro]     "index" : { [js_test:myrepro]         "myField" : 1 [js_test:myrepro]     }, [js_test:myrepro]     "collectionUUID" : UUID( "5c087717-6cb6-4492-92bc-2f683212be5e" ), [js_test:myrepro]     "lsid" : { [js_test:myrepro]         "id" : UUID( "f7bd74b5-a114-442c-8d48-292697d11f5d" ) [js_test:myrepro]     } [js_test:myrepro] }  

      A timeseries collection is really a view on top of an underlying 'system.buckets.<tsCollName>' collection. 

      Running dropIndexes() on the timeseries view namespace with its underlying buckets collection's UUID doesn't return CollectionUUIDMismatch. 

      This contradicts standard 'view' behavior where a CollectionUUIDMismatch would be returned with the 'expectedCollection' being the view name provided in the command. 

      Example behavior on a normal view: 

      db.students.insertMany([
          {sID: 22001, name: "Alex", year: 1, score: 4.0},
          {sID: 21001, name: "bernie", year: 2, score: 3.7},
          {sID: 20010, name: "Chris", year: 3, score: 2.5},
          {sID: 22021, name: "Drew", year: 1, score: 3.2},
          {sID: 17301, name: "harley", year: 6, score: 3.1},
          {sID: 21022, name: "Farmer", year: 1, score: 2.2},
          {sID: 20020, name: "george", year: 3, score: 2.8},
          {sID: 18020, name: "Harley", year: 5, score: 2.8},
      ]);
      db.createView("firstYears", "students", [{$match: {year: 1}}]);
      const studentsUUID = db.getCollectionInfos({name: "students"})[0].info.uuid;
      
      // Running CRUD on the 'view' with the underlying collection's UUID fails
      db.runCommand({find: "firstYears", collectionUUID: studentsUUID})
      
           uncaught exception: Error: command failed: {
              	"ok" : 0,
              	"errmsg" : "Collection UUID does not match that specified",
              	"code" : 361,
              	"codeName" : "CollectionUUIDMismatch",
              	"db" : "test",
              	"collectionUUID" : UUID("ea08dba4-80a7-4bff-bc0f-8a1dc62812fd"),
              	"expectedCollection" : "firstYears",
              	"actualCollection" : "students"
              }

       

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            haley.connelly@mongodb.com Haley Connelly
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: