This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/dev/pr-13250-3eefbe6f08a935030876aeda857ea639a882d9a6 in repository https://gitbox.apache.org/repos/asf/seatunnel.git
commit 971132ed805a3058d93bc85bee11d70033c9a240 Author: Sepuri Sai Krishna <[email protected]> AuthorDate: Thu Nov 26 03:23:22 2026 +0000 [Fix][Connector-V2][JDBC] Route a table with only a UNIQUE key by that key (#13250) --- docs/en/connectors/sink/Jdbc.md | 2 + docs/zh/connectors/sink/Jdbc.md | 2 + .../connectors/seatunnel/jdbc/sink/JdbcSink.java | 39 +- .../seatunnel/jdbc/sink/JdbcSinkFactoryTest.java | 84 +++++ .../seatunnel/jdbc/sink/JdbcSinkTest.java | 64 +++- .../seatunnel/jdbc/JdbcSinkCDCChangelogIT.java | 57 +++ ...dbc_sink_cdc_changelog_unique_key_replicas.conf | 408 +++++++++++++++++++++ 7 files changed, 647 insertions(+), 9 deletions(-) diff --git a/docs/en/connectors/sink/Jdbc.md b/docs/en/connectors/sink/Jdbc.md index 2d07148275..c608440428 100644 --- a/docs/en/connectors/sink/Jdbc.md +++ b/docs/en/connectors/sink/Jdbc.md @@ -359,6 +359,8 @@ Deprecated. Use `table` with table placeholders instead. For example, use `table The target key columns used to generate database-native UPSERT, UPDATE, and DELETE statements. If omitted, SeaTunnel attempts to inherit a primary key or the first unique key from upstream catalog metadata. If no key is available, generated SQL uses plain INSERT. +With `multi_table_sink_replica` above 1 and `is_exactly_once = false`, the sink sends each row to one of the writers of its table by the first column of the table's primary key, or, when the table has none, by the first column of `primary_keys`, configured or inherited from a unique key. The changes of one key then reach the same writer, in order. When that key column holds binary values (SeaTunnel type `BYTES`, for example `BINARY`, `VARBINARY` or `BYTEA`), the writer is chosen by the i [...] + ### connection_check_timeout_sec [int] The time in seconds to wait for the database operation used to validate the connection to complete. diff --git a/docs/zh/connectors/sink/Jdbc.md b/docs/zh/connectors/sink/Jdbc.md index 20fc9f09d8..36ea11b59c 100644 --- a/docs/zh/connectors/sink/Jdbc.md +++ b/docs/zh/connectors/sink/Jdbc.md @@ -360,6 +360,8 @@ Tip: 如果目标数据库有 SCHEMA 的概念,则表参数必须写成 `xxx.x 生成数据库原生 UPSERT、UPDATE 和 DELETE 语句时使用的目标键列。未配置时,SeaTunnel 会尝试从上游 catalog 元数据继承主键或第一组唯一键;仍无可用键时,自动生成的 SQL 退回普通 INSERT。 +当 `multi_table_sink_replica` 大于 1 且 `is_exactly_once = false` 时,Sink 按表主键的第一列把每一行发往该表的某个写入器;表没有主键时,按 `primary_keys`(配置的,或从唯一键继承的)的第一列发送。这样同一个键的变更会按顺序到达同一个写入器。当该键列是二进制类型(SeaTunnel 类型 `BYTES`,例如 `BINARY`、`VARBINARY` 或 `BYTEA`)时,写入器按每一行键值对象的标识而不是内容选择,因此同一个键的变更仍可能到达不同的写入器;对于这类表,请将 `multi_table_sink_replica` 保持为 1。没有这类键的表的行,以及 `is_exactly_once = true` 时的所有行,会不考虑键地分散到各写入器。修改键值的更新可能把该记录移到另一个写入器,不同写入器中的行之间没有顺序。 + ### connection_check_timeout_sec [int] 用于验证数据库连接的有效性时等待数据库操作完成所需的时间,单位是秒 diff --git a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSink.java b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSink.java index 3a07df9013..cc544821ad 100644 --- a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSink.java +++ b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSink.java @@ -143,7 +143,7 @@ public class JdbcSink new ArrayList<>()); } else { - Integer primaryKeyIndex = getPrimaryKeyIndex(tableSchema).orElse(null); + Integer primaryKeyIndex = routingKeyIndex().orElse(null); sinkWriter = new JdbcSinkWriter( sinkTablePath, @@ -158,14 +158,41 @@ public class JdbcSink return sinkWriter; } - static Optional<Integer> getPrimaryKeyIndex(TableSchema tableSchema) { + /** The routing key position the writers of this table get, see {@link #getPrimaryKeyIndex}. */ + Optional<Integer> routingKeyIndex() { + return getPrimaryKeyIndex(tableSchema, jdbcSinkConfig.getPrimaryKeys()); + } + + /** + * Returns the position of the column that the multi-table sink routes rows by when it runs + * several writers of this table, so that all changes of one record reach the same writer. + * + * <p>It is the first column of the schema primary key. When the schema has none, it is the + * first column of the key the sink writes by: {@code primary_keys}, which the factory also + * fills from a UNIQUE key of the table. Without either, there is no routing key. + * + * <p>The multi-table sink hashes the value with {@code hashCode()}, so the changes of one + * record reach the same writer only when equal values have equal hash codes. A {@code BYTES} + * column holds a {@code byte[]}, whose hash code is its identity, and gives no such guarantee. + * + * @param tableSchema the schema of the rows this sink receives + * @param sinkPrimaryKeys the {@code primary_keys} the sink upserts by, may be {@code null} + * @return the column position, or empty when the table has no usable key + */ + static Optional<Integer> getPrimaryKeyIndex( + TableSchema tableSchema, List<String> sinkPrimaryKeys) { PrimaryKey primaryKey = tableSchema.getPrimaryKey(); - if (primaryKey == null - || primaryKey.getColumnNames() == null - || primaryKey.getColumnNames().isEmpty()) { + if (primaryKey != null + && primaryKey.getColumnNames() != null + && !primaryKey.getColumnNames().isEmpty()) { + int index = + tableSchema.toPhysicalRowDataType().indexOf(primaryKey.getColumnNames().get(0)); + return index > -1 ? Optional.of(index) : Optional.empty(); + } + if (sinkPrimaryKeys == null || sinkPrimaryKeys.isEmpty()) { return Optional.empty(); } - int index = tableSchema.toPhysicalRowDataType().indexOf(primaryKey.getColumnNames().get(0)); + int index = tableSchema.toPhysicalRowDataType().indexOf(sinkPrimaryKeys.get(0), false); return index > -1 ? Optional.of(index) : Optional.empty(); } diff --git a/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkFactoryTest.java b/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkFactoryTest.java index 75cf15bfad..aa6b2b118e 100644 --- a/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkFactoryTest.java +++ b/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkFactoryTest.java @@ -22,6 +22,7 @@ import org.apache.seatunnel.api.configuration.util.ConfigValidator; import org.apache.seatunnel.api.configuration.util.OptionRule; import org.apache.seatunnel.api.configuration.util.OptionValidationException; import org.apache.seatunnel.api.table.catalog.CatalogTable; +import org.apache.seatunnel.api.table.catalog.ConstraintKey; import org.apache.seatunnel.api.table.catalog.PhysicalColumn; import org.apache.seatunnel.api.table.catalog.PrimaryKey; import org.apache.seatunnel.api.table.catalog.TableIdentifier; @@ -36,6 +37,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -87,6 +89,48 @@ class JdbcSinkFactoryTest { "catalog"); } + /** + * A table with a UNIQUE key on {@code name} (column 1) and deliberately no primary key: the + * factory then takes {@code primary_keys} from the unique key, which is the fallback that the + * routing tests below need. Adding a primary key would make them test the primary key path. + */ + private CatalogTable createCatalogTableWithUniqueKeyOnName() { + TableSchema schema = + TableSchema.builder() + .column(PhysicalColumn.of("id", BasicType.LONG_TYPE, 22, false, null, "id")) + .column( + PhysicalColumn.of( + "name", BasicType.STRING_TYPE, 128, false, null, "name")) + .constraintKey( + ConstraintKey.of( + ConstraintKey.ConstraintType.UNIQUE_KEY, + "uk_name", + Collections.singletonList( + ConstraintKey.ConstraintKeyColumn.of( + "name", ConstraintKey.ColumnSortType.ASC)))) + .build(); + return CatalogTable.of( + TableIdentifier.of("catalog", "ORCL", null, "TEST_TABLE"), + schema, + new HashMap<>(), + new ArrayList<>(), + null, + "catalog"); + } + + /** + * Creates the sink as a job submission does: the option rule validates {@code cfg}, then {@code + * factory.createSink} derives the effective key, so the sink sees the same {@code primary_keys} + * and schema as at runtime. + */ + private JdbcSink createJdbcSink(Map<String, Object> cfg, CatalogTable catalogTable) { + ReadonlyConfig config = ReadonlyConfig.fromMap(cfg); + ConfigValidator.of(config).validate(factory.optionRule()); + TableSinkFactoryContext context = + new TableSinkFactoryContext(catalogTable, config, getClass().getClassLoader()); + return (JdbcSink) factory.createSink(context).createSink(); + } + /** * Simulates the FactoryUtil.createAndPrepareSink entry path: OptionRule validation followed by * factory.createSink(context). This covers the real submission-time path end-to-end. @@ -327,4 +371,44 @@ class JdbcSinkFactoryTest { JdbcConnectorException.class, () -> createSinkViaFactoryContext(cfg, true)); } } + + /** + * A table with only a UNIQUE key gets {@code primary_keys} from it, so the sink upserts by that + * column. Its writers must route by the same column, or the changes of one row could reach + * different writers when {@code multi_table_sink_replica} is above 1. + */ + @Test + void testUniqueKeyOnlyTableRoutesByItsUniqueColumn() { + JdbcSink sink = createJdbcSink(baseConfig(), createCatalogTableWithUniqueKeyOnName()); + + Assertions.assertEquals(1, sink.routingKeyIndex().get()); + } + + @Test + void testRoutingKeyFollowsConfiguredPrimaryKeysAndIsEmptyWithoutAnyKey() { + Map<String, Object> cfg = baseConfig(); + cfg.put("primary_keys", Arrays.asList("name")); + Assertions.assertEquals( + 1, createJdbcSink(cfg, createCatalogTable(false)).routingKeyIndex().get()); + + Assertions.assertFalse( + createJdbcSink(baseConfig(), createCatalogTable(false)) + .routingKeyIndex() + .isPresent()); + Assertions.assertEquals( + 0, createJdbcSink(baseConfig(), createCatalogTable(true)).routingKeyIndex().get()); + } + + /** + * Configured {@code primary_keys} replace the primary key of the table for upserts, so the + * writers route by them too, not by the primary key of the table. + */ + @Test + void testConfiguredPrimaryKeysRouteInsteadOfThePrimaryKeyOfTheTable() { + Map<String, Object> cfg = baseConfig(); + cfg.put("primary_keys", Arrays.asList("name")); + + Assertions.assertEquals( + 1, createJdbcSink(cfg, createCatalogTable(true)).routingKeyIndex().get()); + } } diff --git a/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkTest.java b/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkTest.java index f715ea0a1d..376ee9871d 100644 --- a/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkTest.java +++ b/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkTest.java @@ -25,6 +25,7 @@ import org.apache.seatunnel.api.table.type.BasicType; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import java.util.Arrays; import java.util.Collections; class JdbcSinkTest { @@ -41,7 +42,7 @@ class JdbcSinkTest { .primaryKey(PrimaryKey.of("empty_pk", Collections.emptyList())) .build(); - Assertions.assertFalse(JdbcSink.getPrimaryKeyIndex(tableSchema).isPresent()); + Assertions.assertFalse(JdbcSink.getPrimaryKeyIndex(tableSchema, null).isPresent()); } @Test @@ -56,7 +57,7 @@ class JdbcSinkTest { .primaryKey(PrimaryKey.of("null_pk", null)) .build(); - Assertions.assertFalse(JdbcSink.getPrimaryKeyIndex(tableSchema).isPresent()); + Assertions.assertFalse(JdbcSink.getPrimaryKeyIndex(tableSchema, null).isPresent()); } @Test @@ -76,6 +77,63 @@ class JdbcSinkTest { .primaryKey(PrimaryKey.of("id_pk", Collections.singletonList("id"))) .build(); - Assertions.assertEquals(1, JdbcSink.getPrimaryKeyIndex(tableSchema).get()); + Assertions.assertEquals(1, JdbcSink.getPrimaryKeyIndex(tableSchema, null).get()); + } + + @Test + void getPrimaryKeyIndexFallsBackToTheSinkKeyWhenTheSchemaHasNone() { + // A table with only a UNIQUE key: the factory sets primary_keys from it, so the sink + // upserts by "code", and the rows of one code must be routed by it. + TableSchema tableSchema = nameAndCodeSchema(null); + + Assertions.assertEquals( + 1, JdbcSink.getPrimaryKeyIndex(tableSchema, Arrays.asList("code", "name")).get()); + } + + @Test + void getPrimaryKeyIndexPrefersTheSchemaPrimaryKey() { + TableSchema tableSchema = + nameAndCodeSchema(PrimaryKey.of("name_pk", Collections.singletonList("name"))); + + Assertions.assertEquals( + 0, + JdbcSink.getPrimaryKeyIndex(tableSchema, Collections.singletonList("code")).get()); + } + + @Test + void getPrimaryKeyIndexIsEmptyWithoutAnyKey() { + TableSchema tableSchema = nameAndCodeSchema(null); + + Assertions.assertFalse(JdbcSink.getPrimaryKeyIndex(tableSchema, null).isPresent()); + Assertions.assertFalse( + JdbcSink.getPrimaryKeyIndex(tableSchema, Collections.emptyList()).isPresent()); + } + + @Test + void getPrimaryKeyIndexIgnoresASinkKeyThatIsNotInTheRow() { + TableSchema tableSchema = nameAndCodeSchema(null); + + Assertions.assertFalse( + JdbcSink.getPrimaryKeyIndex(tableSchema, Collections.singletonList("missing")) + .isPresent()); + } + + private static TableSchema nameAndCodeSchema(PrimaryKey primaryKey) { + TableSchema.Builder builder = + TableSchema.builder() + .column( + PhysicalColumn.builder() + .name("name") + .dataType(BasicType.STRING_TYPE) + .build()) + .column( + PhysicalColumn.builder() + .name("code") + .dataType(BasicType.STRING_TYPE) + .build()); + if (primaryKey != null) { + builder.primaryKey(primaryKey); + } + return builder.build(); } } diff --git a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-3/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcSinkCDCChangelogIT.java b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-3/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcSinkCDCChangelogIT.java index 95d62ab685..99fbd54315 100644 --- a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-3/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcSinkCDCChangelogIT.java +++ b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-3/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcSinkCDCChangelogIT.java @@ -133,6 +133,58 @@ public class JdbcSinkCDCChangelogIT extends TestSuiteBase implements TestResourc } } + /** + * A table with only a UNIQUE key: the sink upserts by that key without {@code primary_keys}, + * and with {@code multi_table_sink_replica = 2} the changes of one key must stay in order, so + * the table ends with the last version of each key and without the deleted keys. + */ + @TestTemplate + public void testUniqueKeyTableKeepsTheLastChangeOfEachKeyWithReplicas(TestContainer container) + throws IOException, InterruptedException, SQLException { + // Each engine runs this against the same table, so a failed run must not leave rows for + // the next one: empty it before the job and again when the test ends either way. + truncateSinkUnique(); + try { + Container.ExecResult execResult = + container.executeJob("/jdbc_sink_cdc_changelog_unique_key_replicas.conf"); + Assertions.assertEquals(0, execResult.getExitCode(), execResult.getStderr()); + + Set<List<Object>> actual = new HashSet<>(); + try (Connection connection = + DriverManager.getConnection( + postgreSQLContainer.getJdbcUrl(), + postgreSQLContainer.getUsername(), + postgreSQLContainer.getPassword()); + Statement statement = connection.createStatement(); + ResultSet resultSet = + statement.executeQuery("select code, val from sink_unique")) { + while (resultSet.next()) { + actual.add( + Arrays.asList(resultSet.getLong("code"), resultSet.getString("val"))); + } + } + // Every key is inserted as v1 and updated to v2; every even key is then deleted. + Set<List<Object>> expected = new HashSet<>(); + for (long code = 1; code <= 100; code += 2) { + expected.add(Arrays.asList(code, "v2")); + } + Assertions.assertEquals(expected, actual); + } finally { + truncateSinkUnique(); + } + } + + private void truncateSinkUnique() throws SQLException { + try (Connection connection = + DriverManager.getConnection( + postgreSQLContainer.getJdbcUrl(), + postgreSQLContainer.getUsername(), + postgreSQLContainer.getPassword()); + Statement statement = connection.createStatement()) { + statement.execute("truncate table sink_unique"); + } + } + private void initializeJdbcTable() { try (Connection connection = DriverManager.getConnection( @@ -147,6 +199,11 @@ public class JdbcSinkCDCChangelogIT extends TestSuiteBase implements TestResourc + "score INT\n" + ")"; statement.execute(sink); + statement.execute( + "create table sink_unique(\n" + + "code BIGINT NOT NULL UNIQUE,\n" + + "val varchar(255)\n" + + ")"); } catch (SQLException e) { throw new RuntimeException("Initializing PostgreSql table failed!", e); } diff --git a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-3/src/test/resources/jdbc_sink_cdc_changelog_unique_key_replicas.conf b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-3/src/test/resources/jdbc_sink_cdc_changelog_unique_key_replicas.conf new file mode 100644 index 0000000000..69cc4be6d7 --- /dev/null +++ b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-3/src/test/resources/jdbc_sink_cdc_changelog_unique_key_replicas.conf @@ -0,0 +1,408 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +env { + parallelism = 1 + job.mode = "BATCH" +} + +# The table has only a UNIQUE key on code, so the sink upserts by code without primary_keys. +# With two writers per table, every change of one code must reach the same writer. +source { + FakeSource { + schema = { + fields { + code = bigint + val = string + } + constraintKeys = [ + { + constraintName = "uk_code" + constraintType = UNIQUE_KEY + constraintColumns = [ + { columnName = code, sortType = ASC } + ] + } + ] + } + rows = [ + { kind = INSERT, fields = [1, "v1"] }, + { kind = UPDATE_BEFORE, fields = [1, "v1"] }, + { kind = UPDATE_AFTER, fields = [1, "v2"] }, + { kind = INSERT, fields = [2, "v1"] }, + { kind = UPDATE_BEFORE, fields = [2, "v1"] }, + { kind = UPDATE_AFTER, fields = [2, "v2"] }, + { kind = DELETE, fields = [2, "v2"] }, + { kind = INSERT, fields = [3, "v1"] }, + { kind = UPDATE_BEFORE, fields = [3, "v1"] }, + { kind = UPDATE_AFTER, fields = [3, "v2"] }, + { kind = INSERT, fields = [4, "v1"] }, + { kind = UPDATE_BEFORE, fields = [4, "v1"] }, + { kind = UPDATE_AFTER, fields = [4, "v2"] }, + { kind = DELETE, fields = [4, "v2"] }, + { kind = INSERT, fields = [5, "v1"] }, + { kind = UPDATE_BEFORE, fields = [5, "v1"] }, + { kind = UPDATE_AFTER, fields = [5, "v2"] }, + { kind = INSERT, fields = [6, "v1"] }, + { kind = UPDATE_BEFORE, fields = [6, "v1"] }, + { kind = UPDATE_AFTER, fields = [6, "v2"] }, + { kind = DELETE, fields = [6, "v2"] }, + { kind = INSERT, fields = [7, "v1"] }, + { kind = UPDATE_BEFORE, fields = [7, "v1"] }, + { kind = UPDATE_AFTER, fields = [7, "v2"] }, + { kind = INSERT, fields = [8, "v1"] }, + { kind = UPDATE_BEFORE, fields = [8, "v1"] }, + { kind = UPDATE_AFTER, fields = [8, "v2"] }, + { kind = DELETE, fields = [8, "v2"] }, + { kind = INSERT, fields = [9, "v1"] }, + { kind = UPDATE_BEFORE, fields = [9, "v1"] }, + { kind = UPDATE_AFTER, fields = [9, "v2"] }, + { kind = INSERT, fields = [10, "v1"] }, + { kind = UPDATE_BEFORE, fields = [10, "v1"] }, + { kind = UPDATE_AFTER, fields = [10, "v2"] }, + { kind = DELETE, fields = [10, "v2"] }, + { kind = INSERT, fields = [11, "v1"] }, + { kind = UPDATE_BEFORE, fields = [11, "v1"] }, + { kind = UPDATE_AFTER, fields = [11, "v2"] }, + { kind = INSERT, fields = [12, "v1"] }, + { kind = UPDATE_BEFORE, fields = [12, "v1"] }, + { kind = UPDATE_AFTER, fields = [12, "v2"] }, + { kind = DELETE, fields = [12, "v2"] }, + { kind = INSERT, fields = [13, "v1"] }, + { kind = UPDATE_BEFORE, fields = [13, "v1"] }, + { kind = UPDATE_AFTER, fields = [13, "v2"] }, + { kind = INSERT, fields = [14, "v1"] }, + { kind = UPDATE_BEFORE, fields = [14, "v1"] }, + { kind = UPDATE_AFTER, fields = [14, "v2"] }, + { kind = DELETE, fields = [14, "v2"] }, + { kind = INSERT, fields = [15, "v1"] }, + { kind = UPDATE_BEFORE, fields = [15, "v1"] }, + { kind = UPDATE_AFTER, fields = [15, "v2"] }, + { kind = INSERT, fields = [16, "v1"] }, + { kind = UPDATE_BEFORE, fields = [16, "v1"] }, + { kind = UPDATE_AFTER, fields = [16, "v2"] }, + { kind = DELETE, fields = [16, "v2"] }, + { kind = INSERT, fields = [17, "v1"] }, + { kind = UPDATE_BEFORE, fields = [17, "v1"] }, + { kind = UPDATE_AFTER, fields = [17, "v2"] }, + { kind = INSERT, fields = [18, "v1"] }, + { kind = UPDATE_BEFORE, fields = [18, "v1"] }, + { kind = UPDATE_AFTER, fields = [18, "v2"] }, + { kind = DELETE, fields = [18, "v2"] }, + { kind = INSERT, fields = [19, "v1"] }, + { kind = UPDATE_BEFORE, fields = [19, "v1"] }, + { kind = UPDATE_AFTER, fields = [19, "v2"] }, + { kind = INSERT, fields = [20, "v1"] }, + { kind = UPDATE_BEFORE, fields = [20, "v1"] }, + { kind = UPDATE_AFTER, fields = [20, "v2"] }, + { kind = DELETE, fields = [20, "v2"] }, + { kind = INSERT, fields = [21, "v1"] }, + { kind = UPDATE_BEFORE, fields = [21, "v1"] }, + { kind = UPDATE_AFTER, fields = [21, "v2"] }, + { kind = INSERT, fields = [22, "v1"] }, + { kind = UPDATE_BEFORE, fields = [22, "v1"] }, + { kind = UPDATE_AFTER, fields = [22, "v2"] }, + { kind = DELETE, fields = [22, "v2"] }, + { kind = INSERT, fields = [23, "v1"] }, + { kind = UPDATE_BEFORE, fields = [23, "v1"] }, + { kind = UPDATE_AFTER, fields = [23, "v2"] }, + { kind = INSERT, fields = [24, "v1"] }, + { kind = UPDATE_BEFORE, fields = [24, "v1"] }, + { kind = UPDATE_AFTER, fields = [24, "v2"] }, + { kind = DELETE, fields = [24, "v2"] }, + { kind = INSERT, fields = [25, "v1"] }, + { kind = UPDATE_BEFORE, fields = [25, "v1"] }, + { kind = UPDATE_AFTER, fields = [25, "v2"] }, + { kind = INSERT, fields = [26, "v1"] }, + { kind = UPDATE_BEFORE, fields = [26, "v1"] }, + { kind = UPDATE_AFTER, fields = [26, "v2"] }, + { kind = DELETE, fields = [26, "v2"] }, + { kind = INSERT, fields = [27, "v1"] }, + { kind = UPDATE_BEFORE, fields = [27, "v1"] }, + { kind = UPDATE_AFTER, fields = [27, "v2"] }, + { kind = INSERT, fields = [28, "v1"] }, + { kind = UPDATE_BEFORE, fields = [28, "v1"] }, + { kind = UPDATE_AFTER, fields = [28, "v2"] }, + { kind = DELETE, fields = [28, "v2"] }, + { kind = INSERT, fields = [29, "v1"] }, + { kind = UPDATE_BEFORE, fields = [29, "v1"] }, + { kind = UPDATE_AFTER, fields = [29, "v2"] }, + { kind = INSERT, fields = [30, "v1"] }, + { kind = UPDATE_BEFORE, fields = [30, "v1"] }, + { kind = UPDATE_AFTER, fields = [30, "v2"] }, + { kind = DELETE, fields = [30, "v2"] }, + { kind = INSERT, fields = [31, "v1"] }, + { kind = UPDATE_BEFORE, fields = [31, "v1"] }, + { kind = UPDATE_AFTER, fields = [31, "v2"] }, + { kind = INSERT, fields = [32, "v1"] }, + { kind = UPDATE_BEFORE, fields = [32, "v1"] }, + { kind = UPDATE_AFTER, fields = [32, "v2"] }, + { kind = DELETE, fields = [32, "v2"] }, + { kind = INSERT, fields = [33, "v1"] }, + { kind = UPDATE_BEFORE, fields = [33, "v1"] }, + { kind = UPDATE_AFTER, fields = [33, "v2"] }, + { kind = INSERT, fields = [34, "v1"] }, + { kind = UPDATE_BEFORE, fields = [34, "v1"] }, + { kind = UPDATE_AFTER, fields = [34, "v2"] }, + { kind = DELETE, fields = [34, "v2"] }, + { kind = INSERT, fields = [35, "v1"] }, + { kind = UPDATE_BEFORE, fields = [35, "v1"] }, + { kind = UPDATE_AFTER, fields = [35, "v2"] }, + { kind = INSERT, fields = [36, "v1"] }, + { kind = UPDATE_BEFORE, fields = [36, "v1"] }, + { kind = UPDATE_AFTER, fields = [36, "v2"] }, + { kind = DELETE, fields = [36, "v2"] }, + { kind = INSERT, fields = [37, "v1"] }, + { kind = UPDATE_BEFORE, fields = [37, "v1"] }, + { kind = UPDATE_AFTER, fields = [37, "v2"] }, + { kind = INSERT, fields = [38, "v1"] }, + { kind = UPDATE_BEFORE, fields = [38, "v1"] }, + { kind = UPDATE_AFTER, fields = [38, "v2"] }, + { kind = DELETE, fields = [38, "v2"] }, + { kind = INSERT, fields = [39, "v1"] }, + { kind = UPDATE_BEFORE, fields = [39, "v1"] }, + { kind = UPDATE_AFTER, fields = [39, "v2"] }, + { kind = INSERT, fields = [40, "v1"] }, + { kind = UPDATE_BEFORE, fields = [40, "v1"] }, + { kind = UPDATE_AFTER, fields = [40, "v2"] }, + { kind = DELETE, fields = [40, "v2"] }, + { kind = INSERT, fields = [41, "v1"] }, + { kind = UPDATE_BEFORE, fields = [41, "v1"] }, + { kind = UPDATE_AFTER, fields = [41, "v2"] }, + { kind = INSERT, fields = [42, "v1"] }, + { kind = UPDATE_BEFORE, fields = [42, "v1"] }, + { kind = UPDATE_AFTER, fields = [42, "v2"] }, + { kind = DELETE, fields = [42, "v2"] }, + { kind = INSERT, fields = [43, "v1"] }, + { kind = UPDATE_BEFORE, fields = [43, "v1"] }, + { kind = UPDATE_AFTER, fields = [43, "v2"] }, + { kind = INSERT, fields = [44, "v1"] }, + { kind = UPDATE_BEFORE, fields = [44, "v1"] }, + { kind = UPDATE_AFTER, fields = [44, "v2"] }, + { kind = DELETE, fields = [44, "v2"] }, + { kind = INSERT, fields = [45, "v1"] }, + { kind = UPDATE_BEFORE, fields = [45, "v1"] }, + { kind = UPDATE_AFTER, fields = [45, "v2"] }, + { kind = INSERT, fields = [46, "v1"] }, + { kind = UPDATE_BEFORE, fields = [46, "v1"] }, + { kind = UPDATE_AFTER, fields = [46, "v2"] }, + { kind = DELETE, fields = [46, "v2"] }, + { kind = INSERT, fields = [47, "v1"] }, + { kind = UPDATE_BEFORE, fields = [47, "v1"] }, + { kind = UPDATE_AFTER, fields = [47, "v2"] }, + { kind = INSERT, fields = [48, "v1"] }, + { kind = UPDATE_BEFORE, fields = [48, "v1"] }, + { kind = UPDATE_AFTER, fields = [48, "v2"] }, + { kind = DELETE, fields = [48, "v2"] }, + { kind = INSERT, fields = [49, "v1"] }, + { kind = UPDATE_BEFORE, fields = [49, "v1"] }, + { kind = UPDATE_AFTER, fields = [49, "v2"] }, + { kind = INSERT, fields = [50, "v1"] }, + { kind = UPDATE_BEFORE, fields = [50, "v1"] }, + { kind = UPDATE_AFTER, fields = [50, "v2"] }, + { kind = DELETE, fields = [50, "v2"] }, + { kind = INSERT, fields = [51, "v1"] }, + { kind = UPDATE_BEFORE, fields = [51, "v1"] }, + { kind = UPDATE_AFTER, fields = [51, "v2"] }, + { kind = INSERT, fields = [52, "v1"] }, + { kind = UPDATE_BEFORE, fields = [52, "v1"] }, + { kind = UPDATE_AFTER, fields = [52, "v2"] }, + { kind = DELETE, fields = [52, "v2"] }, + { kind = INSERT, fields = [53, "v1"] }, + { kind = UPDATE_BEFORE, fields = [53, "v1"] }, + { kind = UPDATE_AFTER, fields = [53, "v2"] }, + { kind = INSERT, fields = [54, "v1"] }, + { kind = UPDATE_BEFORE, fields = [54, "v1"] }, + { kind = UPDATE_AFTER, fields = [54, "v2"] }, + { kind = DELETE, fields = [54, "v2"] }, + { kind = INSERT, fields = [55, "v1"] }, + { kind = UPDATE_BEFORE, fields = [55, "v1"] }, + { kind = UPDATE_AFTER, fields = [55, "v2"] }, + { kind = INSERT, fields = [56, "v1"] }, + { kind = UPDATE_BEFORE, fields = [56, "v1"] }, + { kind = UPDATE_AFTER, fields = [56, "v2"] }, + { kind = DELETE, fields = [56, "v2"] }, + { kind = INSERT, fields = [57, "v1"] }, + { kind = UPDATE_BEFORE, fields = [57, "v1"] }, + { kind = UPDATE_AFTER, fields = [57, "v2"] }, + { kind = INSERT, fields = [58, "v1"] }, + { kind = UPDATE_BEFORE, fields = [58, "v1"] }, + { kind = UPDATE_AFTER, fields = [58, "v2"] }, + { kind = DELETE, fields = [58, "v2"] }, + { kind = INSERT, fields = [59, "v1"] }, + { kind = UPDATE_BEFORE, fields = [59, "v1"] }, + { kind = UPDATE_AFTER, fields = [59, "v2"] }, + { kind = INSERT, fields = [60, "v1"] }, + { kind = UPDATE_BEFORE, fields = [60, "v1"] }, + { kind = UPDATE_AFTER, fields = [60, "v2"] }, + { kind = DELETE, fields = [60, "v2"] }, + { kind = INSERT, fields = [61, "v1"] }, + { kind = UPDATE_BEFORE, fields = [61, "v1"] }, + { kind = UPDATE_AFTER, fields = [61, "v2"] }, + { kind = INSERT, fields = [62, "v1"] }, + { kind = UPDATE_BEFORE, fields = [62, "v1"] }, + { kind = UPDATE_AFTER, fields = [62, "v2"] }, + { kind = DELETE, fields = [62, "v2"] }, + { kind = INSERT, fields = [63, "v1"] }, + { kind = UPDATE_BEFORE, fields = [63, "v1"] }, + { kind = UPDATE_AFTER, fields = [63, "v2"] }, + { kind = INSERT, fields = [64, "v1"] }, + { kind = UPDATE_BEFORE, fields = [64, "v1"] }, + { kind = UPDATE_AFTER, fields = [64, "v2"] }, + { kind = DELETE, fields = [64, "v2"] }, + { kind = INSERT, fields = [65, "v1"] }, + { kind = UPDATE_BEFORE, fields = [65, "v1"] }, + { kind = UPDATE_AFTER, fields = [65, "v2"] }, + { kind = INSERT, fields = [66, "v1"] }, + { kind = UPDATE_BEFORE, fields = [66, "v1"] }, + { kind = UPDATE_AFTER, fields = [66, "v2"] }, + { kind = DELETE, fields = [66, "v2"] }, + { kind = INSERT, fields = [67, "v1"] }, + { kind = UPDATE_BEFORE, fields = [67, "v1"] }, + { kind = UPDATE_AFTER, fields = [67, "v2"] }, + { kind = INSERT, fields = [68, "v1"] }, + { kind = UPDATE_BEFORE, fields = [68, "v1"] }, + { kind = UPDATE_AFTER, fields = [68, "v2"] }, + { kind = DELETE, fields = [68, "v2"] }, + { kind = INSERT, fields = [69, "v1"] }, + { kind = UPDATE_BEFORE, fields = [69, "v1"] }, + { kind = UPDATE_AFTER, fields = [69, "v2"] }, + { kind = INSERT, fields = [70, "v1"] }, + { kind = UPDATE_BEFORE, fields = [70, "v1"] }, + { kind = UPDATE_AFTER, fields = [70, "v2"] }, + { kind = DELETE, fields = [70, "v2"] }, + { kind = INSERT, fields = [71, "v1"] }, + { kind = UPDATE_BEFORE, fields = [71, "v1"] }, + { kind = UPDATE_AFTER, fields = [71, "v2"] }, + { kind = INSERT, fields = [72, "v1"] }, + { kind = UPDATE_BEFORE, fields = [72, "v1"] }, + { kind = UPDATE_AFTER, fields = [72, "v2"] }, + { kind = DELETE, fields = [72, "v2"] }, + { kind = INSERT, fields = [73, "v1"] }, + { kind = UPDATE_BEFORE, fields = [73, "v1"] }, + { kind = UPDATE_AFTER, fields = [73, "v2"] }, + { kind = INSERT, fields = [74, "v1"] }, + { kind = UPDATE_BEFORE, fields = [74, "v1"] }, + { kind = UPDATE_AFTER, fields = [74, "v2"] }, + { kind = DELETE, fields = [74, "v2"] }, + { kind = INSERT, fields = [75, "v1"] }, + { kind = UPDATE_BEFORE, fields = [75, "v1"] }, + { kind = UPDATE_AFTER, fields = [75, "v2"] }, + { kind = INSERT, fields = [76, "v1"] }, + { kind = UPDATE_BEFORE, fields = [76, "v1"] }, + { kind = UPDATE_AFTER, fields = [76, "v2"] }, + { kind = DELETE, fields = [76, "v2"] }, + { kind = INSERT, fields = [77, "v1"] }, + { kind = UPDATE_BEFORE, fields = [77, "v1"] }, + { kind = UPDATE_AFTER, fields = [77, "v2"] }, + { kind = INSERT, fields = [78, "v1"] }, + { kind = UPDATE_BEFORE, fields = [78, "v1"] }, + { kind = UPDATE_AFTER, fields = [78, "v2"] }, + { kind = DELETE, fields = [78, "v2"] }, + { kind = INSERT, fields = [79, "v1"] }, + { kind = UPDATE_BEFORE, fields = [79, "v1"] }, + { kind = UPDATE_AFTER, fields = [79, "v2"] }, + { kind = INSERT, fields = [80, "v1"] }, + { kind = UPDATE_BEFORE, fields = [80, "v1"] }, + { kind = UPDATE_AFTER, fields = [80, "v2"] }, + { kind = DELETE, fields = [80, "v2"] }, + { kind = INSERT, fields = [81, "v1"] }, + { kind = UPDATE_BEFORE, fields = [81, "v1"] }, + { kind = UPDATE_AFTER, fields = [81, "v2"] }, + { kind = INSERT, fields = [82, "v1"] }, + { kind = UPDATE_BEFORE, fields = [82, "v1"] }, + { kind = UPDATE_AFTER, fields = [82, "v2"] }, + { kind = DELETE, fields = [82, "v2"] }, + { kind = INSERT, fields = [83, "v1"] }, + { kind = UPDATE_BEFORE, fields = [83, "v1"] }, + { kind = UPDATE_AFTER, fields = [83, "v2"] }, + { kind = INSERT, fields = [84, "v1"] }, + { kind = UPDATE_BEFORE, fields = [84, "v1"] }, + { kind = UPDATE_AFTER, fields = [84, "v2"] }, + { kind = DELETE, fields = [84, "v2"] }, + { kind = INSERT, fields = [85, "v1"] }, + { kind = UPDATE_BEFORE, fields = [85, "v1"] }, + { kind = UPDATE_AFTER, fields = [85, "v2"] }, + { kind = INSERT, fields = [86, "v1"] }, + { kind = UPDATE_BEFORE, fields = [86, "v1"] }, + { kind = UPDATE_AFTER, fields = [86, "v2"] }, + { kind = DELETE, fields = [86, "v2"] }, + { kind = INSERT, fields = [87, "v1"] }, + { kind = UPDATE_BEFORE, fields = [87, "v1"] }, + { kind = UPDATE_AFTER, fields = [87, "v2"] }, + { kind = INSERT, fields = [88, "v1"] }, + { kind = UPDATE_BEFORE, fields = [88, "v1"] }, + { kind = UPDATE_AFTER, fields = [88, "v2"] }, + { kind = DELETE, fields = [88, "v2"] }, + { kind = INSERT, fields = [89, "v1"] }, + { kind = UPDATE_BEFORE, fields = [89, "v1"] }, + { kind = UPDATE_AFTER, fields = [89, "v2"] }, + { kind = INSERT, fields = [90, "v1"] }, + { kind = UPDATE_BEFORE, fields = [90, "v1"] }, + { kind = UPDATE_AFTER, fields = [90, "v2"] }, + { kind = DELETE, fields = [90, "v2"] }, + { kind = INSERT, fields = [91, "v1"] }, + { kind = UPDATE_BEFORE, fields = [91, "v1"] }, + { kind = UPDATE_AFTER, fields = [91, "v2"] }, + { kind = INSERT, fields = [92, "v1"] }, + { kind = UPDATE_BEFORE, fields = [92, "v1"] }, + { kind = UPDATE_AFTER, fields = [92, "v2"] }, + { kind = DELETE, fields = [92, "v2"] }, + { kind = INSERT, fields = [93, "v1"] }, + { kind = UPDATE_BEFORE, fields = [93, "v1"] }, + { kind = UPDATE_AFTER, fields = [93, "v2"] }, + { kind = INSERT, fields = [94, "v1"] }, + { kind = UPDATE_BEFORE, fields = [94, "v1"] }, + { kind = UPDATE_AFTER, fields = [94, "v2"] }, + { kind = DELETE, fields = [94, "v2"] }, + { kind = INSERT, fields = [95, "v1"] }, + { kind = UPDATE_BEFORE, fields = [95, "v1"] }, + { kind = UPDATE_AFTER, fields = [95, "v2"] }, + { kind = INSERT, fields = [96, "v1"] }, + { kind = UPDATE_BEFORE, fields = [96, "v1"] }, + { kind = UPDATE_AFTER, fields = [96, "v2"] }, + { kind = DELETE, fields = [96, "v2"] }, + { kind = INSERT, fields = [97, "v1"] }, + { kind = UPDATE_BEFORE, fields = [97, "v1"] }, + { kind = UPDATE_AFTER, fields = [97, "v2"] }, + { kind = INSERT, fields = [98, "v1"] }, + { kind = UPDATE_BEFORE, fields = [98, "v1"] }, + { kind = UPDATE_AFTER, fields = [98, "v2"] }, + { kind = DELETE, fields = [98, "v2"] }, + { kind = INSERT, fields = [99, "v1"] }, + { kind = UPDATE_BEFORE, fields = [99, "v1"] }, + { kind = UPDATE_AFTER, fields = [99, "v2"] }, + { kind = INSERT, fields = [100, "v1"] }, + { kind = UPDATE_BEFORE, fields = [100, "v1"] }, + { kind = UPDATE_AFTER, fields = [100, "v2"] }, + { kind = DELETE, fields = [100, "v2"] } + ] + } +} + +sink { + Jdbc { + driver = org.postgresql.Driver + url = "jdbc:postgresql://postgresql:5432/test?loggerLevel=OFF" + username = test + password = test + generate_sink_sql = true + database = test + table = public.sink_unique + multi_table_sink_replica = 2 + } +}
