forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[regression test](control) add some regression case for control (apac…
…he#27346) * [regression test](control) add some regression case for control ``` 1. CANCEL DECOMMISSION BACKEND 2. SET REPLICA STATUS 3. CLEAN TRASH 4. SET REPLICA VERSION 5. BAD REPLICA ```
- Loading branch information
Showing
5 changed files
with
207 additions
and
6 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
73 changes: 73 additions & 0 deletions
73
regression-test/suites/control_p0/set_replica_status.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,73 @@ | ||
// 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_set_replica_status", "p0") { | ||
def tableName = "test_set_replica_status_table" | ||
sql "DROP TABLE IF EXISTS ${tableName}" | ||
sql """ | ||
CREATE TABLE ${tableName} ( | ||
`id` LARGEINT NOT NULL, | ||
`count` LARGEINT SUM DEFAULT "0") | ||
AGGREGATE KEY(`id`) | ||
DISTRIBUTED BY HASH(`id`) BUCKETS 2 | ||
PROPERTIES | ||
( | ||
"replication_num" = "1" | ||
) | ||
""" | ||
|
||
List<String> values = [] | ||
for (int i = 1; i <= 10; ++i) { | ||
values.add("(${i}, ${i})") | ||
} | ||
sql """INSERT INTO ${tableName} VALUES ${values.join(",")}""" | ||
|
||
def result = sql_return_maparray """show tablets from ${tableName}""" | ||
assertNotNull(result) | ||
def tabletId = null | ||
def backendId = null | ||
for (def res : result) { | ||
tabletId = res.TabletId | ||
backendId = res.BackendId | ||
break | ||
} | ||
sql """ADMIN SET REPLICA STATUS PROPERTIES("tablet_id" = "${tabletId}", "backend_id" = "${backendId}", "status" = "bad");""" | ||
result = sql_return_maparray """ADMIN SHOW REPLICA STATUS FROM ${tableName}""" | ||
for (def res : result) { | ||
if (res.TabletId == tabletId) { | ||
logger.info("admin show replica status ${res}") | ||
assertTrue(res.IsBad.toBoolean()) | ||
} | ||
} | ||
sql """ADMIN SET REPLICA STATUS PROPERTIES("tablet_id" = "${tabletId}", "backend_id" = "${backendId}", "status" = "ok");""" | ||
result = sql_return_maparray """ADMIN SHOW REPLICA STATUS FROM ${tableName}""" | ||
for (def res : result) { | ||
if (res.TabletId == tabletId) { | ||
logger.info("admin show replica status ${res}") | ||
assertFalse(res.IsBad.toBoolean()) | ||
} | ||
} | ||
sql """ADMIN SET REPLICA VERSION PROPERTIES("tablet_id" = "${tabletId}", "backend_id" = "${backendId}", "last_failed_version" = "10");""" | ||
result = sql_return_maparray """ADMIN SHOW REPLICA STATUS FROM ${tableName}""" | ||
for (def res : result) { | ||
if (res.TabletId == tabletId) { | ||
logger.info("admin show replica version ${res}") | ||
assertEquals(10L, res.LastFailedVersion.toLong()) | ||
} | ||
} | ||
sql """ADMIN CLEAN TRASH""" | ||
} |
73 changes: 73 additions & 0 deletions
73
regression-test/suites/control_p0/test_report_version_missing.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,73 @@ | ||
// 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 org.apache.doris.regression.suite.ClusterOptions | ||
import org.apache.doris.regression.util.NodeType | ||
|
||
suite('test_report_version_missing', "nonConcurrent") { | ||
def tableName = "test_set_replica_status_table_in_docker" | ||
sql "DROP TABLE IF EXISTS ${tableName}" | ||
sql """ | ||
CREATE TABLE ${tableName} ( | ||
`id` LARGEINT NOT NULL, | ||
`count` LARGEINT SUM DEFAULT "0") | ||
AGGREGATE KEY(`id`) | ||
DISTRIBUTED BY HASH(`id`) BUCKETS 1 | ||
PROPERTIES | ||
( | ||
"replication_num" = "1" | ||
) | ||
""" | ||
List<String> values = [] | ||
for (int i = 1; i <= 10; ++i) { | ||
values.add("(${i}, ${i})") | ||
} | ||
sql """INSERT INTO ${tableName} VALUES ${values.join(",")}""" | ||
|
||
def result = sql_return_maparray """show tablets from ${tableName}""" | ||
assertNotNull(result) | ||
def tabletId = null | ||
for (def res : result) { | ||
tabletId = res.TabletId | ||
break | ||
} | ||
try { | ||
GetDebugPoint().enableDebugPointForAllBEs("Tablet.build_tablet_report_info.version_miss", [tablet_id:"${tabletId}",version_miss:true]) | ||
boolean succ = false | ||
|
||
for (int i = 0; i < 3; ++i) { | ||
result = sql_return_maparray """show tablets from ${tableName}""" | ||
logger.info("show tablets from ${result}, has after ${i} * 60 s") | ||
assertNotNull(result) | ||
// LstFailedVersion > 0, version missing | ||
for (def res : result) { | ||
if (res.TabletId.toLong() == tabletId.toLong() && res.LstFailedVersion.toLong() > 0) { | ||
succ = true | ||
break | ||
} | ||
} | ||
if (succ) { | ||
break | ||
} | ||
Thread.sleep(60000) | ||
} | ||
assertTrue(succ) | ||
|
||
} finally { | ||
GetDebugPoint().disableDebugPointForAllBEs("Tablet.build_tablet_report_info.version_miss") | ||
} | ||
} |
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