DBZ-4205 Handle new transaction id format

This commit is contained in:
Jiri Pechanec 2021-12-06 06:51:39 +01:00 committed by Gunnar Morling
parent 6dcd3c0eab
commit af401a0d71

View File

@ -69,6 +69,20 @@ public String getTransactionId(DataCollectionId source, OffsetContext offset, Ob
return sessionTxnId;
}
}
// Both components were always present in the testing but the documentation claims they are optional
// so it is better to code this defensively
if (sourceInfo.schema().field(SourceInfo.LSID) != null && (sourceInfo.getString(SourceInfo.LSID) != null
|| sourceInfo.getInt64(SourceInfo.TXN_NUMBER) != null)) {
final String lsid = sourceInfo.getString(SourceInfo.LSID);
final Long txnNumber = sourceInfo.getInt64(SourceInfo.TXN_NUMBER);
if (lsid == null) {
return txnNumber.toString();
}
if (txnNumber == null) {
return lsid;
}
return lsid + ":" + txnNumber;
}
final Long operationId = sourceInfo.getInt64(SourceInfo.OPERATION_ID);
if (operationId == null) {
return null;