Skip to content

Commit

Permalink
better err msg when querying an index with queries disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
steveyen committed Apr 17, 2015
1 parent 971cbd1 commit 151e66c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions pindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ type RemotePlanPIndex struct {
// up-to-date node and hitting it with load just makes the
// rebalance take longer?
func (mgr *Manager) CoveringPIndexes(indexName, indexUUID string,
wantNode func(*PlanPIndexNode) bool) (
wantNode func(*PlanPIndexNode) bool,
wantKind string) (
localPIndexes []*PIndex, remotePlanPIndexes []*RemotePlanPIndex, err error) {
nodeDefs, _, err := CfgGetNodeDefs(mgr.Cfg(), NODE_DEFS_WANTED)
if err != nil {
Expand Down Expand Up @@ -279,8 +280,10 @@ build_loop:
}
}

return nil, nil, fmt.Errorf("pindex: no node covers planPIndex: %#v",
planPIndex)
return nil, nil, fmt.Errorf("pindex:"+
" %s may have been disabled; no nodes are enabled/allocated"+
" to serve %s for the index partition(s)",
wantKind, wantKind)
}

return localPIndexes, remotePlanPIndexes, nil
Expand Down
3 changes: 2 additions & 1 deletion pindex_impl_bleve.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,8 @@ func bleveIndexAlias(mgr *Manager, indexName, indexUUID string,
consistencyParams *ConsistencyParams,
cancelCh <-chan bool) (bleve.IndexAlias, error) {
localPIndexes, remotePlanPIndexes, err :=
mgr.CoveringPIndexes(indexName, indexUUID, PlanPIndexNodeCanRead)
mgr.CoveringPIndexes(indexName, indexUUID, PlanPIndexNodeCanRead,
"queries")
if err != nil {
return nil, fmt.Errorf("bleve: bleveIndexAlias, err: %v", err)
}
Expand Down
3 changes: 2 additions & 1 deletion pindex_impl_vlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,8 @@ func vliteGatherer(mgr *Manager, indexName, indexUUID string,
consistencyParams *ConsistencyParams,
cancelCh <-chan bool) (*VLiteGatherer, error) {
localPIndexes, remotePlanPIndexes, err :=
mgr.CoveringPIndexes(indexName, indexUUID, PlanPIndexNodeCanRead)
mgr.CoveringPIndexes(indexName, indexUUID, PlanPIndexNodeCanRead,
"queries")
if err != nil {
return nil, fmt.Errorf("vlite: gatherer, err: %v", err)
}
Expand Down

0 comments on commit 151e66c

Please sign in to comment.