-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix](partial update) Fix
__DORIS_SEQUENCE_COL__
is not set for new…
…ly inserted rows in partial update (#40272) ## Proposed changes ### 1. Fix `__DORIS_SEQUENCE_COL__` is not set for newly inserted rows in partial update before: ```sql MySQL [email protected]:d1> CREATE TABLE IF NOT EXISTS t3 ( -> `k` BIGINT NOT NULL, -> `c1` int, -> `c2` datetime default current_timestamp, -> ) UNIQUE KEY(`k`) -> DISTRIBUTED BY HASH(`k`) BUCKETS 1 -> PROPERTIES ( -> "replication_allocation" = "tag.location.default: 1", -> "enable_unique_key_merge_on_write" = "true", -> "function_column.sequence_col" = "c2" -> ); Query OK, 0 rows affected MySQL [email protected]:d1> set enable_insert_strict=false; MySQL [email protected]:d1> set enable_unique_key_partial_update=true; MySQL [email protected]:d1> insert into t3(k,c1) values(99,99); MySQL [email protected]:d1> set show_hidden_columns=true; MySQL [email protected]:d1> select * from t3; +----+----+---------------------+-----------------------+-----------------------+------------------------+ | k | c1 | c2 | __DORIS_DELETE_SIGN__ | __DORIS_VERSION_COL__ | __DORIS_SEQUENCE_COL__ | +----+----+---------------------+-----------------------+-----------------------+------------------------+ | 99 | 99 | 2024-09-02 11:03:09 | 0 | 2 | <null> | +----+----+---------------------+-----------------------+-----------------------+------------------------+ ``` after: ```sql MySQL [email protected]:d1> CREATE TABLE IF NOT EXISTS t3 ( -> `k` BIGINT NOT NULL, -> `c1` int, -> `c2` datetime default current_timestamp, -> ) UNIQUE KEY(`k`) -> DISTRIBUTED BY HASH(`k`) BUCKETS 1 -> PROPERTIES ( -> "replication_allocation" = "tag.location.default: 1", -> "enable_unique_key_merge_on_write" = "true", -> "function_column.sequence_col" = "c2" -> ); Query OK, 0 rows affected MySQL [email protected]:d1> set enable_insert_strict=false; MySQL [email protected]:d1> set enable_unique_key_partial_update=true; MySQL [email protected]:d1> insert into t3(k,c1) values(1,10); MySQL [email protected]:d1> set show_hidden_columns=true; MySQL [email protected]:d1> select * from t3; +---+----+---------------------+-----------------------+-----------------------+------------------------+ | k | c1 | c2 | __DORIS_DELETE_SIGN__ | __DORIS_VERSION_COL__ | __DORIS_SEQUENCE_COL__ | +---+----+---------------------+-----------------------+-----------------------+------------------------+ | 1 | 10 | 2024-09-02 16:49:50 | 0 | 2 | 2024-09-02 16:49:50 | +---+----+---------------------+-----------------------+-----------------------+------------------------+ ``` ### 2. Fix `current_timestamp()` precision loss for newly inserted rows in partial update before: ```sql MySQL [email protected]:d1> CREATE TABLE IF NOT EXISTS t3 ( -> `k` BIGINT NOT NULL, -> `c1` int, -> `c2` datetime(6) default current_timestamp(6), -> ) UNIQUE KEY(`k`) -> DISTRIBUTED BY HASH(`k`) BUCKETS 1 -> PROPERTIES ( -> "replication_allocation" = "tag.location.default: 1", -> "enable_unique_key_merge_on_write" = "true", -> "function_column.sequence_col" = "c2" -> ); Query OK, 0 rows affected MySQL [email protected]:d1> set enable_unique_key_partial_update=true; MySQL [email protected]:d1> set enable_insert_strict=false; MySQL [email protected]:d1> insert into t3(k,c1) values(3,10); MySQL [email protected]:d1> set show_hidden_columns=true; MySQL [email protected]:d1> select * from t3; +---+----+----------------------------+-----------------------+-----------------------+----------------------------+ | k | c1 | c2 | __DORIS_DELETE_SIGN__ | __DORIS_VERSION_COL__ | __DORIS_SEQUENCE_COL__ | +---+----+----------------------------+-----------------------+-----------------------+----------------------------+ | 3 | 10 | 2024-09-02 19:04:55 | 0 | 2 | <null> | +---+----+----------------------------+-----------------------+-----------------------+----------------------------+ ``` after: ```sql MySQL [email protected]:d1> CREATE TABLE IF NOT EXISTS t3 ( -> `k` BIGINT NOT NULL, -> `c1` int, -> `c2` datetime(6) default current_timestamp(6), -> ) UNIQUE KEY(`k`) -> DISTRIBUTED BY HASH(`k`) BUCKETS 1 -> PROPERTIES ( -> "replication_allocation" = "tag.location.default: 1", -> "enable_unique_key_merge_on_write" = "true", -> "function_column.sequence_col" = "c2" -> ); Query OK, 0 rows affected MySQL [email protected]:d1> set enable_unique_key_partial_update=true; MySQL [email protected]:d1> set enable_insert_strict=false; MySQL [email protected]:d1> insert into t3(k,c1) values(3,10); MySQL [email protected]:d1> set show_hidden_columns=true; MySQL [email protected]:d1> select * from t3; +---+----+----------------------------+-----------------------+-----------------------+----------------------------+ | k | c1 | c2 | __DORIS_DELETE_SIGN__ | __DORIS_VERSION_COL__ | __DORIS_SEQUENCE_COL__ | +---+----+----------------------------+-----------------------+-----------------------+----------------------------+ | 3 | 10 | 2024-09-02 19:04:55.464438 | 0 | 2 | 2024-09-02 19:04:55.464438 | +---+----+----------------------------+-----------------------+-----------------------+----------------------------+ ```
- Loading branch information
1 parent
79c3338
commit a6e57d1
Showing
15 changed files
with
411 additions
and
16 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
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
Oops, something went wrong.