Skip to content

Commit

Permalink
Merge pull request #7888 from BramGruneir/queue
Browse files Browse the repository at this point in the history
storage: only call Desc() if needed in queues
  • Loading branch information
BramGruneir authored Jul 19, 2016
2 parents 310652d + 116b158 commit b4104bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion storage/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,17 @@ func (bq *baseQueue) MaybeAdd(repl *Replica, now hlc.Timestamp) {
}

func (bq *baseQueue) requiresSplit(cfg config.SystemConfig, repl *Replica) bool {
if bq.acceptsUnsplitRanges {
return false
}
// If there's no store (as is the case in some narrow unit tests), or if
// the store's split queue is disabled, the "required" split will never
// come. In that case, pretend we don't require the split.
if store := repl.store; store == nil || store.splitQueue.Disabled() {
return false
}
desc := repl.Desc()
return !bq.acceptsUnsplitRanges && cfg.NeedsSplit(desc.StartKey, desc.EndKey)
return cfg.NeedsSplit(desc.StartKey, desc.EndKey)
}

// addInternal adds the replica the queue with specified priority. If the
Expand Down

0 comments on commit b4104bc

Please sign in to comment.