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

Panic in intersect scan with array index query

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.0.0
    • Cheshire-Cat
    • query
    • Untriaged
    • 1
    • No

    Description

      Occasional panic is seen when running array queries that involves an intersect scan. This is not readily reproducible, and appears to be a timing issue.

      Query:

      SELECT x.uniq_i, x.uniq_n, x.rand_i, x.rand_n, x.norm_i, x.norm_n, x.zipf_i, x.zipf_n, x.u016_i, x.u016_n, x.u256_i, x.u256_n, x.u04k_i, x.u04k_n, x.u64k_i, x.u64k_n FROM KS1 x WHERE ANY v IN rarr_i satisfies v <= 1127 END LIMIT 25;

      The stack trace when this happens:

      _time=2020-07-08T15:22:33.634-07:00 _level=SEVERE _msg=request text: <ud>SELECT x.uniq_i, x.uniq_n, x.rand_i, x.rand_n, x.norm_i, x.norm_n, x.zipf_i, x.zipf_n, x.u016_i, x.u016_n, x.u256_i, x.u256_n, x.u04k_i, x.u04k_n, x.u64k_i, x.u64k_n FROM KS1 x WHERE ANY v IN rarr_i satisfies v <= 1127 END LIMIT 25;</ud>
      _time=2020-07-08T15:22:33.634-07:00 _level=SEVERE _msg=query context: <ud></ud>
      _time=2020-07-08T15:22:33.634-07:00 _level=SEVERE _msg=stack: goroutine 392784283 [running]:
      github.com/couchbase/query/execution.(*Context).Recover(0xc00055d180, 0xc000887d40)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/execution/context.go:654 +0xbb
      panic(0x1fcb1e0, 0x3518580)
              /home/couchbase/.cbdepscache/exploded/x86_64/go-1.13.7/go/src/runtime/panic.go:679 +0x1b2
      github.com/couchbase/query/execution.(*valueExchange).dispose(0xc001196000)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/execution/exchange.go:145 +0x57
      github.com/couchbase/query/execution.(*base).baseDone(0xc001196000)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/execution/base.go:311 +0x9e
      github.com/couchbase/query/execution.(*base).Done(0xc001196000)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/execution/base.go:284 +0x2b
      github.com/couchbase/query/execution.(*IntersectScan).RunOnce.func1()
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/execution/scan_intersect.go:161 +0x7f7
      github.com/couchbase/query/util.(*Once).Do(0xc000887e48, 0xc000899f50)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/util/sync.go:55 +0x4a
      github.com/couchbase/query/execution.(*IntersectScan).RunOnce(0xc000887d40, 0xc00055d180, 0x0, 0x0)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/execution/scan_intersect.go:64 +0x82
      github.com/couchbase/query/execution.execOp(0x2553500, 0xc000887d40, 0xc00055d180, 0x0, 0x0)
              /home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/query/execution/base.go:478 +0x54
      created by github.com/couchbase/query/execution.(*base).fork
      

      and the query plan:

      {
          "#operator": "Sequence",
          "~children": [
              {
                  "#operator": "Sequence",
                  "~children": [
                      {
                          "#operator": "IntersectScan",
                          "limit": "25",
                          "scans": [
                              {
                                  "#operator": "DistinctScan",
                                  "scan": {
                                      "#operator": "IndexScan3",
                                      "as": "x",
                                      "index": "rarra_idx_KS1",
                                      "index_id": "580425afe52f3bda",
                                      "index_projection": {
                                          "primary_key": true
                                      },
                                      "keyspace": "KS1",
                                      "namespace": "default",
                                      "spans": [
                                          {
                                              "exact": true,
                                              "range": [
                                                  {
                                                      "high": "1127",
                                                      "inclusion": 2,
                                                      "low": "null"
                                                  }
                                              ]
                                          }
                                      ],
                                      "using": "gsi"
                                  }
                              },
                              {
                                  "#operator": "DistinctScan",
                                  "scan": {
                                      "#operator": "IndexScan3",
                                      "as": "x",
                                      "index": "rarrd_idx_KS1",
                                      "index_id": "b3e9dd26d0f523f8",
                                      "index_projection": {
                                          "primary_key": true
                                      },
                                      "keyspace": "KS1",
                                      "namespace": "default",
                                      "spans": [
                                          {
                                              "exact": true,
                                              "range": [
                                                  {
                                                      "high": "1127",
                                                      "inclusion": 2,
                                                      "low": "null"
                                                  }
                                              ]
                                          }
                                      ],
                                      "using": "gsi"
                                  }
                              }
                          ]
                      },
                      {
                          "#operator": "Fetch",
                          "as": "x",
                          "keyspace": "KS1",
                          "namespace": "default"
                      },
                      {
                          "#operator": "Parallel",
                          "~child": {
                              "#operator": "Sequence",
                              "~children": [
                                  {
                                      "#operator": "Filter",
                                      "condition": "any `v` in (`x`.`rarr_i`) satisfies (`v` <= 1127) end"
                                  },
                                  {
                                      "#operator": "InitialProject",
                                      "result_terms": [
                                          {
                                              "expr": "(`x`.`uniq_i`)"
                                          },
                                          {
                                              "expr": "(`x`.`uniq_n`)"
                                          },
                                          {
                                              "expr": "(`x`.`rand_i`)"
                                          },
                                          {
                                              "expr": "(`x`.`rand_n`)"
                                          },
                                          {
                                              "expr": "(`x`.`norm_i`)"
                                          },
                                          {
                                              "expr": "(`x`.`norm_n`)"
                                          },
                                          {
                                              "expr": "(`x`.`zipf_i`)"
                                          },
                                          {
                                              "expr": "(`x`.`zipf_n`)"
                                          },
                                          {
                                              "expr": "(`x`.`u016_i`)"
                                          },
                                          {
                                              "expr": "(`x`.`u016_n`)"
                                          },
                                          {
                                              "expr": "(`x`.`u256_i`)"
                                          },
                                          {
                                              "expr": "(`x`.`u256_n`)"
                                          },
                                          {
                                              "expr": "(`x`.`u04k_i`)"
                                          },
                                          {
                                              "expr": "(`x`.`u04k_n`)"
                                          },
                                          {
                                              "expr": "(`x`.`u64k_i`)"
                                          },
                                          {
                                              "expr": "(`x`.`u64k_n`)"
                                          }
                                      ]
                                  }
                              ]
                          }
                      }
                  ]
              },
              {
                  "#operator": "Limit",
                  "expr": "25"
              }
          ]
      }
      

      Attachments

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

        Activity

          People

            bingjie.miao Bingjie Miao
            bingjie.miao Bingjie Miao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty