DBZ-7488 Skip re-selection on r (read) events

This commit is contained in:
Chris Cranford 2024-02-15 16:04:34 -05:00 committed by Jiri Pechanec
parent 3b470c3038
commit 09e1bf1df0
2 changed files with 7 additions and 5 deletions

View File

@ -105,6 +105,13 @@ public void apply(Object messageKey, Struct value) {
return;
}
// Skip read events as these are generated from raw JDBC selects which should have the current
// state of the row and there is no reason to logically re-select the column state.
final String operation = value.getString(Envelope.FieldName.OPERATION);
if (Envelope.Operation.READ.code().equals(operation)) {
return;
}
final Struct source = value.getStruct(Envelope.FieldName.SOURCE);
if (source == null) {
LOGGER.debug("Value has no source field, no re-selection possible.");

View File

@ -106,9 +106,6 @@ public void testNoColumnsReselectedWhenNullAndUnavailableColumnsAreDisabled() th
@FixFor("DBZ-4321")
@SuppressWarnings("resource")
public void testNoColumnsReselectedWhenNotNullSnapshot() throws Exception {
LogInterceptor interceptor = new LogInterceptor(ReselectColumnsPostProcessor.class);
interceptor.setLoggerLevel(ReselectColumnsPostProcessor.class, Level.DEBUG);
databaseConnection().execute(getInsertWithValue());
Configuration config = getConfigurationBuilder()
@ -130,8 +127,6 @@ public void testNoColumnsReselectedWhenNotNullSnapshot() throws Exception {
assertThat(after.get(fieldName("id"))).isEqualTo(1);
assertThat(after.get(fieldName("data"))).isEqualTo("one");
assertThat(after.get(fieldName("data2"))).isEqualTo(1);
assertThat(interceptor.containsMessage("No columns require re-selection.")).isTrue();
}
@Test