Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement](fe) Add more detail log for replayJournal #24218

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -2610,6 +2610,7 @@ public synchronized boolean replayJournal(long toJournalId) {
long startTime = System.currentTimeMillis();
boolean hasLog = false;
while (true) {
long entityStartTime = System.currentTimeMillis();
Pair<Long, JournalEntity> kv = cursor.next();
if (kv == null) {
break;
Expand All @@ -2621,6 +2622,7 @@ public synchronized boolean replayJournal(long toJournalId) {
}
hasLog = true;
EditLog.loadJournal(this, logId, entity);
long loadJournalEndTime = System.currentTimeMillis();
replayedJournalId.incrementAndGet();
LOG.debug("journal {} replayed.", replayedJournalId);
if (feType != FrontendNodeType.MASTER) {
Expand All @@ -2630,6 +2632,14 @@ public synchronized boolean replayJournal(long toJournalId) {
// Metric repo may not init after this replay thread start
MetricRepo.COUNTER_EDIT_LOG_READ.increase(1L);
}

long entityCost = System.currentTimeMillis() - entityStartTime;
if (entityCost >= 1000) {
long loadJournalCost = loadJournalEndTime - entityStartTime;
LOG.warn("entityCost:{} loadJournalCost:{} logId:{} replayedJournalId:{} code:{} size:{}",
entityCost, loadJournalCost, logId, replayedJournalId, entity.getOpCode(),
entity.getDataSize());
}
}
long cost = System.currentTimeMillis() - startTime;
if (cost >= 1000) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public class JournalEntity implements Writable {

private short opCode;
private Writable data;
private long dataSize;

public short getOpCode() {
return this.opCode;
Expand All @@ -164,6 +165,14 @@ public String toString() {
return " opCode=" + opCode + " " + data;
}

public void setDataSize(long dataSize) {
this.dataSize = dataSize;
}

public long getDataSize() {
return this.dataSize;
}

@Override
public void write(DataOutput out) throws IOException {
out.writeShort(opCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public Pair<Long, JournalEntity> next() {
JournalEntity entity = new JournalEntity();
try {
entity.readFields(in);
entity.setDataSize(retData.length);
} catch (Exception e) {
LOG.error("fail to read journal entity key={}, will exit", currentKey, e);
System.exit(-1);
Expand Down