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

[IndexAPI2] cbq engine panics with create index desc

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 5.0.0
    • 5.0.0
    • query
    • None
    • Untriaged
    • Unknown

    Description

      cbq-engine panics on "CREATE INDEX ID1 on `default`(col1 DESC)"

      _time=2017-03-04T17:15:55.337-08:00 _level=ERROR _msg= panic=runtime error: index out of range stack=goroutine 736 [running
      ]:
      github.com/couchbase/query/execution.(*Context).Recover(0xc42129bb00)
              /Users/deepkaran/workspace/cb_spock/goproj/src/github.com/couchbase/query/execution/context.go:454 +0xbc
      panic(0x48cf200, 0x5017670)
              /Users/deepkaran/.cbdepscache/exploded/x86_64/go-1.8/go/src/runtime/panic.go:489 +0x2cf
      github.com/couchbase/query/execution.(*CreateIndex).RunOnce.func1()
              /Users/deepkaran/workspace/cb_spock/goproj/src/github.com/couchbase/query/execution/index_create.go:68 +0x493
      sync.(*Once).Do(0xc4212a1550, 0xc4205cc798)
              /Users/deepkaran/.cbdepscache/exploded/x86_64/go-1.8/go/src/sync/once.go:44 +0xbe
      github.com/couchbase/query/execution.(*CreateIndex).RunOnce(0xc4212a1500, 0xc42129bb00, 0x0, 0x0)
              /Users/deepkaran/workspace/cb_spock/goproj/src/github.com/couchbase/query/execution/index_create.go:88 +0x5f
      created by github.com/couchbase/query/execution.(*Authorize).RunOnce.func1
              /Users/deepkaran/workspace/cb_spock/goproj/src/github.com/couchbase/query/execution/authorize.go:81 +0x2c6
       
      goroutine 736 [running]:
      github.com/couchbase/query/execution.(*Context).Recover(0xc42129bb00)
              /Users/deepkaran/workspace/cb_spock/goproj/src/github.com/couchbase/query/execution/context.go:454 +0xbc
      panic(0x48cf200, 0x5017670)
              /Users/deepkaran/.cbdepscache/exploded/x86_64/go-1.8/go/src/runtime/panic.go:489 +0x2cf
      github.com/couchbase/query/execution.(*CreateIndex).RunOnce.func1()
              /Users/deepkaran/workspace/cb_spock/goproj/src/github.com/couchbase/query/execution/index_create.go:68 +0x493
      sync.(*Once).Do(0xc4212a1550, 0xc4205cc798)
              /Users/deepkaran/.cbdepscache/exploded/x86_64/go-1.8/go/src/sync/once.go:44 +0xbe
      github.com/couchbase/query/execution.(*CreateIndex).RunOnce(0xc4212a1500, 0xc42129bb00, 0x0, 0x0)
              /Users/deepkaran/workspace/cb_spock/goproj/src/github.com/couchbase/query/execution/index_create.go:88 +0x5f
      created by github.com/couchbase/query/execution.(*Authorize).RunOnce.func1
              /Users/deepkaran/workspace/cb_spock/goproj/src/github.com/couchbase/query/execution/authorize.go:81 +0x2c6
      

      I have done the below change locally to unblock:

      diff --git a/execution/index_create.go b/execution/index_create.go
      index e361687..1c0de6d 100644
      --- a/execution/index_create.go
      +++ b/execution/index_create.go
      @@ -63,7 +63,7 @@ func (this *CreateIndex) RunOnce(context *Context, parent value.Value) {
                      }
       
                      if indexer2, ok := indexer.(datastore.Indexer2); ok {
      -                       rangeKey := make(datastore.IndexKeys, 0, len(node.Keys()))
      +                       rangeKey := make(datastore.IndexKeys, len(node.Keys()))
                              for i, term := range node.Keys() {
                                      rangeKey[i] = &datastore.IndexKey{Expr: term.Expression(), Desc: term.Descending()}
                              }
      

      Attachments

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

        Activity

          People

            Prerna.Manaktala Prerna Manaktala (Inactive)
            deepkaran.salooja Deepkaran Salooja
            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