alex-plekhanov commented on code in PR #12758:
URL: https://github.com/apache/ignite/pull/12758#discussion_r2821114091
##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/MemoryTrackerTest.java:
##########
@@ -136,14 +136,29 @@ public void testRemoveOverflow() {
/** */
@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);
Review Comment:
But it's not always possible, for example, see AbstractSetOpNode#push. There
we increment size for one row, but during execution some group can be deleted
and we decrement size using row caused group deletion. Such an aproach has some
inaccuracy, but margin of error is acceptable.
--
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]