Skip to content

Commit

Permalink
Merge #26950
Browse files Browse the repository at this point in the history
26950: distsql: do not plan against unhealthy nodes r=solongordon a=solongordon

A bug was introduced in 0cd1da0 which allows table readers to be planned
on unhealthy or incompatible nodes for LIMIT queries. They should use
the gateway node instead. This was causing a panic in execution because
the node was not in the nodeAddresses map.

Fixes #26140

Release note (bug fix): Fixed 'node not in nodeAddresses map' panic,
which could occur when distributed queries were run on a cluster with at
least one unhealthy node.

Co-authored-by: Solon Gordon <[email protected]>
  • Loading branch information
craig[bot] and solongordon committed Jun 25, 2018
2 parents 98d2a12 + 626b72d commit 5a013c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/sql/distsql_physical_planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ func (dsp *DistSQLPlanner) getNodeIDForScan(
nodeID := replInfo.NodeDesc.NodeID
if err := dsp.checkNodeHealthAndVersion(planCtx, replInfo.NodeDesc); err != nil {
log.Eventf(planCtx.ctx, "not planning on node %d. %v", nodeID, err)
return dsp.nodeDesc.NodeID, nil
}
return nodeID, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/distsqlplan/physical_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ func (p *PhysicalPlan) PopulateEndpoints(nodeAddresses map[roachpb.NodeID]string
var ok bool
endpoint.TargetAddr, ok = nodeAddresses[p2.Node]
if !ok {
panic(fmt.Sprintf("node %d node in nodeAddresses map", p2.Node))
panic(fmt.Sprintf("node %d not in nodeAddresses map", p2.Node))
}
}

Expand Down

0 comments on commit 5a013c1

Please sign in to comment.