From 3e36505aea95d43fb2ac221dc9331b4991febec7 Mon Sep 17 00:00:00 2001 From: caiconghui <55968745+caiconghui@users.noreply.github.com> Date: Sun, 13 Sep 2020 19:13:28 +0800 Subject: [PATCH] [Bug]Fix bug that tablet info with wrong capacity may cause fe oom (#4567) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Bug]Fix bug that tablet info with wrong capacity may cause fe oom * remove unused code * fix * remove empty line Co-authored-by: caiconghui [蔡聪辉] --- .../org/apache/doris/qe/ShowExecutor.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java index 752b37e7a2..8347b33d5b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java @@ -1240,7 +1240,7 @@ public class ShowExecutor { } else { partitions = olapTable.getPartitions(); } - List> tableInfos = new ArrayList>(); + List> tabletInfos = new ArrayList<>(); String indexName = showStmt.getIndexName(); long indexId = -1; if (indexName != null) { @@ -1260,18 +1260,18 @@ public class ShowExecutor { continue; } TabletsProcDir procDir = new TabletsProcDir(db, index); - tableInfos.addAll(procDir.fetchComparableResult( + tabletInfos.addAll(procDir.fetchComparableResult( showStmt.getVersion(), showStmt.getBackendId(), showStmt.getReplicaState())); - if (sizeLimit > -1 && tableInfos.size() >= sizeLimit) { + if (sizeLimit > -1 && tabletInfos.size() >= sizeLimit) { stop = true; break; } } } - if (sizeLimit > -1 && tableInfos.size() < sizeLimit) { - tableInfos.clear(); + if (sizeLimit > -1 && tabletInfos.size() < sizeLimit) { + tabletInfos.clear(); } else if (sizeLimit > -1) { - tableInfos = tableInfos.subList((int)showStmt.getOffset(), (int)sizeLimit); + tabletInfos = tabletInfos.subList((int)showStmt.getOffset(), (int)sizeLimit); } // order by @@ -1279,15 +1279,15 @@ public class ShowExecutor { ListComparator> comparator = null; if (orderByPairs != null) { OrderByPair[] orderByPairArr = new OrderByPair[orderByPairs.size()]; - comparator = new ListComparator>(orderByPairs.toArray(orderByPairArr)); + comparator = new ListComparator<>(orderByPairs.toArray(orderByPairArr)); } else { // order by tabletId, replicaId - comparator = new ListComparator>(0, 1); + comparator = new ListComparator<>(0, 1); } - Collections.sort(tableInfos, comparator); + Collections.sort(tabletInfos, comparator); - for (List tabletInfo : tableInfos) { - List oneTablet = new ArrayList(tableInfos.size()); + for (List tabletInfo : tabletInfos) { + List oneTablet = new ArrayList(tabletInfo.size()); for (Comparable column : tabletInfo) { oneTablet.add(column.toString()); }