This is an automated email from the ASF dual-hosted git repository.
alexpl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 6313ea0371d IGNITE-27891 SQL Calcite: Fix concurrent memory tracker
reset and quota exceed - Fixes #12758.
6313ea0371d is described below
commit 6313ea0371d5be3233d57f236b30cede923e51b1
Author: Aleksey Plekhanov <[email protected]>
AuthorDate: Thu Feb 19 12:31:56 2026 +0300
IGNITE-27891 SQL Calcite: Fix concurrent memory tracker reset and quota
exceed - Fixes #12758.
Signed-off-by: Aleksey Plekhanov <[email protected]>
---
.../query/calcite/exec/ExecutionContext.java | 2 -
.../exec/tracker/ExecutionNodeMemoryTracker.java | 28 ++++-----
.../calcite/exec/tracker/GlobalMemoryTracker.java | 5 +-
.../calcite/exec/tracker/QueryMemoryTracker.java | 18 +++---
.../query/calcite/metadata/RemoteException.java | 2 +-
.../query/calcite/util/ListFieldsQueryCursor.java | 9 ++-
.../calcite/exec/tracker/MemoryTrackerTest.java | 47 +++++++++++----
.../integration/AbstractBasicIntegrationTest.java | 13 +----
.../integration/MemoryQuotasIntegrationTest.java | 68 +++++++++++++---------
9 files changed, 113 insertions(+), 79 deletions(-)
diff --git
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
index 2c533c06c21..1e7bda269da 100644
---
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
+++
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
@@ -426,8 +426,6 @@ public class ExecutionContext<Row> extends
AbstractQueryContext implements DataC
}
catch (Throwable e) {
onError.accept(e);
-
- throw new IgniteException("Unexpected exception", e);
}
});
}
diff --git
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/ExecutionNodeMemoryTracker.java
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/ExecutionNodeMemoryTracker.java
index 81866044e5e..8573f14f2bc 100644
---
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/ExecutionNodeMemoryTracker.java
+++
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/ExecutionNodeMemoryTracker.java
@@ -58,15 +58,15 @@ public class ExecutionNodeMemoryTracker<Row> implements
RowTracker<Row> {
long size = sizeCalculator.sizeOf(obj);
size += rowOverhead;
- long newAllocated = allocated + size;
- if (newAllocated > prevReported) {
- long newReported = (newAllocated + (BATCH_SIZE - 1)) &
-BATCH_SIZE; // Align to batch size.
- qryMemoryTracker.onMemoryAllocated(newReported - prevReported);
+ allocated += size;
+
+ if (allocated > prevReported) {
+ long newReported = (allocated + (BATCH_SIZE - 1)) & -BATCH_SIZE;
// Align to batch size.
+ long diff = newReported - prevReported;
prevReported = newReported;
+ qryMemoryTracker.onMemoryAllocated(diff);
}
-
- allocated = newAllocated;
}
/** {@inheritDoc} */
@@ -77,23 +77,25 @@ public class ExecutionNodeMemoryTracker<Row> implements
RowTracker<Row> {
size = Math.min(size, allocated);
if (size > 0) {
- long newAllocated = allocated - size;
+ allocated -= size;
- if (newAllocated <= prevReported - BATCH_SIZE) {
- long newReported = (newAllocated + (BATCH_SIZE - 1)) &
-BATCH_SIZE; // Align to batch size.
- qryMemoryTracker.onMemoryReleased(prevReported - newReported);
+ if (allocated <= prevReported - BATCH_SIZE) {
+ long newReported = (allocated + (BATCH_SIZE - 1)) &
-BATCH_SIZE; // Align to batch size.
+ long diff = prevReported - newReported;
prevReported = newReported;
+ qryMemoryTracker.onMemoryReleased(diff);
}
-
- allocated = newAllocated;
}
}
/** {@inheritDoc} */
@Override public void reset() {
- if (prevReported > 0)
+ if (prevReported > 0) {
qryMemoryTracker.onMemoryReleased(prevReported);
+ prevReported = 0;
+ }
+
allocated = 0;
}
}
diff --git
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/GlobalMemoryTracker.java
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/GlobalMemoryTracker.java
index 2df82bc9ebf..7934938cb50 100644
---
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/GlobalMemoryTracker.java
+++
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/GlobalMemoryTracker.java
@@ -39,11 +39,8 @@ public class GlobalMemoryTracker implements MemoryTracker {
/** {@inheritDoc} */
@Override public void onMemoryAllocated(long size) {
- if (allocated.addAndGet(size) > quota) {
- allocated.addAndGet(-size);
-
+ if (allocated.addAndGet(size) > quota)
throw new IgniteException("Global memory quota for SQL queries
exceeded [quota=" + quota + ']');
- }
}
/** {@inheritDoc} */
diff --git
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/QueryMemoryTracker.java
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/QueryMemoryTracker.java
index 44d8480366d..159983112e7 100644
---
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/QueryMemoryTracker.java
+++
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/QueryMemoryTracker.java
@@ -50,16 +50,10 @@ public class QueryMemoryTracker implements MemoryTracker {
/** {@inheritDoc} */
@Override public void onMemoryAllocated(long size) {
try {
- if (allocated.addAndGet(size) > quota && quota > 0)
- throw new IgniteException("Query quota exceeded [quota=" +
quota + ']');
-
parent.onMemoryAllocated(size);
}
- catch (Exception e) {
- // Undo changes in case of quota exceeded.
- release(size);
-
- throw e;
+ finally {
+ allocate(size);
}
}
@@ -71,7 +65,13 @@ public class QueryMemoryTracker implements MemoryTracker {
parent.onMemoryReleased(released);
}
- /** Release size, but no more than currently allocated. */
+ /** Allocate size for current query. */
+ private void allocate(long size) {
+ if (allocated.addAndGet(size) > quota && quota > 0)
+ throw new IgniteException("Query quota exceeded [quota=" + quota +
']');
+ }
+
+ /** Release size for current query, but no more than currently allocated.
*/
private long release(long size) {
long wasAllocated;
long released;
diff --git
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/RemoteException.java
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/RemoteException.java
index 9327034542f..ca8da941173 100644
---
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/RemoteException.java
+++
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/RemoteException.java
@@ -39,7 +39,7 @@ public class RemoteException extends RuntimeException {
* @param fragmentId Fragment ID.
*/
public RemoteException(UUID nodeId, UUID queryId, long fragmentId,
Throwable cause) {
- super("Remote query execution", cause);
+ super("Remote query execution: " + cause.getMessage(), cause);
this.nodeId = nodeId;
this.queryId = queryId;
this.fragmentId = fragmentId;
diff --git
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/ListFieldsQueryCursor.java
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/ListFieldsQueryCursor.java
index f3c41700ef2..5e119022b4f 100644
---
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/ListFieldsQueryCursor.java
+++
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/ListFieldsQueryCursor.java
@@ -24,6 +24,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.query.FieldsQueryCursor;
import org.apache.ignite.internal.processors.cache.query.QueryCursorEx;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
import
org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
import
org.apache.ignite.internal.processors.query.calcite.exec.tracker.ExecutionNodeMemoryTracker;
import
org.apache.ignite.internal.processors.query.calcite.exec.tracker.MemoryTracker;
@@ -90,7 +91,13 @@ public class ListFieldsQueryCursor<Row> implements
FieldsQueryCursor<List<?>>, Q
});
}
catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ throw new IgniteSQLException(e.getMessage(),
U.convertException(e));
+ }
+ catch (IgniteSQLException e) {
+ throw e;
+ }
+ catch (Exception e) {
+ throw new IgniteSQLException(e.getMessage(), e);
}
finally {
qryMemoryTracker.reset();
diff --git
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/MemoryTrackerTest.java
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/MemoryTrackerTest.java
index 15c2fae9f33..f45b4c574ac 100644
---
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/MemoryTrackerTest.java
+++
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/MemoryTrackerTest.java
@@ -136,14 +136,29 @@ public class MemoryTrackerTest extends
GridCommonAbstractTest {
/** */
@Test
public void testConcurrentModification() throws Exception {
- MemoryTracker globalTracker = new GlobalMemoryTracker(10_000_000L);
- MemoryTracker qryTracker = new QueryMemoryTracker(globalTracker,
1_000_000L);
+ MemoryTracker globalTracker = new GlobalMemoryTracker(8_000L);
+
+ MemoryTracker[] qryTrackers = new MemoryTracker[2];
+
+ for (int i = 0; i < qryTrackers.length; i++)
+ qryTrackers[i] = new QueryMemoryTracker(globalTracker, 5_000L);
+
AtomicBoolean stop = new AtomicBoolean();
IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(()
-> {
while (!stop.get()) {
- qryTracker.onMemoryAllocated(1_000L);
- qryTracker.onMemoryReleased(1_000L);
+ MemoryTracker qryTracker =
qryTrackers[ThreadLocalRandom.current().nextInt(qryTrackers.length)];
+
+ try {
+ qryTracker.onMemoryAllocated(1_000L);
+ }
+ catch (Exception ignore) {
+ // No-op.
+ }
+ finally {
+ // Release a little bit more than allocated, to test
inaccuracy of row size calculation.
+ qryTracker.onMemoryReleased(1_001L);
+ }
if (ThreadLocalRandom.current().nextInt(10) == 0)
qryTracker.reset();
@@ -158,7 +173,9 @@ public class MemoryTrackerTest extends
GridCommonAbstractTest {
fut.get();
- assertEquals(0L, qryTracker.allocated());
+ for (MemoryTracker qryTracker : qryTrackers)
+ assertEquals(0L, qryTracker.allocated());
+
assertEquals(0L, globalTracker.allocated());
}
@@ -173,12 +190,20 @@ public class MemoryTrackerTest extends
GridCommonAbstractTest {
RowTracker<Object[]> rowTracker1 = new
ExecutionNodeMemoryTracker<>(qryTracker1, 1_000L);
RowTracker<Object[]> rowTracker2 = new
ExecutionNodeMemoryTracker<>(qryTracker2, 1_000L);
- GridTestUtils.assertThrows(log, () -> rowTracker1.onRowAdded(new
Object[1]), IgniteException.class,
+ Object[] row = new Object[1];
+
+ GridTestUtils.assertThrows(log, () -> rowTracker1.onRowAdded(row),
IgniteException.class,
"Global memory quota");
- GridTestUtils.assertThrows(log, () -> rowTracker2.onRowAdded(new
Object[1]), IgniteException.class,
+ GridTestUtils.assertThrows(log, () -> rowTracker2.onRowAdded(row),
IgniteException.class,
"Global memory quota");
+ assertEquals(499_000L + ExecutionNodeMemoryTracker.BATCH_SIZE,
qryTracker1.allocated());
+ assertEquals(499_000L + ExecutionNodeMemoryTracker.BATCH_SIZE,
qryTracker2.allocated());
+
+ rowTracker1.onRowRemoved(row);
+ rowTracker2.onRowRemoved(row);
+
assertEquals(499_000L, qryTracker1.allocated());
assertEquals(499_000L, qryTracker2.allocated());
@@ -188,15 +213,15 @@ public class MemoryTrackerTest extends
GridCommonAbstractTest {
assertEquals(0L, qryTracker1.allocated());
assertEquals(899_000L, qryTracker2.allocated());
- rowTracker1.onRowAdded(new Object[1]);
+ rowTracker1.onRowAdded(row);
assertEquals(ExecutionNodeMemoryTracker.BATCH_SIZE,
qryTracker1.allocated());
- GridTestUtils.assertThrows(log, () -> rowTracker2.onRowAdded(new
Object[1]), IgniteException.class,
+ GridTestUtils.assertThrows(log, () -> rowTracker2.onRowAdded(row),
IgniteException.class,
"Query quota");
- assertEquals(899_000L, qryTracker2.allocated());
- assertEquals(899_000L + ExecutionNodeMemoryTracker.BATCH_SIZE,
globalTracker.allocated());
+ assertEquals(899_000L + ExecutionNodeMemoryTracker.BATCH_SIZE,
qryTracker2.allocated());
+ assertEquals(899_000L + ExecutionNodeMemoryTracker.BATCH_SIZE * 2,
globalTracker.allocated());
}
/** */
diff --git
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
index 51ec53c59a0..0c23f2146c0 100644
---
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
+++
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
@@ -94,15 +94,6 @@ public class AbstractBasicIntegrationTest extends
GridCommonAbstractTest {
assertTrue("Not finished queries found on client", waitForCondition(
() ->
queryProcessor(client).queryRegistry().runningQueries().isEmpty(), 1_000L));
- waitForCondition(() -> {
- for (Ignite ign : G.allGrids()) {
- if (!queryProcessor(ign).mailboxRegistry().inboxes().isEmpty())
- return false;
- }
-
- return true;
- }, INBOX_INITIALIZATION_TIMEOUT * 2);
-
for (Ignite ign : G.allGrids()) {
if (destroyCachesAfterTest()) {
for (String cacheName : ign.cacheNames())
@@ -118,8 +109,8 @@ public class AbstractBasicIntegrationTest extends
GridCommonAbstractTest {
assertEquals("Tracked memory must be 0 after test [ignite=" +
ign.name() + ']',
0, execSvc.memoryTracker().allocated());
- assertEquals("Count of inboxes must be 0 after test [ignite=" +
ign.name() + ']',
- 0, qryProc.mailboxRegistry().inboxes().size());
+ assertTrue("Not closed inbox found [ignite=" + ign.name() + ']',
+ waitForCondition(() ->
qryProc.mailboxRegistry().inboxes().isEmpty(), INBOX_INITIALIZATION_TIMEOUT *
2));
assertEquals("Count of outboxes must be 0 after test [ignite=" +
ign.name() + ']',
0, qryProc.mailboxRegistry().outboxes().size());
diff --git
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MemoryQuotasIntegrationTest.java
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MemoryQuotasIntegrationTest.java
index 19bb28fd566..31a2ad82f5b 100644
---
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MemoryQuotasIntegrationTest.java
+++
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MemoryQuotasIntegrationTest.java
@@ -18,11 +18,11 @@
package org.apache.ignite.internal.processors.query.calcite.integration;
import java.util.List;
-import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition;
import org.apache.ignite.internal.util.typedef.F;
@@ -72,7 +72,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
.resultSize(800)
.check();
- assertThrows("SELECT id, b FROM tbl ORDER BY id",
IgniteException.class, "Query quota exceeded");
+ assertThrows("SELECT id, b FROM tbl ORDER BY id",
IgniteSQLException.class, "Query quota exceeded");
}
/** */
@@ -83,14 +83,14 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
.resultSize(1)
.check();
- assertThrows("SELECT MAP(SELECT id, b FROM tbl)",
IgniteException.class, "Query quota exceeded");
+ assertThrows("SELECT MAP(SELECT id, b FROM tbl)",
IgniteSQLException.class, "Query quota exceeded");
assertQuery("SELECT ARRAY(SELECT b FROM tbl WHERE id < 800)")
.matches(QueryChecker.containsSubPlan("IgniteCollect"))
.resultSize(1)
.check();
- assertThrows("SELECT ARRAY(SELECT b FROM tbl)", IgniteException.class,
"Query quota exceeded");
+ assertThrows("SELECT ARRAY(SELECT b FROM tbl)",
IgniteSQLException.class, "Query quota exceeded");
}
/** */
@@ -103,7 +103,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
.check();
assertThrows("SELECT id, b FROM tbl EXCEPT (SELECT 0, x'00')",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
sql("CREATE TABLE tbl2 (id INT, b VARBINARY) WITH
TEMPLATE=PARTITIONED");
@@ -124,12 +124,12 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
// On map phase.
assertThrows("SELECT /*+ DISABLE_RULE('ColocatedMinusConverterRule')
*/ * FROM " +
"(SELECT id, b FROM tbl2 EXCEPT SELECT id+1000, b FROM tbl3)",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// On reduce phase.
assertThrows("SELECT /*+ DISABLE_RULE('ColocatedMinusConverterRule')
*/ * FROM " +
"(SELECT id, b FROM tbl2 EXCEPT SELECT 0, x'00')",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
}
/** */
@@ -142,7 +142,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
.check();
assertThrows("SELECT /*+ DISABLE_RULE('IntersectReorderRule') */ id, b
FROM tbl INTERSECT (SELECT 0, x'00')",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
sql("CREATE TABLE tbl2 (id INT, b VARBINARY) WITH
TEMPLATE=PARTITIONED");
@@ -163,12 +163,12 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
// On map phase.
assertThrows("SELECT /*+
DISABLE_RULE('ColocatedIntersectConverterRule') */ * FROM " +
"(SELECT id, b FROM tbl2 INTERSECT SELECT 0, x'00')",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// On reduce phase.
assertThrows("SELECT /*+
DISABLE_RULE('ColocatedIntersectConverterRule') */ * FROM " +
"(SELECT id, b FROM tbl2 WHERE id < 1000 INTERSECT SELECT 0,
x'00')",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
}
/** */
@@ -190,7 +190,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
assertThrows("SELECT /*+
DISABLE_RULE('FilterSpoolMergeToSortedIndexSpoolRule') */ " +
"(SELECT b FROM tbl2 WHERE tbl2.id = tbl.id) FROM tbl",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
}
/** */
@@ -212,7 +212,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
assertThrows("SELECT /*+
DISABLE_RULE('FilterSpoolMergeToHashIndexSpoolRule') */ " +
"(SELECT b FROM tbl2 WHERE tbl2.id = tbl.id) FROM tbl",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
}
/** */
@@ -232,7 +232,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
sql("INSERT INTO tbl2 VALUES (?, ?)", i, new byte[1000]);
assertThrows("SELECT (SELECT b FROM tbl2 WHERE tbl2.id = tbl.id) FROM
tbl",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
}
/** */
@@ -258,7 +258,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
for (List<String> paramSet : params) {
assertThrows("SELECT /*+ " + paramSet.get(0) + " */ tbl.id, tbl.b,
tbl2.id, tbl2.b FROM tbl JOIN tbl2 USING (id)",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
}
}
@@ -282,7 +282,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
sql("INSERT INTO tbl2 VALUES (?, ?)", 0, new byte[1000]);
assertThrows("SELECT ARRAY_AGG(b) FROM tbl2 GROUP BY id",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// Map-reduce.
sql("CREATE TABLE tbl3 (id INT, b VARBINARY) WITH
TEMPLATE=PARTITIONED");
@@ -302,14 +302,14 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
// Reduce phase.
assertThrows("SELECT ARRAY_AGG(b) FROM tbl3 GROUP BY id",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
for (int i = 1000; i < 2000; i++)
sql("INSERT INTO tbl3 VALUES (?, ?)", 0, new byte[1000]);
// Map phase.
assertThrows("SELECT ARRAY_AGG(b) FROM tbl3 GROUP BY id",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
}
/** */
@@ -322,7 +322,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
.check();
assertThrows("SELECT ANY_VALUE(b) FROM tbl GROUP BY id",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// Colocated AggAccumulator.
assertQuery("SELECT ARRAY_AGG(b) FROM tbl WHERE id < 800")
@@ -331,7 +331,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
.check();
assertThrows("SELECT ARRAY_AGG(b) FROM tbl",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// Colocated AggAccumulator with ordering.
assertQuery("SELECT ARRAY_AGG(b ORDER BY id) FROM tbl WHERE id < 800")
@@ -340,7 +340,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
.check();
assertThrows("SELECT ARRAY_AGG(b ORDER BY id) FROM tbl",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// Map-reduce.
sql("CREATE TABLE tbl2 (id INT, b VARBINARY) WITH
TEMPLATE=PARTITIONED");
@@ -355,7 +355,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
.check();
assertThrows("SELECT ANY_VALUE(b) FROM tbl2 GROUP BY id",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// Reduce phase AggAccumulator.
assertQuery("SELECT ARRAY_AGG(b) FROM tbl2 WHERE id < 800")
@@ -364,17 +364,31 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
.check();
assertThrows("SELECT ARRAY_AGG(b) FROM tbl2",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// Map phase.
for (int i = 1000; i < 2000; i++)
sql("INSERT INTO tbl2 VALUES (?, ?)", i, new byte[1000]);
assertThrows("SELECT ANY_VALUE(b) FROM tbl2 GROUP BY id",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
assertThrows("SELECT ARRAY_AGG(b) FROM tbl2",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
+ }
+
+ /** */
+ @Test
+ public void testMassiveSequentialCheck() {
+ sql("CREATE TABLE tbl2 (id INT, b VARBINARY) WITH
TEMPLATE=PARTITIONED");
+
+ for (int i = 0; i < 2000; i++)
+ sql("INSERT INTO tbl2 VALUES (?, ?)", i, new byte[1000]);
+
+ for (int i = 0; i < 1000; i++) {
+ assertThrows("SELECT ANY_VALUE(b) FROM tbl2 GROUP BY id",
+ IgniteSQLException.class, "Query quota exceeded");
+ }
}
/** */
@@ -401,7 +415,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
curs[i].iterator().next();
}
return null;
- }, IgniteException.class, "Global memory quota for SQL queries
exceeded");
+ }, IgniteSQLException.class, "Global memory quota for SQL queries
exceeded");
}
finally {
for (int i = 0; i < 20; i++) {
@@ -422,7 +436,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
// getAll + collect for 1000 rows.
assertThrows("SELECT id, b FROM tbl",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// Collect for 800 rows.
assertQuery("SELECT ARRAY(SELECT b FROM tbl WHERE id < 800)")
@@ -437,7 +451,7 @@ public class MemoryQuotasIntegrationTest extends
AbstractBasicIntegrationTest {
// getAll + collect for 800 rows.
assertThrows("SELECT ARRAY(SELECT b FROM tbl WHERE id < 800)",
- IgniteException.class, "Query quota exceeded");
+ IgniteSQLException.class, "Query quota exceeded");
// getAll + sort for 800 rows (sort node release memory after passing
rows to iterator).
assertQuery("SELECT id, b FROM tbl WHERE id < 800 ORDER BY id")