@GuardedBy("this") private boolean isLastKilledQueryGone() { if (lastKilledQuery == null) { return true; } // If the lastKilledQuery is marked as leaked by the ClusterMemoryLeakDetector we consider the lastKilledQuery as gone, // so that the ClusterMemoryManager can continue to make progress even if there are leaks. // Even if the weak references to the leaked queries are GCed in the ClusterMemoryLeakDetector, it will mark the same queries // as leaked in its next run, and eventually the ClusterMemoryManager will make progress. if (memoryLeakDetector.wasQueryPossiblyLeaked(lastKilledQuery)) { lastKilledQuery = null; return true; } // pools fields is updated based on nodes field. // Therefore, if the query is gone from pools field, it should also be gone from nodes field. // However, since nodes can updated asynchronously, it has the potential of coming back after being gone. // Therefore, even if the query appears to be gone here, it might be back when one inspects nodes later. return !pools.get(GENERAL_POOL) .getQueryMemoryReservations() .containsKey(lastKilledQuery); }
memoryLeakDetector.checkForMemoryLeaks(allQueryInfoSupplier, pools.get(GENERAL_POOL).getQueryMemoryReservations());
ClusterMemoryPool generalPool = pools.get(GENERAL_POOL); if (generalPool != null) { lastKilledQueryIsGone = generalPool.getQueryMemoryReservations().containsKey(lastKilledQuery);