Skip to content

Commit

Permalink
Merge pull request #18 from obazoud/isr
Browse files Browse the repository at this point in the history
check-topic.rb: check isr
  • Loading branch information
obazoud committed Feb 16, 2017
2 parents 60109eb + 58e6d4a commit 5252384
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LineLength:
Max: 225

AbcSize:
Max: 125
Max: 140

FileName:
Enabled: false
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
### Fixed
### Changed

## [Unreleased]

### Added
- check-topic.rb: check isr

## [0.9.1] - 2017-02-16

### Fixed
Expand Down
6 changes: 4 additions & 2 deletions bin/check-topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ def run
partitions.each do |num, replica|
state_json = z.get(path: "/brokers/topics/#{config[:name]}/partitions/#{num}/state")[:data]
state = JSON.parse(state_json)
critical "Topic '#{config[:name]}', unknown leader #{state['leader']}" unless brokers.include? state['leader']
critical "Topic '#{config[:name]}', partition #{num} preferred replica is not #{replica[0]}" unless replica[0] == state['leader']
critical "Topic '#{config[:name]}', partition #{num}: unknown leader #{state['leader']}" unless brokers.include? state['leader']
critical "Topic '#{config[:name]}', partition #{num}: preferred replica is not #{replica[0]}" unless replica[0] == state['leader']
critical "Topic '#{config[:name]}', partition #{num}: isr is not consistent" unless (replica - state['isr']).empty? && (state['isr'] - replica).empty?
critical "Topic '#{config[:name]}', partition #{num}: unknown isr #{state['isr'] - brokers}" unless (state['isr'] - brokers).empty?
end
end

Expand Down

0 comments on commit 5252384

Please sign in to comment.