-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[admin-tool][server] Add new admin-tool command to dump heartbeat sta…
…tus from server; Scan and log stale HB replica (#1275) This PR adds two features related to heartbeat: Add a heartbeat scan thread to periodically run and log lagging resources (every minute by default, this should be good enough not to spam logging). This can be further collected by other logging collecting system and we can easily detect on which host, what replica is lagging by how much. Add a command to dump heartbeat status from a host. It has 2 optional filter: partition filter and lag filter. You can choose to see only specific topic / topic-partition or you can choose to only see resources that are lagging. This serves as the manual helper when (1) might be missing stuff.
- Loading branch information
1 parent
aeade7e
commit ddaa0bb
Showing
27 changed files
with
926 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
...-vinci-client/src/main/java/com/linkedin/davinci/kafka/consumer/ReplicaHeartbeatInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
package com.linkedin.davinci.kafka.consumer; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
|
||
public class ReplicaHeartbeatInfo { | ||
private String replicaId; | ||
private String region; | ||
private String leaderState; | ||
private boolean readyToServe; | ||
private long heartbeat; | ||
private long lag; | ||
|
||
@JsonCreator | ||
public ReplicaHeartbeatInfo( | ||
@JsonProperty("replicaId") String replicaId, | ||
@JsonProperty("region") String region, | ||
@JsonProperty("leaderState") String leaderState, | ||
@JsonProperty("readyToServe") boolean readyToServe, | ||
@JsonProperty("heartbeat") long heartbeat, | ||
@JsonProperty("lag") long lag) { | ||
this.leaderState = leaderState; | ||
this.replicaId = replicaId; | ||
this.region = region; | ||
this.readyToServe = readyToServe; | ||
this.heartbeat = heartbeat; | ||
this.lag = lag; | ||
} | ||
|
||
public long getHeartbeat() { | ||
return heartbeat; | ||
} | ||
|
||
public void setHeartbeat(long heartbeat) { | ||
this.heartbeat = heartbeat; | ||
} | ||
|
||
public String getLeaderState() { | ||
return leaderState; | ||
} | ||
|
||
public void setLeaderState(String leaderState) { | ||
this.leaderState = leaderState; | ||
} | ||
|
||
public String getReplicaId() { | ||
return replicaId; | ||
} | ||
|
||
public void setReplicaId(String replicaId) { | ||
this.replicaId = replicaId; | ||
} | ||
|
||
public String getRegion() { | ||
return region; | ||
} | ||
|
||
public void setRegion(String region) { | ||
this.region = region; | ||
} | ||
|
||
public long getLag() { | ||
return lag; | ||
} | ||
|
||
public void setLag(long lag) { | ||
this.lag = lag; | ||
} | ||
|
||
public boolean isReadyToServe() { | ||
return readyToServe; | ||
} | ||
|
||
public void setReadyToServe(boolean readyToServe) { | ||
this.readyToServe = readyToServe; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
|
||
ReplicaHeartbeatInfo replicaHeartbeatInfo = (ReplicaHeartbeatInfo) o; | ||
return this.replicaId.equals(replicaHeartbeatInfo.getReplicaId()) | ||
&& this.heartbeat == replicaHeartbeatInfo.getHeartbeat() && this.region.equals(replicaHeartbeatInfo.getRegion()) | ||
&& this.readyToServe == replicaHeartbeatInfo.isReadyToServe() && this.lag == replicaHeartbeatInfo.getLag() | ||
&& this.leaderState.equals(replicaHeartbeatInfo.leaderState); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = replicaId.hashCode(); | ||
result = 31 * result + region.hashCode(); | ||
result = 31 * result + leaderState.hashCode(); | ||
result = 31 * result + Boolean.hashCode(readyToServe); | ||
result = 31 * result + Long.hashCode(heartbeat); | ||
result = 31 * result + Long.hashCode(lag); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{" + "\"replica\"='" + replicaId + '\'' + ", \"region\"='" + region + '\'' + ", \"leaderState\"='" | ||
+ leaderState + '\'' + ", \"readyToServe\"='" + readyToServe + '\'' + ", \"heartbeat\"=" + heartbeat | ||
+ ", \"lag\"=" + lag + '}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.