Details
-
Bug
-
Resolution: Fixed
-
Test Blocker
-
4.0.0
-
Security Level: Public
-
Untriaged
-
Unknown
Description
A bucket is refreshed multiple times (3) for a simple select * from bucket query. Here is the back-trace of the code paths that end up causing bucket refresh.
A GetBucket call to datastore/couchbase will always cause a bucket refresh, this is what we had decided in order to avoid configuration cache invalidation issues. We need to find a way to avoid multiple calls to GetBucket or detect within datastore layer that a refresh() has already been done earlier for a particular query.
2015/04/16 13:12:43
======== Stack /Users/manik/sherlock/goproj/src/github.com/couchbase/go-couchbase/pools.go:556 (0x43e7a19)
(*Bucket).Refresh: log.Printf("\n ======== Stack %v ====== \n", string(debug.Stack()))
/Users/manik/sherlock/goproj/src/github.com/couchbase/go-couchbase/pools.go:661 (0x43e8e89)
(*Pool).GetBucket: err := rv.Refresh()
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/datastore/couchbase/couchbase.go:367 (0x41c8211)
(*namespace).KeyspaceByName: newbucket, err := p.cbNamespace.GetBucket(name)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build.go:85 (0x422a13a)
(*builder).getTermKeyspace: keyspace, err := namespace.KeyspaceByName(node.Keyspace())
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build_select_sub.go:288 (0x4239df5)
(*builder).fastCount: keyspace, err := this.getTermKeyspace(from)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build_select_sub.go:26 (0x42351da)
(*builder).VisitSubselect: count, err := this.fastCount(node)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/algebra/select_sub.go:46 (0x445b270)
(*Subselect).Accept: return visitor.VisitSubselect(this)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build_select.go:40 (0x4234582)
(*builder).VisitSelect: sub, err := stmt.Subresult().Accept(this)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/algebra/select.go:58 (0x445a060)
(*Select).Accept: return visitor.VisitSelect(this)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build.go:23 (0x4229aa6)
Build: o, err := stmt.Accept(builder)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/prepared.go:25 (0x424b717)
BuildPrepared: operator, err := Build(stmt, datastore, systemstore, namespace, subquery)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/server/server.go:195 (0x408c66e)
(*Server).getPrepared: prepared, err = plan.BuildPrepared(stmt, this.datastore, this.systemstore, namespace, false)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/server/server.go:146 (0x408bc8b)
(*Server).serviceRequest: prepared, err := this.getPrepared(request, namespace)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/server/server.go:121 (0x408bb64)
(*Server).doServe: this.serviceRequest(request)
/usr/local/go/src/pkg/runtime/proc.c:1445 (0x4016a10)
goexit: runtime·goexit(void)
======
2015/04/16 13:12:43
======== Stack /Users/manik/sherlock/goproj/src/github.com/couchbase/go-couchbase/pools.go:556 (0x43e7a19)
(*Bucket).Refresh: log.Printf("\n ======== Stack %v ====== \n", string(debug.Stack()))
/Users/manik/sherlock/goproj/src/github.com/couchbase/go-couchbase/pools.go:661 (0x43e8e89)
(*Pool).GetBucket: err := rv.Refresh()
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/datastore/couchbase/couchbase.go:367 (0x41c8211)
(*namespace).KeyspaceByName: newbucket, err := p.cbNamespace.GetBucket(name)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build.go:85 (0x422a13a)
(*builder).getTermKeyspace: keyspace, err := namespace.KeyspaceByName(node.Keyspace())
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build_select_sub.go:160 (0x4238225)
(*builder).VisitKeyspaceTerm: keyspace, err := this.getTermKeyspace(node)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/algebra/from.go:111 (0x444a300)
(*KeyspaceTerm).Accept: return visitor.VisitKeyspaceTerm(this)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build_select_sub.go:34 (0x4236be6)
(*builder).VisitSubselect: _, err := node.From().Accept(this)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/algebra/select_sub.go:46 (0x445b270)
(*Subselect).Accept: return visitor.VisitSubselect(this)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build_select.go:40 (0x4234582)
(*builder).VisitSelect: sub, err := stmt.Subresult().Accept(this)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/algebra/select.go:58 (0x445a060)
(*Select).Accept: return visitor.VisitSelect(this)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/build.go:23 (0x4229aa6)
Build: o, err := stmt.Accept(builder)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/plan/prepared.go:25 (0x424b717)
BuildPrepared: operator, err := Build(stmt, datastore, systemstore, namespace, subquery)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/server/server.go:195 (0x408c66e)
(*Server).getPrepared: prepared, err = plan.BuildPrepared(stmt, this.datastore, this.systemstore, namespace, false)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/server/server.go:146 (0x408bc8b)
(*Server).serviceRequest: prepared, err := this.getPrepared(request, namespace)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/server/server.go:121 (0x408bb64)
(*Server).doServe: this.serviceRequest(request)
/usr/local/go/src/pkg/runtime/proc.c:1445 (0x4016a10)
goexit: runtime·goexit(void)
======
_time=2015-04-16T13:12:43+05:30 _level=INFO _msg=Refreshing Indexes in keyspace beer-sample
_time=2015-04-16T13:12:43+05:30 _level=INFO _msg=Found index name #primary keyspace beer-sample Primary index true
_time=2015-04-16T13:12:43+05:30 _level=INFO _msg=Found index on keyspace beer-sample
_time=2015-04-16T13:12:43+05:30 _level=INFO _msg= Number of primary indexes on b0 1
2015/04/16 13:12:43
======== Stack /Users/manik/sherlock/goproj/src/github.com/couchbase/go-couchbase/pools.go:556 (0x43e7a19)
(*Bucket).Refresh: log.Printf("\n ======== Stack %v ====== \n", string(debug.Stack()))
/Users/manik/sherlock/goproj/src/github.com/couchbase/go-couchbase/pools.go:661 (0x43e8e89)
(*Pool).GetBucket: err := rv.Refresh()
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/datastore/couchbase/couchbase.go:574 (0x41caa0c)
(*keyspace).Count: cbBucket, err := ns.GetBucket(b.Name())
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/execution/scan_primary.go:94 (0x420d3a6)
(*PrimaryScan).newIndexConnection: size, err := keyspace.Count()
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/execution/scan_primary.go:55 (0x420cebf)
(*PrimaryScan).scanPrimary: conn := this.newIndexConnection(context)
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/execution/scan_primary.go:50 (0x421af49)
func.024: this.scanPrimary(context, parent)
/usr/local/go/src/pkg/sync/once.go:40 (0x40c758f)
(*Once).Do: f()
/Users/manik/sherlock/goproj/src/github.com/couchbase/query/execution/scan_primary.go:51 (0x420ce63)
(*PrimaryScan).RunOnce: })
/usr/local/go/src/pkg/runtime/proc.c:1445 (0x4016a10)
goexit: runtime·goexit(void)