-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[branch-2.1] Picks "[Fix](merge-on-write) Fix duplicate key problem after adding sequence column for merge-on-write table #39958" #40010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
16 changes: 16 additions & 0 deletions
16
regression-test/data/unique_with_mow_p0/test_mow_enable_sequence_col.out
This file contains hidden or 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,16 @@ | ||
| -- This file is automatically generated. You should know what you did if you want to edit this | ||
| -- !sql -- | ||
| 111 aaa bbb 11 | ||
| 222 bbb bbb 11 | ||
| 333 ccc ddd 11 | ||
|
|
||
| -- !sql -- | ||
| 111 aaa bbb 11 \N 0 2 | ||
| 222 bbb bbb 11 \N 0 3 | ||
| 333 ccc ddd 11 \N 0 4 | ||
|
|
||
| -- !sql -- | ||
| 111 zzz yyy 100 99 0 5 | ||
| 222 xxx www 400 99 0 8 | ||
| 333 ccc ddd 11 \N 0 4 | ||
|
|
71 changes: 71 additions & 0 deletions
71
regression-test/suites/unique_with_mow_p0/test_mow_enable_sequence_col.groovy
This file contains hidden or 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,71 @@ | ||
| // 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. | ||
|
|
||
| suite("test_mow_enable_sequence_col") { | ||
|
|
||
| def tableName = "test_mow_enable_sequence_col" | ||
| sql """ DROP TABLE IF EXISTS ${tableName} force;""" | ||
| sql """CREATE TABLE IF NOT EXISTS ${tableName} | ||
| (`user_id` BIGINT NOT NULL, | ||
| `username` VARCHAR(50) NOT NULL, | ||
| `city` VARCHAR(20), | ||
| `age` SMALLINT) | ||
| UNIQUE KEY(`user_id`) | ||
| DISTRIBUTED BY HASH(`user_id`) BUCKETS 1 | ||
| PROPERTIES ( | ||
| "disable_auto_compaction" = "true", | ||
| "replication_allocation" = "tag.location.default: 1", | ||
| "enable_unique_key_merge_on_write" = "true");""" | ||
|
|
||
| sql """insert into ${tableName}(`user_id`,`username`,`city`,`age`) VALUES(111,'aaa','bbb',11);""" | ||
| sql """insert into ${tableName}(`user_id`,`username`,`city`,`age`) VALUES(222,'bbb','bbb',11);""" | ||
| sql """insert into ${tableName}(`user_id`,`username`,`city`,`age`) VALUES(333,'ccc','ddd',11);""" | ||
| order_qt_sql "select * from ${tableName};" | ||
|
|
||
| sql "set show_hidden_columns = true;" | ||
| sql "sync;" | ||
| def res = sql "desc ${tableName} all;" | ||
| assertTrue(!res.toString().contains("__DORIS_SEQUENCE_COL__")) | ||
| sql "set show_hidden_columns = false;" | ||
| sql "sync;" | ||
|
|
||
| def doSchemaChange = { cmd -> | ||
| sql cmd | ||
| waitForSchemaChangeDone { | ||
| sql """SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1""" | ||
| time 2000 | ||
| } | ||
| } | ||
| doSchemaChange """ALTER TABLE ${tableName} ENABLE FEATURE "SEQUENCE_LOAD" WITH PROPERTIES ("function_column.sequence_type" = "bigint");""" | ||
|
|
||
| sql "set show_hidden_columns = true;" | ||
| sql "sync;" | ||
| res = sql "desc ${tableName} all;" | ||
| assertTrue(res.toString().contains("__DORIS_SEQUENCE_COL__")) | ||
| order_qt_sql "select * from ${tableName};" | ||
| sql "set show_hidden_columns = false;" | ||
| sql "sync;" | ||
|
|
||
| sql """insert into ${tableName}(`user_id`,`username`,`city`,`age`, `__DORIS_SEQUENCE_COL__`) VALUES(111,'zzz','yyy',100,99);""" | ||
| sql """insert into ${tableName}(`user_id`,`username`,`city`,`age`, `__DORIS_SEQUENCE_COL__`) VALUES(111,'hhh','mmm',200,88);""" | ||
| sql """insert into ${tableName}(`user_id`,`username`,`city`,`age`, `__DORIS_SEQUENCE_COL__`) VALUES(222,'qqq','ppp',300,77);""" | ||
| sql """insert into ${tableName}(`user_id`,`username`,`city`,`age`, `__DORIS_SEQUENCE_COL__`) VALUES(222,'xxx','www',400,99);""" | ||
|
|
||
| sql "set show_hidden_columns = true;" | ||
| sql "sync;" | ||
| order_qt_sql "select * from ${tableName};" | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: function 'lookup_row_key' exceeds recommended size/complexity thresholds [readability-function-size]
Additional context
be/src/olap/rowset/segment_v2/segment.cpp:695: 87 lines including whitespace and comments (threshold 80)