Class: Karafka::Web::Pro::Ui::Controllers::Topics::ReplicationsController
- Inherits:
-
BaseController
- Object
- Ui::Controllers::BaseController
- BaseController
- BaseController
- Karafka::Web::Pro::Ui::Controllers::Topics::ReplicationsController
- Defined in:
- lib/karafka/web/pro/ui/controllers/topics/replications_controller.rb
Overview
Controller responsible for viewing and managing topics replication details
Constant Summary
Constants inherited from Ui::Controllers::BaseController
Ui::Controllers::BaseController::Models
Instance Attribute Summary
Attributes inherited from Ui::Controllers::BaseController
Instance Method Summary collapse
-
#show(topic_name) ⇒ Object
Displays requested topic replication details.
Methods inherited from Ui::Controllers::BaseController
Methods included from Ui::Controllers::Requests::Hookable
included, #run_after_hooks, #run_before_hooks
Constructor Details
This class inherits a constructor from Karafka::Web::Ui::Controllers::BaseController
Instance Method Details
#show(topic_name) ⇒ Object
Displays requested topic replication details
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/karafka/web/pro/ui/controllers/topics/replications_controller.rb', line 49 def show(topic_name) @topic = Models::Topic.find(topic_name) @partitions = refine(@topic[:partitions]) # Extract replication factor from the first partition (same for all partitions) # The partitions data is an array of hashes with :replica_count key first_partition = @topic[:partitions]&.first @replication_factor = first_partition&.fetch(:replica_count, 0) || 0 # Fetch min.insync.replicas from topic config min_isr_config = @topic.configs.find { |c| c.name == "min.insync.replicas" } @min_isr = min_isr_config&.value&.to_i || 1 # Determine resilience issues (checked in priority order): # 1. No redundancy: RF = 1 (single point of failure, most severe) # 2. Zero write fault tolerance: RF > 1 but RF <= minISR (can't lose any broker) # 3. Low durability: RF > 1 and minISR = 1 (data loss risk if leader fails) @has_no_redundancy = @replication_factor == 1 @has_zero_fault_tolerance = @replication_factor > 1 && @replication_factor <= @min_isr @has_low_durability = @replication_factor > 1 && @min_isr == 1 @has_resilience_issue = @has_zero_fault_tolerance || @has_low_durability || @has_no_redundancy render end |