-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flash-456] alter for nullable attribute (#207)
- Loading branch information
1 parent
1a9376b
commit 9512e10
Showing
10 changed files
with
134 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
# Preparation. | ||
=> DBGInvoke __enable_schema_sync_service('false') | ||
|
||
=> DBGInvoke __drop_tidb_table(default, test) | ||
=> drop table if exists default.test | ||
=> DBGInvoke __refresh_schemas() | ||
|
||
=> DBGInvoke __set_flush_threshold(1000000, 1000000) | ||
|
||
# Sync add column by reading. | ||
=> DBGInvoke __mock_tidb_table(default, test, 'col_1 String, col_2 Int8, col_3 Int32') | ||
=> DBGInvoke __refresh_schemas() | ||
=> DBGInvoke __put_region(4, 0, 100, default, test) | ||
=> DBGInvoke __raft_insert_row(default, test, 4, 50, 'test', 1, 3) | ||
=> DBGInvoke __raft_insert_row(default, test, 4, 51, 'test', 2, 4) | ||
=> DBGInvoke __try_flush_region(4) | ||
|
||
# test add nullable flag and change type at the same time. | ||
=> DBGInvoke __modify_column_in_tidb_table(default, test, 'col_2 Nullable(Int32)') | ||
# test trigger by background worker. | ||
=> DBGInvoke __refresh_schemas() | ||
=> select col_2 from default.test | ||
┌─col_2─┐ | ||
│ 1 │ | ||
│ 2 │ | ||
└───────┘ | ||
|
||
# test only add nullable. | ||
=> DBGInvoke __modify_column_in_tidb_table(default, test, 'col_3 Nullable(Int32)') | ||
|
||
=> DBGInvoke __put_region(5, 100, 150, default, test) | ||
=> DBGInvoke __raft_insert_row(default, test, 5, 100, 'test', 1, NULL) | ||
=> DBGInvoke __raft_insert_row(default, test, 5, 101, 'test', 2, NULL) | ||
# test trigger by flush worker. | ||
=> DBGInvoke __try_flush_region(5) | ||
|
||
=> select col_3 from default.test | ||
┌─col_2─┐ | ||
│ 3 │ | ||
│ 4 │ | ||
│ \N │ | ||
│ \N │ | ||
└───────┘ | ||
|
||
=> DBGInvoke __drop_tidb_table(default, test) | ||
=> drop table if exists default.test | ||
|
||
# Test convert nullable type to not-null type. | ||
=> DBGInvoke __mock_tidb_table(default, test, 'col_1 String, col_2 Nullable(Int8)') | ||
=> DBGInvoke __put_region(4, 0, 100, default, test) | ||
=> DBGInvoke __raft_insert_row(default, test, 4, 50, 'test', 1) | ||
=> DBGInvoke __raft_insert_row(default, test, 4, 51, 'test', 2) | ||
=> DBGInvoke __try_flush_region(4) | ||
=> select col_2 from default.test | ||
┌─col_2─┐ | ||
│ 1 │ | ||
│ 2 │ | ||
└───────┘ | ||
=> DBGInvoke __modify_column_in_tidb_table(default, test, 'col_2 Int16') | ||
=> DBGInvoke __refresh_schemas() | ||
=> select col_2 from default.test | ||
┌─col_2─┐ | ||
│ 1 │ | ||
│ 2 │ | ||
└───────┘ | ||
|
||
=> DBGInvoke __refresh_schemas() |