ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] shuliga commented on a change in pull request #6917: IGNITE-12189 Implementation correct limit for TextQuery
Date Wed, 23 Oct 2019 14:24:19 GMT
shuliga commented on a change in pull request #6917: IGNITE-12189 Implementation correct limit
for TextQuery
URL: https://github.com/apache/ignite/pull/6917#discussion_r338080620
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
 ##########
 @@ -327,9 +331,15 @@ protected void onNodeLeft(UUID evtNodeId) {
     protected void enqueue(Collection<?> col) {
         assert Thread.holdsLock(this);
 
-        queue.add((Collection<R>)col);
-
-        cnt.addAndGet(col.size());
+        if(limitCnt <= 0 || limitCnt >= col.size()) {
+            queue.add((Collection<R>)col);
+            cnt.addAndGet(col.size());
+            limitCnt -= col.size();
+        } else {
+            int toAdd = limitCnt;
+            queue.add(new ArrayList(col).subList(0, toAdd));
 
 Review comment:
   I used `new ArrayList()` because array size here will always be smaller then `pageSize`.
Usually it's around 1000 (please correct me if no). This is small array and there should not
be performance impact. Working with streams seems to be more resource consuming in this case.
   Please consider what should match here, I will update the code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message