Index consolidation must not consider empty indexes as covered on unsupported queries

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 0.0.11
    • Affects Version/s: None
    • Component/s: index-recommendation
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • 2
    • Iteration A (Apr 21 - May 5)
    • Not Needed
    • Developer Tools

      Problem Statement/Rationale

      What is going wrong? What action would you like the Engineering team to take?

      When we consolidate indexes from queries we don't support, these indexes are empty as we don't process any field. This doesn't affect the index detection, but when we consolidate indexes, as an empty index is a prefix of any other index, we consider these not supported queries covered. That's misleading, because a MongoDB index can not cover an Atlas Search query.

      Steps to Reproduce

      How could an engineer replicate the issue you’re reporting?

      @Test
      fun `should not cover empty indexes with other indexes`() {
          val index = CollectionIndexConsolidation.apply(
            baseIndex = indexOf("f1" to 1, "f2" to 1) {
                query {
                    findMany("my.coll".toNs()) {
                        filterBy {
                            predicate(Name.EQ) {
                                schema("should_be_covered")
                            }
                        }
                    }
                }
            },
      
            indexes = listOf(indexOf() {
                query {
                    findMany("my.coll".toNs()) {
                        filterBy {
                            predicate(Name.EQ) {
                                schema("should_NOT_be_covered")
                            }
                        }
                    }
                }
            }),
            options = emptyOptions()
          )
      
          assertMongoDbIndexIs(arrayOf("f1" to 1, "f2" to 1), index)
          assertNumberOfCoveredQueriesForIndex(1, index)
      }
      

      Expected Results

      What do you expect to happen?

      Actual Results

      What do you observe is happening?

      Additional Notes

      Any additional information that may be useful to include.

            Assignee:
            Kevin Mas Ruiz
            Reporter:
            Kevin Mas Ruiz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: