Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
cleanup graphiteTagDelSeries to only hit peers that have data
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed Apr 26, 2019
1 parent c949e3f commit e0d0a4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
20 changes: 6 additions & 14 deletions api/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,25 +306,17 @@ type PeerResponse struct {
}

// peerQuery takes a request and the path to request it on, then fans it out
// across the cluster, except to the local peer. If any peer fails requests to
// across the cluster, except to the local peer or peers without data.
// Note: unlike the other peerQuery methods, we include peers that are not ready
// If any peer fails requests to
// other peers are aborted.
// ctx: request context
// data: request to be submitted
// name: name to be used in logging & tracing
// path: path to request on
func (s *Server) peerQuery(ctx context.Context, data cluster.Traceable, name, path string, allPeers bool) (map[string]PeerResponse, error) {
var peers []cluster.Node
var err error

if allPeers {
peers = cluster.Manager.MemberList(false, false)
} else {
peers, err = cluster.MembersForQuery()
if err != nil {
log.Errorf("HTTP peerQuery unable to get peers, %s", err.Error())
return nil, err
}
}
func (s *Server) peerQuery(ctx context.Context, data cluster.Traceable, name, path string) (map[string]PeerResponse, error) {

peers := cluster.Manager.MemberList(false, true)
log.Debugf("HTTP %s across %d instances", name, len(peers)-1)

reqCtx, cancel := context.WithCancel(ctx)
Expand Down
2 changes: 1 addition & 1 deletion api/graphite.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ func (s *Server) graphiteTagDelSeries(ctx *middleware.Context, request models.Gr
}

data := models.IndexTagDelSeries{OrgId: ctx.OrgId, Paths: request.Paths}
responses, err := s.peerQuery(ctx.Req.Context(), data, "clusterTagDelSeries,", "/index/tags/delSeries", true) // note: needlessl hits query nodes with no data, but can be cleaned later
responses, err := s.peerQuery(ctx.Req.Context(), data, "clusterTagDelSeries,", "/index/tags/delSeries")
if err != nil {
response.Write(ctx, response.WrapErrorForTagDB(err))
return
Expand Down

0 comments on commit e0d0a4c

Please sign in to comment.