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

Make the wildcard index passthrough suite compatible with clustered indexes

    • Type: Icon: Engineering Test Engineering Test
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.0.0, 8.1.0-rc0, 8.0.0
    • Component/s: Testing Infrastructure
    • Query Optimization

      The wildcard index passthrough test suite sets up a series of overrides for createIndexes, listIndexes, etc. which automatically create wildcard indexes in collections, and then hide them from the output of listIndexes, DBCollection.prototype.getIndexes, etc. so that tests can (usually) run without any modifications.

       

      However, one of the overrides is a reimplementation of DBCollection.prototype.getIndexes based on an $indexStats aggregation. This is problematic because DBCollection.prototype.getIndexes and listIndexes return clustered indexes on their output, while $indexStats does not return clustered indexes, so tests may fail to see clustered indexes when running on the wildcard index passthrough suite.

       

      (Note: The behavior of $indexStats not returning clustered indexes is considered correct by the Catalog and Routing team.)
       

      Reproduction steps

      This can be reproduced with the following jstest:

      db.createCollection("clustered", {clusteredIndex: {"key": {_id: 1}, "unique": true}});
      assert.gt(db.clustered.getIndexes().length, 0)
      

      This test will pass when running on the core suite, but will fail when running on the core_wildcard_indexes suite.

       

      Potential fix

      A possible way to fix this issue is to make the overriden DBCollection.prototype.getIndexes call the original implementation of the same method (similar example), instead of re-implementing it in terms of an $indexStats aggregation.

            Assignee:
            Unassigned Unassigned
            Reporter:
            joan.bruguera-mico@mongodb.com Joan Bruguera Micó
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: