Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-26321

[N1QL EXPLAIN] Intermittent: Distinct scan not being used in explain plan.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.6.4
    • 4.6.4
    • query
    • 4.6.4-4544
    • Untriaged
    • Yes

    Description

      Test which fails:
      test_covering_orderby_limit

      How to run the test?
      python testrunner.py -i query2.ini -c conf/tuq/py-covering-index.conf -p doc-per-day=6

      Query issued:
      explain select name,skills[0] as skills from default where skills[0]='skill2010' and join_yr=2010 and ( VMs[0].os IN ['ubuntu','windows','linux'] OR VMs[0].os IN ['ubuntu','windows','linux'] ) order by _id asc LIMIT 10 OFFSET 0;

      Index created:
      CREATE INDEX `coveringindexwithlimit0` ON `default`((`skills`[0]),`join_yr`,((`VMs`[0]).`os`),`name`) WHERE (`join_yr` = 2010)

      Assert which fails:
      self.assertTrue(plan["~children"][0]["~children"][0]"#operator" == "DistinctScan",
      "DistinctScan Operator is not used by this query")

      This assert has always passed but its failing intermittently now.

      The current plan is:

      [
        {
          "plan": {
            "#operator": "Sequence",
            "~children": [
              {
                "#operator": "Sequence",
                "~children": [
                  {
                    "#operator": "IndexScan",
                    "index": "coveringindexwithlimit0",
                    "index_id": "9de092d4ae6add05",
                    "keyspace": "default",
                    "limit": "(0 + 10)",
                    "namespace": "default",
                    "spans": [
                      {
                        "Exact": true,
                        "Range": {
                          "High": [
                            "\"skill2010\"",
                            "2010",
                            "successor(\"linux\")"
                          ],
                          "Inclusion": 1,
                          "Low": [
                            "\"skill2010\"",
                            "2010",
                            "\"linux\""
                          ]
                        }
                      },
                      {
                        "Exact": true,
                        "Range": {
                          "High": [
                            "\"skill2010\"",
                            "2010",
                            "successor(\"ubuntu\")"
                          ],
                          "Inclusion": 1,
                          "Low": [
                            "\"skill2010\"",
                            "2010",
                            "\"ubuntu\""
                          ]
                        }
                      },
                      {
                        "Exact": true,
                        "Range": {
                          "High": [
                            "\"skill2010\"",
                            "2010",
                            "successor(\"windows\")"
                          ],
                          "Inclusion": 1,
                          "Low": [
                            "\"skill2010\"",
                            "2010",
                            "\"windows\""
                          ]
                        }
                      }
                    ],
                    "using": "gsi"
                  },
                  {
                    "#operator": "Fetch",
                    "keyspace": "default",
                    "namespace": "default"
                  },
                  {
                    "#operator": "Parallel",
                    "~child": {
                      "#operator": "Sequence",
                      "~children": [
                        {
                          "#operator": "Filter",
                          "condition": "(((((`default`.`skills`)[0]) = \"skill2010\") and ((`default`.`join_yr`) = 2010)) and (((((`default`.`VMs`)[0]).`os`) in [\"ubuntu\", \"windows\", \"linux\"]) or ((((`default`.`VMs`)[0]).`os`) in [\"ubuntu\", \"windows\", \"linux\"])))"
                        },
                        {
                          "#operator": "InitialProject",
                          "result_terms": [
                            {
                              "expr": "(`default`.`name`)"
                            },
                            {
                              "as": "skills",
                              "expr": "((`default`.`skills`)[0])"
                            }
                          ]
                        }
                      ]
                    }
                  }
                ]
              },
              {
                "#operator": "Order",
                "limit": "10",
                "offset": "0",
                "sort_terms": [
                  {
                    "expr": "(`default`.`_id`)"
                  }
                ]
              },
              {
                "#operator": "Offset",
                "expr": "0"
              },
              {
                "#operator": "Limit",
                "expr": "10"
              },
              {
                "#operator": "FinalProject"
              }
            ]
          },
          "text": "select  name,skills[0] as skills  from default where skills[0]='skill2010' and join_yr=2010 and ( VMs[0].os IN ['ubuntu','windows','linux'] OR VMs[0].os IN ['ubuntu','windows','linux'] ) order by _id asc LIMIT 10 OFFSET 0;"
        }
      ]
       
      
      

      Attachments

        For Gerrit Dashboard: MB-26321
        # Subject Branch Project Status CR V

        Activity

          People

            Prerna.Manaktala Prerna Manaktala (Inactive)
            Prerna.Manaktala Prerna Manaktala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty