apache / apache/incubator-seata

oracle事务回滚数据对比bug

Open
#3,104 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

配置undolog log-serialization: fastjson
业务表字段类型为NUMBER 时, undo_log中对应的 fieldType = 2 / NUMERIC .
DataCompareUtils.isFieldEquals 对比出现不相等.
convertType方法没有将 NUMERIC 转为数字.
在调用 Objects.deepEquals(f0.getValue(), f1.getValue()); 对比时两个变量不相等,
private static void convertType(Field f0, Field f1) {
int f0Type = f0.getType();
int f1Type = f1.getType();
if (f0Type == Types.TIMESTAMP && f0.getValue().getClass().equals(String.class)) {
f0.setValue(Timestamp.valueOf(f0.getValue().toString()));
}
if (f1Type == Types.TIMESTAMP && f1.getValue().getClass().equals(String.class)) {
f1.setValue(Timestamp.valueOf(f1.getValue().toString()));
}
if (f0Type == Types.DECIMAL && f0.getValue().getClass().equals(Integer.class)) {
f0.setValue(new BigDecimal(f0.getValue().toString()));
}
if (f1Type == Types.DECIMAL && f1.getValue().getClass().equals(Integer.class)) {
f1.setValue(new BigDecimal(f1.getValue().toString()));
}
if (f0Type == Types.BIGINT && f0.getValue().getClass().equals(Integer.class)) {
f0.setValue(Long.parseLong(f0.getValue().toString()));
}
if (f1Type == Types.BIGINT && f1.getValue().getClass().equals(Integer.class)) {
f1.setValue(Long.parseLong(f1.getValue().toString()));
}
}

seata 1.3.0
fastjon model
- JDK version : 1.8
- OS :
- Others:

Contributor guide

Open the contributing guide

Research direction

Start at DataCompareUtils.isFieldEquals and its convertType method, using the reported fastjson undo_log path with an Oracle NUMBER field as the reproduction case. Check the values reaching Objects.deepEquals and verify that NUMERIC values compare as equal, then run the relevant existing tests or add regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.