From 5967edb9ecaf5529d6b8672e15676f5f313751dc Mon Sep 17 00:00:00 2001 From: Seoyoung Park Date: Fri, 19 Jul 2024 18:52:03 +0900 Subject: [PATCH] [#11252] Limit query to one row for faster response --- .../dao/hbase/stat/HbaseAgentStatDaoOperations.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/stat/HbaseAgentStatDaoOperations.java b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/stat/HbaseAgentStatDaoOperations.java index 13119212ef44..79fd6b7343c3 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/stat/HbaseAgentStatDaoOperations.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/stat/HbaseAgentStatDaoOperations.java @@ -90,7 +90,7 @@ boolean agentStatExists(AgentStatType agentStatTy } int resultLimit = 20; - Scan scan = this.createScan(agentStatType, agentId, range, resultLimit); + Scan scan = this.checkExist(agentStatType, agentId, range, resultLimit); TableName agentStatTableName = tableNameProvider.getTableName(columnFamily.getTable()); List> result = hbaseOperations.findParallel(agentStatTableName, scan, this.operationFactory.getRowKeyDistributor(), resultLimit, mapper, AGENT_STAT_VER2_NUM_PARTITIONS); @@ -130,5 +130,12 @@ private Scan createScan(AgentStatType agentStatType, String agentId, Range range return scan; } - + private Scan checkExist(AgentStatType agentStatType, String agentId, Range range, int scanCacheSize) { + Scan scan = this.operationFactory.createScan(agentId, agentStatType, range.getFrom(), range.getTo()); + scan.setCaching(scanCacheSize); + scan.setOneRowLimit(); + scan.setId(agentStatType.getChartType()); + scan.addFamily(columnFamily.getName()); + return scan; + } }