This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 2152d5a5ddb [regression test](control) add some regression case for
control (#27346)
2152d5a5ddb is described below
commit 2152d5a5ddb1adc3141f03dc74f26999227b02c2
Author: deardeng <[email protected]>
AuthorDate: Fri Nov 24 16:13:12 2023 +0800
[regression test](control) add some regression case for control (#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
```
---
be/src/olap/tablet.cpp | 29 +++++++++
be/src/olap/tablet.h | 5 --
.../suites/control_p0/set_replica_status.groovy | 73 ++++++++++++++++++++++
.../control_p0/test_report_version_missing.groovy | 73 ++++++++++++++++++++++
regression-test/suites/node_p0/test_backend.groovy | 33 +++++++++-
5 files changed, 207 insertions(+), 6 deletions(-)
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index b9818589650..8de046d6341 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -108,6 +108,7 @@
#include "segment_loader.h"
#include "service/point_query_executor.h"
#include "util/bvar_helper.h"
+#include "util/debug_points.h"
#include "util/defer_op.h"
#include "util/doris_metrics.h"
#include "util/pretty_printer.h"
@@ -1641,6 +1642,21 @@ void Tablet::build_tablet_report_info(TTabletInfo*
tablet_info,
} else {
tablet_info->__set_version_miss(cversion.second < max_version.second);
}
+
+ DBUG_EXECUTE_IF("Tablet.build_tablet_report_info.version_miss", {
+ auto tablet_id = dp->param<int64>("tablet_id", -1);
+ if (tablet_id != -1 && tablet_id == _tablet_meta->tablet_id()) {
+ auto miss = dp->param<bool>("version_miss", true);
+ LOG_WARNING("Tablet.build_tablet_report_info.version_miss")
+ .tag("tablet id", tablet_id)
+ .tag("version_miss", miss);
+ tablet_info->__set_version_miss(miss);
+
+ } else {
+
LOG_WARNING("Tablet.build_tablet_report_info.version_miss").tag("tablet id",
tablet_id);
+ }
+ });
+
// find rowset with max version
auto iter = _rs_version_map.find(max_version);
if (iter == _rs_version_map.end()) {
@@ -1676,6 +1692,19 @@ void Tablet::build_tablet_report_info(TTabletInfo*
tablet_info,
tablet_info->__set_used(false);
}
+ DBUG_EXECUTE_IF("Tablet.build_tablet_report_info.used", {
+ auto tablet_id = dp->param<int64>("tablet_id", -1);
+ if (tablet_id != -1 && tablet_id == _tablet_meta->tablet_id()) {
+ auto used = dp->param<bool>("used", true);
+ LOG_WARNING("Tablet.build_tablet_report_info.used")
+ .tag("tablet id", tablet_id)
+ .tag("used", used);
+ tablet_info->__set_used(used);
+ } else {
+ LOG_WARNING("Tablet.build_tablet_report_info.used").tag("tablet
id", tablet_id);
+ }
+ });
+
// the report version is the largest continuous version, same logic as in
FE side
tablet_info->__set_version(cversion.second);
// Useless but it is a required filed in TTabletInfo
diff --git a/be/src/olap/tablet.h b/be/src/olap/tablet.h
index 5efeb25dd7c..00773c12ac5 100644
--- a/be/src/olap/tablet.h
+++ b/be/src/olap/tablet.h
@@ -276,11 +276,6 @@ public:
// TODO(ygl):
bool is_primary_replica() { return false; }
- // TODO(ygl):
- // eco mode means power saving in new energy car
- // eco mode also means save money in palo
- bool in_eco_mode() { return false; }
-
// return true if the checkpoint is actually done
bool do_tablet_meta_checkpoint();
diff --git a/regression-test/suites/control_p0/set_replica_status.groovy
b/regression-test/suites/control_p0/set_replica_status.groovy
new file mode 100644
index 00000000000..897aa09b2d4
--- /dev/null
+++ b/regression-test/suites/control_p0/set_replica_status.groovy
@@ -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"""
+}
diff --git
a/regression-test/suites/control_p0/test_report_version_missing.groovy
b/regression-test/suites/control_p0/test_report_version_missing.groovy
new file mode 100644
index 00000000000..503be761b7d
--- /dev/null
+++ b/regression-test/suites/control_p0/test_report_version_missing.groovy
@@ -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")
+ }
+}
\ No newline at end of file
diff --git a/regression-test/suites/node_p0/test_backend.groovy
b/regression-test/suites/node_p0/test_backend.groovy
index 5de31b1f964..1fe6f802e90 100644
--- a/regression-test/suites/node_p0/test_backend.groovy
+++ b/regression-test/suites/node_p0/test_backend.groovy
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-suite("test_backend") {
+suite("test_backend", "nonConcurrent") {
def address = "127.0.0.1"
def notExistPort = 12346
@@ -39,4 +39,35 @@ suite("test_backend") {
result = sql """SHOW BACKENDS;"""
logger.info("result:${result}")
}
+
+ if (context.config.jdbcUser.equals("root")) {
+ try {
+ try_sql """admin set frontend
config("drop_backend_after_decommission" = "false")"""
+ def result = sql_return_maparray """SHOW BACKENDS;"""
+ logger.info("show backends result:${result}")
+ def beId1 = null
+ for (def res : result) {
+ beId1 = res.BackendId
+ break
+ }
+ result = sql """ALTER SYSTEM DECOMMISSION BACKEND "${beId1}" """
+ logger.info("ALTER SYSTEM DECOMMISSION BACKEND ${result}")
+ result = sql_return_maparray """SHOW BACKENDS;"""
+ for (def res : result) {
+ if (res.BackendId == "${beId1}") {
+ assertTrue(res.SystemDecommissioned.toBoolean())
+ }
+ }
+ result = sql """CANCEL DECOMMISSION BACKEND "${beId1}" """
+ logger.info("CANCEL DECOMMISSION BACKEND ${result}")
+ result = sql_return_maparray """SHOW BACKENDS;"""
+ for (def res : result) {
+ if (res.BackendId == "${beId1}") {
+ assertFalse(res.SystemDecommissioned.toBoolean())
+ }
+ }
+ } finally {
+ try_sql """admin set frontend
config("drop_backend_after_decommission" = "true")"""
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]