[enhancement](fe) Add more detail log for replayJournal (#24218)
This commit is contained in:
@ -2612,6 +2612,7 @@ public class Env {
|
||||
long startTime = System.currentTimeMillis();
|
||||
boolean hasLog = false;
|
||||
while (true) {
|
||||
long entityStartTime = System.currentTimeMillis();
|
||||
Pair<Long, JournalEntity> kv = cursor.next();
|
||||
if (kv == null) {
|
||||
break;
|
||||
@ -2623,6 +2624,7 @@ public class Env {
|
||||
}
|
||||
hasLog = true;
|
||||
EditLog.loadJournal(this, logId, entity);
|
||||
long loadJournalEndTime = System.currentTimeMillis();
|
||||
replayedJournalId.incrementAndGet();
|
||||
LOG.debug("journal {} replayed.", replayedJournalId);
|
||||
if (feType != FrontendNodeType.MASTER) {
|
||||
@ -2632,6 +2634,14 @@ public class Env {
|
||||
// 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) {
|
||||
|
||||
@ -143,6 +143,7 @@ public class JournalEntity implements Writable {
|
||||
|
||||
private short opCode;
|
||||
private Writable data;
|
||||
private long dataSize;
|
||||
|
||||
public short getOpCode() {
|
||||
return this.opCode;
|
||||
@ -164,6 +165,14 @@ public class JournalEntity implements Writable {
|
||||
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);
|
||||
|
||||
@ -113,6 +113,7 @@ public class BDBJournalCursor implements JournalCursor {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user