Search in sources :

Example 1 with HistoryRecordComparator

use of io.debezium.relational.history.HistoryRecordComparator in project debezium by debezium.

the class MySqlTaskContextTest method shouldComparePositionsWithDifferentFields.

@Test
public void shouldComparePositionsWithDifferentFields() {
    String lastGtidStr = "01261278-6ade-11e6-b36a-42010af00790:1-400944168," + "30efb117-e42a-11e6-ba9e-42010a28002e:1-9," + "4d1a4918-44ba-11e6-bf12-42010af0040b:1-11604379," + "621dc2f6-803b-11e6-acc1-42010af000a4:1-7963838," + "716ec46f-d522-11e5-bb56-0242ac110004:1-35850702," + "c627b2bc-9647-11e6-a886-42010af0044a:1-10426868," + "d079cbb3-750f-11e6-954e-42010af00c28:1-11544291:11544293-11885648";
    config = simpleConfig().with(MySqlConnectorConfig.GTID_SOURCE_EXCLUDES, "96c2072e-e428-11e6-9590-42010a28002d").build();
    context = new MySqlTaskContext(config, false);
    context.start();
    context.source().setCompletedGtidSet(lastGtidStr);
    HistoryRecordComparator comparator = context.dbSchema().historyComparator();
    String server = "mysql-server-1";
    HistoryRecord rec1 = historyRecord(server, "mysql-bin.000008", 380941551, "01261278-6ade-11e6-b36a-42010af00790:1-378422946," + "4d1a4918-44ba-11e6-bf12-42010af0040b:1-11002284," + "716ec46f-d522-11e5-bb56-0242ac110004:1-34673215," + "96c2072e-e428-11e6-9590-42010a28002d:1-3," + "c627b2bc-9647-11e6-a886-42010af0044a:1-9541144", 0, 0, true);
    HistoryRecord rec2 = historyRecord(server, "mysql-bin.000016", 645115324, "01261278-6ade-11e6-b36a-42010af00790:1-400944168," + "30efb117-e42a-11e6-ba9e-42010a28002e:1-9," + "4d1a4918-44ba-11e6-bf12-42010af0040b:1-11604379," + "621dc2f6-803b-11e6-acc1-42010af000a4:1-7963838," + "716ec46f-d522-11e5-bb56-0242ac110004:1-35850702," + "c627b2bc-9647-11e6-a886-42010af0044a:1-10426868," + "d079cbb3-750f-11e6-954e-42010af00c28:1-11544291:11544293-11885648", 2, 1, false);
    assertThat(comparator.isAtOrBefore(rec1, rec2)).isTrue();
    assertThat(comparator.isAtOrBefore(rec2, rec1)).isFalse();
}
Also used : HistoryRecordComparator(io.debezium.relational.history.HistoryRecordComparator) HistoryRecord(io.debezium.relational.history.HistoryRecord) Test(org.junit.Test)

Aggregations

HistoryRecord (io.debezium.relational.history.HistoryRecord)1 HistoryRecordComparator (io.debezium.relational.history.HistoryRecordComparator)1 Test (org.junit.Test)1