Skip to content

Commit

Permalink
DBZ-8541 Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
twthorn authored and jpechane committed Jan 6, 2025
1 parent 86e784e commit 219ee85
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package io.debezium.connector.vitess.pipeline.txmetadata;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ public static Long getEpochForGtid(Long previousEpoch, String previousGtidString
if (isGtidOverridden(previousGtidString) && isGtidOverridden(gtidString)) {
// GTID was overridden, and the current GTID is an overridden value, still waiting for first transaction
return previousEpoch;
} else if (isGtidOverridden(previousGtidString) && !isGtidOverridden(gtidString)) {
}
else if (isGtidOverridden(previousGtidString) && !isGtidOverridden(gtidString)) {
// GTID was overridden, received first transaction, increment epoch
LOGGER.info("Incrementing epoch: {}", getLogMessageForGtid(previousEpoch, previousGtidString, gtidString));
return previousEpoch + 1;
} else if (isStandardGtid(previousGtidString) && isGtidOverridden(gtidString)) {
}
else if (isStandardGtid(previousGtidString) && isGtidOverridden(gtidString)) {
// previous GTID is standard, current GTID is overridden, should not be possible, raise exception
String message = String.format("Current GTID cannot be override value if previous is standard: %s",
getLogMessageForGtid(previousEpoch, previousGtidString, gtidString));
LOGGER.error(message);
throw new DebeziumException(message);
} else {
}
else {
// Both GTIDs are standard so parse them
return getEpochForStandardGtid(previousEpoch, previousGtidString, gtidString);
}
Expand All @@ -65,7 +68,8 @@ private static Long getEpochForStandardGtid(Long previousEpoch, String previousG
Gtid gtid = new Gtid(gtidString);
if (gtid.isHostSetSupersetOf(previousGtid)) {
return previousEpoch;
} else {
}
else {
// Any other case (disjoint set, previous is a superset), VStream has interpreted the previous GTID correctly and sent some new GTID
// in a continuous stream, so simply increment the epoch
return previousEpoch + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.List;
import java.util.Map;

import org.assertj.core.api.Assertions;
import org.junit.Test;

import io.debezium.DebeziumException;
Expand All @@ -28,7 +27,6 @@
import io.debezium.connector.vitess.Vgtid;
import io.debezium.connector.vitess.VgtidTest;
import io.debezium.connector.vitess.VitessConnectorConfig;
import io.debezium.junit.logging.LogInterceptor;

public class VitessEpochProviderTest {

Expand Down Expand Up @@ -226,7 +224,8 @@ public void missingEpochWithPreviousVgtidShouldThrowException() {
public void testGtidPartialCurrent() {
VitessEpochProvider provider = new VitessEpochProvider();
VitessConnectorConfig config = new VitessConnectorConfig(Configuration.empty());
provider.load(Map.of(VitessOrderedTransactionContext.OFFSET_TRANSACTION_EPOCH, new ShardEpochMap(Map.of("f0-f8", 1L, "30-38", 1L, "b0-b8", 1L, "70-78", 1L)).toString()), config);
provider.load(Map.of(VitessOrderedTransactionContext.OFFSET_TRANSACTION_EPOCH,
new ShardEpochMap(Map.of("f0-f8", 1L, "30-38", 1L, "b0-b8", 1L, "70-78", 1L)).toString()), config);
String shard = "f0-f8";
String vgtidAllCurrent = "[" +
"{\"keyspace\":\"keyspace1\",\"shard\":\"30-38\",\"gtid\":\"current\",\"table_p_ks\":[]}," +
Expand Down

0 comments on commit 219ee85

Please sign in to comment.