This is an automated email from the ASF dual-hosted git repository. rong pushed a commit to branch iotdb-2313 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit e0ddc5fdf6325a3559d887ff66aa0f66159e7e04 Author: Steve Yurong Su <r...@apache.org> AuthorDate: Sat Jan 15 19:22:24 2022 +0800 [IOTDB-2313] REST: GC overhead limit when select * from root.** --- .../protocol/rest/handler/RequestValidationHandler.java | 6 +++--- .../iotdb/db/protocol/rest/impl/RestApiServiceImpl.java | 16 ++++------------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/RequestValidationHandler.java b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/RequestValidationHandler.java index 4c678dc..2837fbc 100644 --- a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/RequestValidationHandler.java +++ b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/RequestValidationHandler.java @@ -31,9 +31,9 @@ public class RequestValidationHandler { public static void validateSQL(SQL sql) { Objects.requireNonNull(sql.getSql(), "sql should not be null"); - Validate.isTrue( - sql.getRowLimit() != null && sql.getRowLimit() > 0, - "rowLimit can not be null and should be positive"); + if (sql.getRowLimit() != null) { + Validate.isTrue(sql.getRowLimit() > 0, "rowLimit should be positive"); + } } public static void validateInsertTabletRequest(InsertTabletRequest insertTabletRequest) { diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/rest/impl/RestApiServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/protocol/rest/impl/RestApiServiceImpl.java index 1308d2a..caf37aa 100644 --- a/server/src/main/java/org/apache/iotdb/db/protocol/rest/impl/RestApiServiceImpl.java +++ b/server/src/main/java/org/apache/iotdb/db/protocol/rest/impl/RestApiServiceImpl.java @@ -110,17 +110,6 @@ public class RestApiServiceImpl extends RestApiService { return response; } - // set max row limit to avoid OOM - Integer rowLimitInRequest = sql.getRowLimit(); - if (rowLimitInRequest == null) { - rowLimitInRequest = defaultQueryRowLimit; - } - int rowLimitInQueryPlan = queryPlan.getRowLimit(); - if (rowLimitInQueryPlan <= 0) { - rowLimitInQueryPlan = defaultQueryRowLimit; - } - final int actualRowSizeLimit = Math.min(rowLimitInRequest, rowLimitInQueryPlan); - final long queryId = QueryResourceManager.getInstance().assignQueryId(true); try { QueryContext queryContext = @@ -133,7 +122,10 @@ public class RestApiServiceImpl extends RestApiService { QueryDataSet queryDataSet = serviceProvider.createQueryDataSet( queryContext, physicalPlan, IoTDBConstant.DEFAULT_FETCH_SIZE); - return QueryDataSetHandler.fillDateSet(queryDataSet, queryPlan, actualRowSizeLimit); + return QueryDataSetHandler.fillDateSet( + queryDataSet, + queryPlan, + sql.getRowLimit() != null ? sql.getRowLimit() : defaultQueryRowLimit); } finally { ServiceProvider.SESSION_MANAGER.releaseQueryResourceNoExceptions(queryId); }