Skip to content

Commit

Permalink
[improve](proc) Show journal size in bdbje journal dir (apache#29314)
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter authored Dec 30, 2023
1 parent e500b42 commit 80fb496
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class BdbjeJournalDataProcNode implements ProcNodeInterface {

public static final ImmutableList<String> TITLE_NAMES = new ImmutableList.Builder<String>()
.add("JournalId").add("OpType").add("Data").build();
.add("JournalId").add("OpType").add("Size").add("Data").build();

private String dbName;
private Long journalId;
Expand All @@ -53,7 +53,8 @@ public ProcResult fetchResult() throws AnalysisException {

short opCode = entity.entity == null ? -1 : entity.entity.getOpCode();
String data = entity.entity == null ? entity.errMsg : entity.entity.getData().toString();
result.addRow(Lists.newArrayList(entity.journalId.toString(), OperationType.getOpName(opCode), data));
result.addRow(Lists.newArrayList(entity.journalId.toString(),
OperationType.getOpName(opCode), entity.size.toString(), data));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public JournalEntityWrapper getJournalEntity(String dbName, Long journalId) {
db.close();
if (status == OperationStatus.SUCCESS) {
byte[] retData = value.getData();
entityWrapper.size = retData.length;
DataInputStream in = new DataInputStream(new ByteArrayInputStream(retData));
JournalEntity entity = new JournalEntity();
try {
Expand Down Expand Up @@ -240,6 +241,7 @@ public void close() {

public static class JournalEntityWrapper {
public Long journalId;
public Integer size;
public JournalEntity entity;
public String errMsg;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.doris.catalog.TableIf;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.NotImplementedException;
Expand Down Expand Up @@ -161,6 +162,9 @@ protected static boolean isNull(byte[] bitmap, int position) {

protected void auditAfterExec(String origStmt, StatementBase parsedStmt,
Data.PQueryStatistics statistics, boolean printFuzzyVariables) {
if (Config.enable_bdbje_debug_mode) {
return;
}
AuditLogHelper.logAuditLog(ctx, origStmt, parsedStmt, statistics, printFuzzyVariables);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ public boolean isForwardToMaster() {
return false;
}

if (Config.enable_bdbje_debug_mode) {
return false;
}

// this is a query stmt, but this non-master FE can not read, forward it to master
if (isQuery() && !Env.getCurrentEnv().isMaster()
&& !Env.getCurrentEnv().canRead()) {
Expand Down

0 comments on commit 80fb496

Please sign in to comment.