Skip to content

Commit

Permalink
distsql: do not plan against unhealthy nodes
Browse files Browse the repository at this point in the history
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 LIMIT queries were run on a cluster
with at least one unhealthy node.
  • Loading branch information
solongordon committed Jun 25, 2018
1 parent ac55e58 commit 626b72d
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 626b72d

Please sign in to comment.