This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 0775cbcb0a6 (selectdb-cloud) Reduce FE db lock range for ShowDataStmt #26588 (#26621) 0775cbcb0a6 is described below commit 0775cbcb0a680cccd83a26e14d980ca254646493 Author: walter <patricknicho...@foxmail.com> AuthorDate: Thu Nov 9 23:28:58 2023 +0800 (selectdb-cloud) Reduce FE db lock range for ShowDataStmt #26588 (#26621) Reduce read lock critical sections and avoid execution timeouts --- .../java/org/apache/doris/catalog/Database.java | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java index 74b8608760c..62d2e0bd6d6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java @@ -274,24 +274,23 @@ public class Database extends MetaObject implements Writable, DatabaseIf<Table> public long getUsedDataQuotaWithLock() { long usedDataQuota = 0; readLock(); - try { - for (Table table : this.idToTable.values()) { - if (table.getType() != TableType.OLAP) { - continue; - } + List<Table> tables = new ArrayList<>(this.idToTable.values()); + readUnlock(); - OlapTable olapTable = (OlapTable) table; - olapTable.readLock(); - try { - usedDataQuota = usedDataQuota + olapTable.getDataSize(); - } finally { - olapTable.readUnlock(); - } + for (Table table : tables) { + if (table.getType() != TableType.OLAP) { + continue; + } + + OlapTable olapTable = (OlapTable) table; + olapTable.readLock(); + try { + usedDataQuota = usedDataQuota + olapTable.getDataSize(); + } finally { + olapTable.readUnlock(); } - return usedDataQuota; - } finally { - readUnlock(); } + return usedDataQuota; } public long getReplicaCountWithLock() { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org