Skip to content

Commit

Permalink
[fix][dingo-executor] Fix pessimistic transaction update non-existent…
Browse files Browse the repository at this point in the history
… records and insert null key issues
  • Loading branch information
githubgxll committed Dec 24, 2024
1 parent a09d3b0 commit 68deeed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ protected boolean pushTuple(Context context, Object[] tuple, Vertex vertex) {
}
}
if (param.isHasAutoInc() && param.getAutoIncColIdx() < tuple.length) {
long autoIncVal = Long.parseLong(newTuple[param.getAutoIncColIdx()].toString());
MetaService metaService = MetaService.root();
metaService.updateAutoIncrement(param.getTableId(), autoIncVal);
if (newTuple[param.getAutoIncColIdx()] != null) {
long autoIncVal = Long.parseLong(newTuple[param.getAutoIncColIdx()].toString());
MetaService metaService = MetaService.root();
metaService.updateAutoIncrement(param.getTableId(), autoIncVal);
}
}
CommonId txnId = vertex.getTask().getTxnId();
CommonId tableId = param.getTableId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public int getPartNum(NavigableMap<ComparableByteArray, RangeDistribution> range

@Override
public CommonId calcPartId(byte[] key, NavigableMap<ComparableByteArray, RangeDistribution> ranges) {
if (key == null) {
throw new RuntimeException("key does not allow NULLs");
}
ConsistentHashing<Long> hashRing = new ConsistentHashing<>(3);
NavigableMap<ComparableByteArray, RangeDistribution> partRanges = new TreeMap<>();
for (Map.Entry<ComparableByteArray, RangeDistribution> entry : ranges.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public int getPartNum(NavigableMap<ComparableByteArray, RangeDistribution> range

@Override
public CommonId calcPartId(byte [] key, NavigableMap<ComparableByteArray, RangeDistribution> ranges) {
if (key == null) {
throw new RuntimeException("key does not allow NULLs");
}
return ranges.floorEntry(new ComparableByteArray(key, 1)).getValue().id();
}

Expand Down

0 comments on commit 68deeed

Please sign in to comment.