Skip to content

Commit 97b4f28

Browse files
committed
[fix-36591][logminer]增加注释
1 parent 91b3036 commit 97b4f28

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

flinkx-oraclelogminer/flinkx-oraclelogminer-reader/src/main/java/com/dtstack/flinkx/oraclelogminer/entity/RecordLog.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,25 @@
2020

2121
import java.math.BigDecimal;
2222

23+
/**
24+
* v$logmnr_contents 对应的实体
25+
* logminer读取出的数据实体
26+
*/
2327
public class RecordLog {
2428

2529
private BigDecimal scn;
30+
/** undo语句**/
2631
private String sqlUndo;
32+
/** redo语句**/
2733
private String sqlRedo;
34+
/** 事务id**/
2835
private String xidSqn;
36+
/** rowId**/
2937
private String rowId;
3038
private String tableName;
39+
/** 是否发生了日志切割**/
3140
private boolean hasMultiSql;
41+
/** DML操作类型 1插入 2删除 3 更新**/
3242
private int operationCode;
3343

3444
public RecordLog(BigDecimal scn, String sqlUndo, String sqlRedo, String xidSqn, String rowId, int operationCode, boolean hasMultiSql, String tableName) {

flinkx-oraclelogminer/flinkx-oraclelogminer-reader/src/main/java/com/dtstack/flinkx/oraclelogminer/format/LogMinerConnection.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,9 @@ public boolean hasNext() throws SQLException, UnsupportedEncodingException, Deco
708708
}
709709
}
710710

711-
if(undoLog.length() == 0){
712-
//没有查找到对应的insert语句 会加delete where rowid=xxx 语句作为redoLog
713-
LOG.warn("没有查找到undoLog");
711+
if(undoLog.length() != 0){
712+
//没有查找到对应的insert语句 会将delete where rowid=xxx 语句作为redoLog
713+
LOG.warn("has not found undoLog for scn {}",scn);
714714
}else{
715715
sqlRedo = undoLog;
716716
}
@@ -724,13 +724,15 @@ public boolean hasNext() throws SQLException, UnsupportedEncodingException, Deco
724724
while (isSqlNotEnd) {
725725
logMinerData.next();
726726
//redoLog 实际上不需要发生切割 但是sqlUndo发生了切割,导致redolog值为null
727-
if (Objects.nonNull(logMinerData.getString(KEY_SQL_REDO))) {
728-
sqlRedo.append(logMinerData.getString(KEY_SQL_REDO));
729-
}
730-
if (Objects.nonNull(logMinerData.getString(KEY_SQL_UNDO))) {
731-
sqlUndo.append(logMinerData.getString(KEY_SQL_UNDO));
727+
String sqlRedoValue = logMinerData.getString(KEY_SQL_REDO);
728+
if (Objects.nonNull(sqlRedoValue)) {
729+
sqlRedo.append(sqlRedoValue);
732730
}
733731

732+
String sqlUndoValue = logMinerData.getString(KEY_SQL_UNDO);
733+
if (Objects.nonNull(sqlUndoValue)) {
734+
sqlUndo.append(sqlUndoValue);
735+
}
734736
isSqlNotEnd = logMinerData.getBoolean(KEY_CSF);
735737
}
736738
}
@@ -787,7 +789,7 @@ public boolean hasNext() throws SQLException, UnsupportedEncodingException, Deco
787789
result = new QueueData(scn, data);
788790

789791
//解析的数据放入缓存
790-
putCache(new RecordLog(scn, sqlUndo.toString(), sqlLog, xidSqn, rowId, operationCode,hasMultiSql,tableName));
792+
putCache(new RecordLog(scn, sqlUndo.toString(), sqlLog, xidSqn, rowId, operationCode, hasMultiSql, tableName));
791793
return true;
792794
}
793795

0 commit comments

Comments
 (0)