DBZ-5423 Update the test case & document the changes

This commit is contained in:
Anisha Mohanty 2022-08-16 18:10:25 +05:30 committed by Jiri Pechanec
parent 9b9f41369a
commit 22f260e09d
2 changed files with 19 additions and 5 deletions

View File

@ -2703,18 +2703,26 @@ public void verifyRenameTable() throws Exception {
recordsForTopic = records.recordsForTopic("server1.testDB1.dbo.account"); recordsForTopic = records.recordsForTopic("server1.testDB1.dbo.account");
recordsForNewTableTopic = records.recordsForTopic("server1.testDB1.dbo.account_new"); recordsForNewTableTopic = records.recordsForTopic("server1.testDB1.dbo.account_new");
final Schema expectedSchemaAfter = SchemaBuilder.struct()
.optional()
.name("server1.testDB1.dbo.account_new.Value")
.field("id", Schema.INT32_SCHEMA)
.field("name", Schema.OPTIONAL_STRING_SCHEMA)
.field("amount", Schema.OPTIONAL_INT32_SCHEMA)
.build();
// Assert state // Assert state
assertThat(recordsForTopic).hasSize(1); assertThat(recordsForTopic).isNull();
assertThat(recordsForNewTableTopic).isNull(); assertThat(recordsForNewTableTopic).hasSize(1);
assertNoRecordsToConsume(); assertNoRecordsToConsume();
SourceRecordAssert.assertThat(recordsForTopic.get(0)) SourceRecordAssert.assertThat(recordsForNewTableTopic.get(0))
.valueAfterFieldIsEqualTo( .valueAfterFieldIsEqualTo(
new Struct(expectedSchema) new Struct(expectedSchemaAfter)
.put("id", 12) .put("id", 12)
.put("name", "some_value2") .put("name", "some_value2")
.put("amount", 241)) .put("amount", 241))
.valueAfterFieldSchemaIsEqualTo(expectedSchema); .valueAfterFieldSchemaIsEqualTo(expectedSchemaAfter);
stopConnector(); stopConnector();
} }

View File

@ -2700,6 +2700,12 @@ That is, columns that were previously defined as optional (or `NULL`) continue t
Similarly, columns that had been defined as required (`NOT NULL`), retain that designation, although they are now defined as `NULL`. Similarly, columns that had been defined as required (`NOT NULL`), retain that designation, although they are now defined as `NULL`.
==== ====
[NOTE]
====
After you rename a table using `sp_rename` function, it will continue to emit changes under the old source table name until the connector is restarted.
Upon restart of the connector, it will emit changes under the new source table name.
====
// Type: procedure // Type: procedure
// ModuleID: debezium-sql-server-connector-running-an-offline-update-after-a-schema-change // ModuleID: debezium-sql-server-connector-running-an-offline-update-after-a-schema-change
// Title: Running an offline update after a schema change // Title: Running an offline update after a schema change