All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ui.topics.partitionReplicaAssignments.ftl Maven / Gradle / Ivy

There is a newer version: 0.8.0
Show newest version
<#-- @ftlvariable name="appUrl" type="com.infobip.kafkistry.webapp.url.AppUrl" -->

<#-- @ftlvariable name="clusterIdentifier" type="java.lang.String" -->
<#-- @ftlvariable name="topicName" type="java.lang.String" -->
<#-- @ftlvariable name="clusterInfo"  type="com.infobip.kafkistry.kafka.ClusterInfo" -->
<#-- @ftlvariable name="partitionsAssignments"  type="java.util.List" -->
<#-- @ftlvariable name="assignmentsDisbalance"  type="com.infobip.kafkistry.service.generator.AssignmentsDisbalance" -->
<#-- @ftlvariable name="partitionChange"  type="com.infobip.kafkistry.service.topic.PartitionPropertyChange" -->

<#-- @ftlvariable name="assignmentStatus" type="com.infobip.kafkistry.service.topic.PartitionsAssignmentsStatus" -->
<#-- @ftlvariable name="topicReplicas" type="com.infobip.kafkistry.kafkastate.TopicReplicaInfos" -->
<#-- @ftlvariable name="partitionReAssignments" type="java.util.Map" -->

<#function getReplicaAssignment partitionAssignments brokerId>
<#-- @ftlvariable name="partitionAssignments"  type="com.infobip.kafkistry.kafka.PartitionAssignments" -->
<#-- @ftlvariable name="brokerId"  type="java.lang.Integer" -->
    <#list partitionAssignments.replicasAssignments as replica>
        <#if replica.brokerId == brokerId>
            <#return replica>
        
    


<#import "../common/util.ftl" as _util>
<#import "../common/infoIcon.ftl" as _info_>
<#import "../sql/sqlQueries.ftl" as sql>

<#assign tinyMode = clusterInfo.brokerIds?size gt 6>

Partition replicas assignments over brokers <@sql.topicReplicaSizes cluster=clusterInfo.identifier topic=topicName/> <@sql.topicBrokerReplicaSizes cluster=clusterInfo.identifier topic=topicName/> <@sql.topicReplicaLeadersCounts cluster=clusterInfo.identifier topic=topicName/>
<#if clusterInfo??> <#if assignmentsDisbalance??>
<#if assignmentsDisbalance.replicasDisbalance == 0 && assignmentsDisbalance.leadersDisbalance == 0 && assignmentsDisbalance.partitionsPerRackDisbalance.totalDisbalance == 0>
Partition and leader assignments over brokers is optimal
<#else>
<#if assignmentsDisbalance.replicasDisbalance gt 0>
Partition assignments disbalance is ${assignmentsDisbalance.replicasDisbalance} (# of needed replica migrations) | ${assignmentsDisbalance.replicasDisbalancePercent?string["0.##"]}% of all replicas
<#else>
Partition replicas placement over brokers is optimal
<#if assignmentsDisbalance.leadersDisbalance gt 0>
Partition leaders disbalance is ${assignmentsDisbalance.leadersDisbalance} (# of needed re-orders with elections) | ${assignmentsDisbalance.leadersDisbalancePercent?string["0.##"]}% of all partitions
<#else>
Partition leaders distribution over brokers is optimal
<#if assignmentsDisbalance.partitionsPerRackDisbalance.totalDisbalance gt 0>
<#assign singleRckPart = assignmentsDisbalance.partitionsPerRackDisbalance.singleRackPartitions> <#if singleRckPart?size gt 0> Partitions [<#list singleRckPart as p>${p}<#if p?has_next>, ] have replicas on brokers of the same rack. <#assign disbalancedRckPart = []> <#list assignmentsDisbalance.partitionsPerRackDisbalance.partitionDisbalance as p, d> <#if d gt 0 && !singleRckPart?seq_contains(p)> <#assign disbalancedRckPart += [p]> <#if disbalancedRckPart?size gt 0> Partitions [<#list disbalancedRckPart as p>${p}<#if p?has_next>, ] have un-even distribution across brokers on different racks.
<#import "../clusters/clusterNodesList.ftl" as brokerBadge>
<#if assignmentStatus.clusterHasRacks> <#list (clusterInfo.brokerIds) as brokerId> <#if topicReplicas??> <#if assignmentStatus.clusterHasRacks> <#list clusterInfo.brokerIds as brokerId> <#list assignmentStatus.partitions as partition> <#assign rackUsageDisbalanced = assignmentsDisbalance?? && assignmentsDisbalance.partitionsPerRackDisbalance.partitionDisbalance?api.get(partition.partition) gt 0> <#assign singleRackWarning = assignmentStatus.clusterHasRacks && partition.singleRackReplicas> <#if assignmentStatus.clusterHasRacks> <#assign hasReAssignment = (partitionReAssignments?api.get(partition.partition))??> <#if hasReAssignment> <#assign reAssignment = partitionReAssignments?api.get(partition.partition)> <#assign brokerReplicas = partition.brokerReplicas> <#list brokerReplicas as brokerReplica>
Brokers
Partition
<@brokerBadge.clusterNodeId nodeId=brokerId/>
${_util.prettyDataSize(topicReplicas.totalSizeBytes)} Racks <#assign brokerTotalBytes = (topicReplicas.brokerTotalSizes?api.get(brokerId))!0> ${_util.prettyDataSize(brokerTotalBytes)}
<#if singleRackWarning> Single rack <#list partition.rackCounts as rackStatus> <#assign rackTitle = (rackStatus.oldCount == rackStatus.newCount)?then( "Rack=${rackStatus.rack}, #replicas=${rackStatus.newCount}", "Rack=${rackStatus.rack}, #replicas-before=${rackStatus.oldCount}, #replicas-after=${rackStatus.newCount}" )>
<#if rackStatus.oldCount == rackStatus.newCount> ${rackStatus.newCount} <#else> <#if rackStatus.newCount gt rackStatus.oldCount> <#if rackStatus.oldCount == 0> +${rackStatus.newCount} <#else> ${rackStatus.oldCount} +${rackStatus.newCount-rackStatus.oldCount} <#if rackStatus.oldCount gt rackStatus.newCount> <#if rackStatus.newCount == 0> -${rackStatus.oldCount} <#else> ${rackStatus.oldCount} -${rackStatus.oldCount-rackStatus.newCount} ${rackStatus.rack}
<#assign reAssignAdding = hasReAssignment && reAssignment.addingReplicas?seq_contains(brokerReplica.brokerId)> <#assign reAssignRemoving = hasReAssignment && reAssignment.removingReplicas?seq_contains(brokerReplica.brokerId)> <#assign data = {"text": "", "alert": ""}> <#if brokerReplica.currentStatus??> <#assign replica = brokerReplica.currentStatus> <#if replica.leader> <#assign data = {"text": "Leader", "alert": "alert-primary", "explain": "This replica is currently the leader"}> <#elseif replica.inSyncReplica> <#assign data = {"text": "In-sync", "alert": "alert-secondary", "explain": "This replica is currently in-sync with the leader of partition"}> <#elseif reAssignAdding> <#assign data = {"text": "Out-of-sync", "alert": "alert-warning", "explain": "This replica is being added by re-assignment and currently out-of-sync"}> <#else> <#assign data = {"text": "Out-of-sync", "alert": "alert-danger", "explain": "This replica is currently not in sync wioth the leader of the partition"}> <#elseif brokerReplica.added> <#assign data = {"text": "New", "alert": "alert-success", "explain": "This replica will be added"}> <#elseif brokerReplica.removed> <#assign data = {"text": "Remove", "alert": "alert-warning", "explain": "This replica will be removed"}> <#else> <#assign data = {"text": "", "alert": ""}> <#assign leaderData = {"text": "", "class": ""}> <#if brokerReplica.newLeader> <#assign leaderData = {"text": "+L", "class": "text-success", "explain": "This replica will become preferred leader"}> <#elseif brokerReplica.exLeader> <#assign leaderData = {"text": "-L", "class": "text-danger", "explain": "This replica will stop being preferred leader"}> <#elseif (brokerReplica.currentStatus.preferredLeader && !brokerReplica.currentStatus.leader)!false> <#assign leaderData = {"text": "*L", "class": "text-primary", "explain": "This replica is preferred leader but it is not currently a leader"}> <#elseif (!brokerReplica.currentStatus.preferredLeader && brokerReplica.currentStatus.leader)!false> <#assign leaderData = {"text": "L*", "class": "text-secondary", "explain": "This replica is not preferred leader but it is currently a leader"}> <#assign crossed = brokerReplica.removed || reAssignRemoving>
<#assign haveReplicaInfo = false> <#-- @ftlvariable name="replicaInfo" type="com.infobip.kafkistry.kafka.TopicPartitionReplica" --> <#if topicReplicas??> <#assign b = brokerReplica.brokerId> <#assign p = partition.partition> <#if (topicReplicas.brokerPartitionReplicas?api.get(b)?api.get(p))??> <#assign replicaInfo = topicReplicas.brokerPartitionReplicas?api.get(b)?api.get(p)> <#assign haveReplicaInfo = true> <#if data["text"] != ""> <#assign tooltip>
    <#if (data["explain"])??>
  • ${data["explain"]}
  • <#if (leaderData["explain"])??>
  • ${leaderData["explain"]}
  • <#if brokerReplica.removed>
  • This replica wil be removed
  • <#if 0 <= brokerReplica.rank>
  • <#if brokerReplica.rank == 0>1st <#elseif brokerReplica.rank == 1>2nd <#elseif brokerReplica.rank == 2>3rd <#else>${brokerReplica.rank+1}th priority preferred replica
  • <#if reAssignAdding>
  • This replica is being added by re-assignment
  • <#if reAssignRemoving>
  • This replica is being removed by re-assignment
  • <#if haveReplicaInfo> <#if replicaInfo.future>
  • This replica is 'future' assignment meaning it will became part of replica set after re-assignment finish sync
  • Size on disk: ${_util.prettyDataSize(replicaInfo.sizeBytes)}
  • Root dir: ${replicaInfo.rootDir}
  • <#if !(brokerReplica.currentStatus??) || brokerReplica.currentStatus.leader>
  • Lag diff between HW and LEO: <#if replicaInfo.offsetLag gt 0> Lag: ${_util.prettyNumber(replicaInfo.offsetLag)} <#else> No lag
  • Broker rack: <#if brokerReplica.rack??> ${brokerReplica.rack} <#else> (NULL)
<@_info_.icon tooltip=tooltip/> <#if 0 <= brokerReplica.rank> [${brokerReplica.rank?c}] <#if tinyMode>
${data["text"]} ${leaderData["text"]} <#if haveReplicaInfo>
${_util.prettyDataSize(replicaInfo.sizeBytes)} <#if replicaInfo.future>
future replica
<#else>
Cluster is unreachable, can't show assignments




© 2015 - 2024 Weber Informatics LLC | Privacy Policy