timoninmaxim commented on code in PR #12376:
URL: https://github.com/apache/ignite/pull/12376#discussion_r2399452240


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java:
##########
@@ -683,65 +677,17 @@ private FieldsResult executeFieldsQuery(CacheQuery<?> 
qry, @Nullable Object[] ar
                     args,
                     securitySubjectId(cctx),
                     taskName));
-            }
-
-            // Attempt to get result from cache.
-            resKey = new T2<>(qry.clause(), F.asList(args));
-
-            res = (FieldsResult)qryResCache.get(resKey);
-
-            if (res != null && res.addRecipient(rcpt))
-                return res; // Cached result found.
-
-            res = new FieldsResult(rcpt);
-
-            if (qryResCache.putIfAbsent(resKey, res) != null)
-                resKey = null; // Failed to cache result.
-        }
-        else {
-            assert qry.type() == SPI : "Unexpected query type: " + qry.type();
-
-            if (cctx.events().isRecordable(EVT_CACHE_QUERY_EXECUTED)) {
-                cctx.gridEvents().record(new CacheQueryExecutedEvent<>(
-                    cctx.localNode(),
-                    "SPI query executed.",
-                    EVT_CACHE_QUERY_EXECUTED,
-                    CacheQueryType.SPI.name(),
-                    cctx.name(),
-                    null,
-                    null,
-                    null,
-                    null,
-                    args,
-                    securitySubjectId(cctx),
-                    taskName));
-            }
-
-            res = new FieldsResult(rcpt);
         }
 
-        try {
-            if (qry.type() == SPI) {
-                IgniteSpiCloseableIterator<?> iter = 
cctx.kernalContext().indexing().query(cacheName, F.asList(args),
-                    filter(qry));
+        // Attempt to get result from cache.
+        T2<String, List<Object>> resKey = new T2<>(qry.clause(), 
F.asList(args));
 
-                res.onDone(iter);
-            }
-            else {
-                assert qry.type() == SQL_FIELDS;
+        FieldsResult res = (FieldsResult)qryResCache.get(resKey);
 
-                throw new IllegalStateException("Should never be called.");
-            }
-        }
-        catch (Exception e) {
-            res.onDone(e);
-        }
-        finally {
-            if (resKey != null)
-                qryResCache.remove(resKey, res);

Review Comment:
   and this



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java:
##########
@@ -683,65 +677,17 @@ private FieldsResult executeFieldsQuery(CacheQuery<?> 
qry, @Nullable Object[] ar
                     args,
                     securitySubjectId(cctx),
                     taskName));
-            }
-
-            // Attempt to get result from cache.
-            resKey = new T2<>(qry.clause(), F.asList(args));
-
-            res = (FieldsResult)qryResCache.get(resKey);
-
-            if (res != null && res.addRecipient(rcpt))
-                return res; // Cached result found.
-
-            res = new FieldsResult(rcpt);
-
-            if (qryResCache.putIfAbsent(resKey, res) != null)
-                resKey = null; // Failed to cache result.
-        }
-        else {
-            assert qry.type() == SPI : "Unexpected query type: " + qry.type();
-
-            if (cctx.events().isRecordable(EVT_CACHE_QUERY_EXECUTED)) {
-                cctx.gridEvents().record(new CacheQueryExecutedEvent<>(
-                    cctx.localNode(),
-                    "SPI query executed.",
-                    EVT_CACHE_QUERY_EXECUTED,
-                    CacheQueryType.SPI.name(),
-                    cctx.name(),
-                    null,
-                    null,
-                    null,
-                    null,
-                    args,
-                    securitySubjectId(cctx),
-                    taskName));
-            }
-
-            res = new FieldsResult(rcpt);
         }
 
-        try {
-            if (qry.type() == SPI) {
-                IgniteSpiCloseableIterator<?> iter = 
cctx.kernalContext().indexing().query(cacheName, F.asList(args),
-                    filter(qry));
+        // Attempt to get result from cache.
+        T2<String, List<Object>> resKey = new T2<>(qry.clause(), 
F.asList(args));
 
-                res.onDone(iter);
-            }
-            else {
-                assert qry.type() == SQL_FIELDS;
+        FieldsResult res = (FieldsResult)qryResCache.get(resKey);
 
-                throw new IllegalStateException("Should never be called.");
-            }
-        }
-        catch (Exception e) {
-            res.onDone(e);
-        }
-        finally {
-            if (resKey != null)
-                qryResCache.remove(resKey, res);

Review Comment:
   and here



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to