Description
Found this while investigating MB-42445.
I happened to have CBO enabled and have run update statistics on `travel-sample` before attempting the repro for MB-42445.
Load travel-sample bucket. Only have primary index available.
CREATE PRIMARY INDEX ON `travel-sample`;
UPDATE STATISTICS FOR `travel-sample`(city, country, faa);
SELECT ADVISOR({'action': 'start', 'duration': '5m', 'query_count': 10 }); // note query count here is 10, not 1 as in the original repro for MB-42445 |
|
SELECT city FROM `travel-sample` WHERE lower(city) = 'lyon' and country = 'France'; |
|
SELECT ADVISOR({'action': 'stop', 'session': '7879c188-82bd-453c-91ae-4608eb678399' }); // replace with the session id you got from the start action above |
this causes a panic when the index advisor attempts to run internal UPDATE STATISTICS command for CBO-based advise.
Stack:
_time=2020-11-09T15:53:17.983-07:00 _level=SEVERE _msg=panic: interface conversion: interface is nil, not query_ee.Context |
_time=2020-11-09T15:53:17.983-07:00 _level=SEVERE _msg=request text: <ud>SELECT RAW Advisor((SELECT statement, queryContext as query_context from system:completed_requests where requestTime between "2020-11-09T15:52:59.032-07:00" and DATE_ADD_STR("2020-11-09T15:52:59.032-07:00", 300,"second") order by requestTime limit 10))</ud> |
_time=2020-11-09T15:53:17.983-07:00 _level=SEVERE _msg=query context: <ud></ud> |
_time=2020-11-09T15:53:17.983-07:00 _level=SEVERE _msg=stack: goroutine 31151 [running]: |
github.com/couchbase/query/execution.(*Context).Recover(0xc002abd8c0, 0xc002abdd40) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/execution/context.go:888 +0xbb |
panic(0x549ec20, 0xc002ae0030) |
/usr/local/Cellar/go/1.13.7/libexec/src/runtime/panic.go:679 +0x1b2 |
github.com/couchbase/query-ee/updstat.(*DefaultStatUpdater).UpdateStatistics(0xc003094080, 0x5a85200, 0xc0005ac9c0, 0x0, 0x0, 0x0, 0xc003057a70, 0x1, 0x1, 0x0, ...) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query-ee/updstat/upd_statistics.go:57 +0x6d |
github.com/couchbase/query-ee/indexadvisor.genHistogram(0x0, 0x0, 0x5a85200, 0xc0005ac9c0, 0xc003057a70, 0x1, 0x1, 0x0, 0x0) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query-ee/indexadvisor/cbidxgenerator.go:273 +0xeb |
github.com/couchbase/query-ee/indexadvisor.collectSelctivity(0xc002e91c28, 0x1, 0x1, 0xc002e91c90, 0x1, 0x1, 0x0, 0x0) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query-ee/indexadvisor/cbidxgenerator.go:114 +0x9ab |
github.com/couchbase/query-ee/indexadvisor.generateIndex(0xc0002d03c0, 0xc002d7c4b0, 0xc002d7c2d0, 0xc0029fd620, 0x2, 0x2, 0x0, 0x0, 0xc002bbe780, 0x5a9ed40, ...) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query-ee/indexadvisor/indexgenerator.go:70 +0x15c |
github.com/couchbase/query-ee/indexadvisor.AdviseIdxs(0xc002c411d0, 0xc002d7c2d0, 0xc0029fd620, 0x2, 0x2, 0x0, 0x0, 0x5748200) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query-ee/indexadvisor/indexgenerator.go:46 +0x298 |
github.com/couchbase/query/planner.(*builder).VisitAdvise(0xc0029ebd40, 0xc002bbe500, 0x240, 0x5707ce0, 0x4, 0xc0029ebd40) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/planner/build_advise_ee.go:66 +0x198 |
github.com/couchbase/query/algebra.(*Advise).Accept(0xc002bbe500, 0x5a8bf20, 0xc0029ebd40, 0xc002c411a0, 0xc002adb430, 0x4a47cc3, 0x0) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/algebra/advise.go:37 +0x3b |
github.com/couchbase/query/planner.Build(0x5a702e0, 0xc002bbe500, 0x5a89160, 0xc000140b60, 0x5a89460, 0xc000520620, 0x578f2e2, 0x7, 0x56d0000, 0xc002911d50, ...) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/planner/build.go:32 +0x19d |
github.com/couchbase/query/planner.BuildPrepared(0x5a702e0, 0xc002bbe500, 0x5a89160, 0xc000140b60, 0x5a89460, 0xc000520620, 0x578f2e2, 0x7, 0x0, 0xc002911d50, ...) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/planner/build_prepared.go:20 +0xc0 |
github.com/couchbase/query/execution.(*Context).PrepareStatement(0xc002abd8c0, 0xc00272daa0, 0x5a, 0x0, 0x0, 0x0, 0x0, 0x100, 0xc00272daa0, 0x5a, ...) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/execution/eval_stmt.go:179 +0x441 |
github.com/couchbase/query/execution.(*Context).EvaluateStatement(0xc002abd8c0, 0xc00272daa0, 0x5a, 0x0, 0x0, 0x0, 0x0, 0x100, 0x5a8d360, 0xc0029fc940, ...) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/execution/eval_stmt.go:119 +0x99 |
github.com/couchbase/query/expression.(*Advisor).Apply(0xc0029452c0, 0x5a6a4c0, 0xc002abd8c0, 0x5a8d360, 0xc0029e37e0, 0x5a8d360, 0xc0029e37e0, 0x0, 0x0) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/expression/func_advisor.go:177 +0x501 |
github.com/couchbase/query/expression.(*UnaryFunctionBase).UnaryEval(0xc0029452c0, 0x5a27480, 0xc0029452c0, 0x5a8c3a0, 0xc00013e180, 0x5a6a4c0, 0xc002abd8c0, 0x56795c0, 0x571dc20, 0x4081e00, ...) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/expression/function.go:346 +0xec |
github.com/couchbase/query/expression.(*Advisor).Evaluate(0xc0029452c0, 0x5a8c3a0, 0xc00013e180, 0x5a6a4c0, 0xc002abd8c0, 0xc044b6e824, 0xc000073400, 0xc0005cfcb0, 0x4050a12) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/expression/func_advisor.go:73 +0x70 |
github.com/couchbase/query/execution.(*InitialProject).processItem(0xc002abdd40, 0x5ac8f80, 0xc00013e180, 0xc002abd8c0, 0xc00013e180) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/execution/project_initial.go:107 +0x119 |
github.com/couchbase/query/execution.(*base).runConsumer.func1()
|
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/execution/base.go:829 +0x2d7 |
github.com/couchbase/query/util.(*Once).Do(0xc002abde60, 0xc0005cff00) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/util/sync.go:55 +0x4a |
github.com/couchbase/query/execution.(*base).runConsumer(0xc002abdd40, 0x5a5bec0, 0xc002abdd40, 0xc002abd8c0, 0x0, 0x0) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/execution/base.go:774 +0xa2 |
github.com/couchbase/query/execution.(*InitialProject).RunOnce(0xc002abdd40, 0xc002abd8c0, 0x0, 0x0) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/execution/project_initial.go:59 +0x5c |
github.com/couchbase/query/execution.execOp(0x5a93e40, 0xc002abdd40, 0xc002abd8c0, 0x0, 0x0) |
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/execution/base.go:486 +0x54 |
created by github.com/couchbase/query/execution.(*base).fork
|
/Users/bingjie.miao/master/query1/src/github.com/couchbase/query/execution/base.go:496 +0xfa |
Attachments
Issue Links
- relates to
-
MB-42445 [Advisor] No session advise recommendation provided for stopped session
- Closed