Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#11252] Limit query to one row for faster response #11273

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
}

int resultLimit = 20;
Scan scan = this.createScan(agentStatType, agentId, range, resultLimit);
Scan scan = this.checkExist(agentStatType, agentId, range, resultLimit);

Check warning on line 93 in web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/stat/HbaseAgentStatDaoOperations.java

View check run for this annotation

Codecov / codecov/patch

web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/stat/HbaseAgentStatDaoOperations.java#L93

Added line #L93 was not covered by tests

TableName agentStatTableName = tableNameProvider.getTableName(columnFamily.getTable());
List<List<T>> result = hbaseOperations.findParallel(agentStatTableName, scan, this.operationFactory.getRowKeyDistributor(), resultLimit, mapper, AGENT_STAT_VER2_NUM_PARTITIONS);
Expand Down Expand Up @@ -130,5 +130,12 @@
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;

Check warning on line 139 in web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/stat/HbaseAgentStatDaoOperations.java

View check run for this annotation

Codecov / codecov/patch

web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/stat/HbaseAgentStatDaoOperations.java#L134-L139

Added lines #L134 - L139 were not covered by tests
}
}