From 0d6ab3c68c1acc17892f0042b9ebab2bf0b46f45 Mon Sep 17 00:00:00 2001 From: yujun Date: Thu, 11 Jan 2024 20:40:08 +0800 Subject: [PATCH] [chore](regression test) check disk is good (#29740) --- .../apache/doris/master/ReportHandler.java | 7 +++-- .../storage_medium_p0/test_disk_health.groovy | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 regression-test/suites/storage_medium_p0/test_disk_health.groovy diff --git a/fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java b/fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java index 2c8dc80aff..7d9d9ac825 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java @@ -563,9 +563,12 @@ public class ReportHandler extends Daemon { LOG.warn("backend doesn't exist. id: " + backendId); return; } + List badDisks = backendDisks.values().stream().filter(disk -> !disk.isUsed()) + .map(disk -> "path=" + disk.getRootPath() + ", path hash=" + disk.getPathHash()) + .collect(Collectors.toList()); backend.updateDisks(backendDisks); - LOG.info("finished to handle disk report from backend {}, cost: {} ms", - backendId, (System.currentTimeMillis() - start)); + LOG.info("finished to handle disk report from backend: {}, disk size: {}, bad disk: {}, cost: {} ms", + backendId, backendDisks.size(), badDisks, (System.currentTimeMillis() - start)); } private static void cpuReport(long backendId, int cpuCores, int pipelineExecutorSize) { diff --git a/regression-test/suites/storage_medium_p0/test_disk_health.groovy b/regression-test/suites/storage_medium_p0/test_disk_health.groovy new file mode 100644 index 0000000000..70e76b2bd9 --- /dev/null +++ b/regression-test/suites/storage_medium_p0/test_disk_health.groovy @@ -0,0 +1,27 @@ +// 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_disk_health', 'p0,p1,p2') { + def backends = sql_return_maparray "SHOW PROC '/backends'" + backends.each { be -> + def disks = sql_return_maparray "SHOW PROC '/backends/${be.BackendId}'" + assertTrue(disks.size() > 0, "backend ${be.Host} no disks".toString()) + disks.each { disk -> + assertEquals('ONLINE', disk.State, "backend ${be.Host} disk ${disk.RootPath} is bad") + } + } +}