-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[fix](cloud-mow) schema change should retry when encouter TXN_CONFILCT in cloud mode #46748
Open
hust-hhb
wants to merge
6
commits into
apache:master
Choose a base branch
from
hust-hhb:sc-retry
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+173
−2
Open
Changes from 4 commits
Commits
Show all changes
6 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 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
130 changes: 130 additions & 0 deletions
130
regression-test/suites/schema_change_p0/test_schema_change_with_mow_txn_conflict.groovy
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,130 @@ | ||
// 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. | ||
|
||
import java.util.concurrent.TimeUnit | ||
import org.awaitility.Awaitility | ||
|
||
suite("test_schema_change_with_mow_txn_conflict", "p0") { | ||
def customFeConfig = [ | ||
schema_change_max_retry_time: 10 | ||
] | ||
setFeConfigTemporary(customFeConfig) { | ||
try { | ||
def tableName3 = "test_all_unique_mow" | ||
GetDebugPoint().enableDebugPointForAllBEs("CloudSchemaChangeJob::_convert_historical_rowsets.test_conflict") | ||
|
||
def getJobState = { tableName -> | ||
def jobStateResult = sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """ | ||
return jobStateResult[0][9] | ||
} | ||
|
||
def getCreateViewState = { tableName -> | ||
def createViewStateResult = sql """ SHOW ALTER TABLE MATERIALIZED VIEW WHERE IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """ | ||
return createViewStateResult[0][8] | ||
} | ||
|
||
def execStreamLoad = { | ||
streamLoad { | ||
table "${tableName3}" | ||
|
||
set 'column_separator', ',' | ||
|
||
file 'all_types.csv' | ||
time 10000 // limit inflight 10s | ||
|
||
check { result, exception, startTime, endTime -> | ||
if (exception != null) { | ||
throw exception | ||
} | ||
log.info("Stream load result: ${result}".toString()) | ||
def json = parseJson(result) | ||
assertEquals("success", json.Status.toLowerCase()) | ||
assertEquals(2500, json.NumberTotalRows) | ||
assertEquals(0, json.NumberFilteredRows) | ||
} | ||
} | ||
} | ||
|
||
sql """ DROP TABLE IF EXISTS ${tableName3} """ | ||
|
||
sql """ | ||
CREATE TABLE IF NOT EXISTS ${tableName3} ( | ||
`k1` int(11) NULL, | ||
`k2` tinyint(4) NULL, | ||
`k3` smallint(6) NULL, | ||
`k4` int(30) NULL, | ||
`k5` largeint(40) NULL, | ||
`k6` float NULL, | ||
`k7` double NULL, | ||
`k8` decimal(9, 0) NULL, | ||
`k9` char(10) NULL, | ||
`k10` varchar(1024) NULL, | ||
`k11` text NULL, | ||
`k12` date NULL, | ||
`k13` datetime NULL | ||
) ENGINE=OLAP | ||
unique KEY(k1, k2, k3) | ||
DISTRIBUTED BY HASH(`k1`) BUCKETS 5 | ||
PROPERTIES ( | ||
"replication_allocation" = "tag.location.default: 1", | ||
"enable_unique_key_merge_on_write" = "true" | ||
); | ||
""" | ||
execStreamLoad() | ||
|
||
sql """ alter table ${tableName3} modify column k4 string NULL""" | ||
|
||
Awaitility.await().atMost(600, TimeUnit.SECONDS).pollDelay(10, TimeUnit.MILLISECONDS).pollInterval(10, TimeUnit.MILLISECONDS).until( | ||
{ | ||
String res = getJobState(tableName3) | ||
if (res == "FINISHED" || res == "CANCELLED") { | ||
assertEquals("FINISHED", res) | ||
return true | ||
} | ||
execStreamLoad() | ||
return false | ||
} | ||
) | ||
|
||
sql """ alter table ${tableName3} add column v14 int NOT NULL default "1" after k13 """ | ||
Awaitility.await().atMost(60, TimeUnit.SECONDS).pollDelay(10, TimeUnit.MILLISECONDS).pollInterval(10, TimeUnit.MILLISECONDS).until( | ||
{ | ||
String res = getJobState(tableName3) | ||
if (res == "FINISHED" || res == "CANCELLED") { | ||
assertEquals("FINISHED", res) | ||
return true | ||
} | ||
execStreamLoad() | ||
return false | ||
} | ||
) | ||
sql """ insert into ${tableName3} values (10001, 2, 3, 4, 5, 6.6, 1.7, 8.8, | ||
'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00', 10086) """ | ||
List<List<Object>> result = sql """ select * from ${tableName3} """ | ||
for (row : result) { | ||
assertEquals(2, row[1]); | ||
assertEquals(3, row[2]); | ||
assertEquals("4", row[3]); | ||
assertEquals("5", row[4]); | ||
} | ||
} finally { | ||
GetDebugPoint().disableDebugPointForAllBEs("CloudSchemaChangeJob::_convert_historical_rowsets.test_conflict") | ||
} | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.
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.
Why return such error for all rpc? DELETE_BITMAP_LOCK_ERROR is only used for delete
bitmap lock related rpc
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.
already remove and use another way to judge @zhannngchen