Skip to content

Commit

Permalink
Rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
losipiuk committed May 12, 2022
1 parent 392d82b commit a6906e8
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ private synchronized void callOomKiller(Iterable<QueryExecution> runningQueries)
entry -> entry.getValue().getInfo().get()));

List<MemoryInfo> nodeMemoryInfos = ImmutableList.copyOf(nodeMemoryInfosByNode.values());
Optional<KillTarget> killTarget = lowMemoryKiller.chooseQueryToKill(queryMemoryInfoList, nodeMemoryInfos);
Optional<KillTarget> killTarget = lowMemoryKiller.chooseTargetToKill(queryMemoryInfoList, nodeMemoryInfos);

if (killTarget.isPresent()) {
if (killTarget.get().isWholeQuery()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public interface LowMemoryKiller
{
Optional<KillTarget> chooseQueryToKill(List<QueryMemoryInfo> runningQueries, List<MemoryInfo> nodes);
Optional<KillTarget> chooseTargetToKill(List<QueryMemoryInfo> runningQueries, List<MemoryInfo> nodes);

class QueryMemoryInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class NoneLowMemoryKiller
implements LowMemoryKiller
{
@Override
public Optional<KillTarget> chooseQueryToKill(List<QueryMemoryInfo> runningQueries, List<MemoryInfo> nodes)
public Optional<KillTarget> chooseTargetToKill(List<QueryMemoryInfo> runningQueries, List<MemoryInfo> nodes)
{
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class TotalReservationLowMemoryKiller
implements LowMemoryKiller
{
@Override
public Optional<KillTarget> chooseQueryToKill(List<QueryMemoryInfo> runningQueries, List<MemoryInfo> nodes)
public Optional<KillTarget> chooseTargetToKill(List<QueryMemoryInfo> runningQueries, List<MemoryInfo> nodes)
{
Optional<QueryId> biggestQuery = Optional.empty();
long maxMemory = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class TotalReservationOnBlockedNodesLowMemoryKiller
implements LowMemoryKiller
{
@Override
public Optional<KillTarget> chooseQueryToKill(List<QueryMemoryInfo> runningQueries, List<MemoryInfo> nodes)
public Optional<KillTarget> chooseTargetToKill(List<QueryMemoryInfo> runningQueries, List<MemoryInfo> nodes)
{
Optional<KillTarget> killTarget = chooseTasksToKill(runningQueries, nodes);
if (killTarget.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testMemoryPoolHasNoReservation()
.put("q_1", ImmutableMap.of("n1", 0L, "n2", 0L, "n3", 0L, "n4", 0L, "n5", 0L))
.buildOrThrow();
assertEquals(
lowMemoryKiller.chooseQueryToKill(
lowMemoryKiller.chooseTargetToKill(
toQueryMemoryInfoList(queries),
toNodeMemoryInfoList(memoryPool, queries)),
Optional.empty());
Expand All @@ -55,7 +55,7 @@ public void testSkewedQuery()
.put("q_3", ImmutableMap.of("n1", 0L, "n2", 0L, "n3", 9L, "n4", 0L, "n5", 0L))
.buildOrThrow();
assertEquals(
lowMemoryKiller.chooseQueryToKill(
lowMemoryKiller.chooseTargetToKill(
toQueryMemoryInfoList(queries),
toNodeMemoryInfoList(memoryPool, queries)),
Optional.of(KillTarget.wholeQuery(new QueryId("q_2"))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void testMemoryPoolHasNoReservation()
.buildOrThrow();

assertEquals(
lowMemoryKiller.chooseQueryToKill(
lowMemoryKiller.chooseTargetToKill(
toQueryMemoryInfoList(queries),
toNodeMemoryInfoList(memoryPool, queries)),
Optional.empty());
Expand All @@ -55,7 +55,7 @@ public void testMemoryPoolNotBlocked()
.put("q_2", ImmutableMap.of("n1", 3L, "n2", 5L, "n3", 2L, "n4", 4L, "n5", 0L))
.buildOrThrow();
assertEquals(
lowMemoryKiller.chooseQueryToKill(
lowMemoryKiller.chooseTargetToKill(
toQueryMemoryInfoList(queries),
toNodeMemoryInfoList(memoryPool, queries)),
Optional.empty());
Expand All @@ -73,7 +73,7 @@ public void testSkewedQuery()
.put("q_3", ImmutableMap.of("n1", 0L, "n2", 0L, "n3", 9L, "n4", 0L, "n5", 0L))
.buildOrThrow();
assertEquals(
lowMemoryKiller.chooseQueryToKill(
lowMemoryKiller.chooseTargetToKill(
toQueryMemoryInfoList(queries),
toNodeMemoryInfoList(memoryPool, queries)),
Optional.of(KillTarget.wholeQuery(new QueryId("q_1"))));
Expand Down Expand Up @@ -106,7 +106,7 @@ public void testPreferKillingTasks()
).buildOrThrow();

assertEquals(
lowMemoryKiller.chooseQueryToKill(
lowMemoryKiller.chooseTargetToKill(
toQueryMemoryInfoList(queries, ImmutableSet.of("q_2")),
toNodeMemoryInfoList(memoryPool, queries, tasks)),
Optional.of(KillTarget.selectedTasks(
Expand Down Expand Up @@ -146,7 +146,7 @@ public void testKillsBiggestTasks()
.buildOrThrow();

assertEquals(
lowMemoryKiller.chooseQueryToKill(
lowMemoryKiller.chooseTargetToKill(
toQueryMemoryInfoList(queries, ImmutableSet.of("q_1", "q_2")),
toNodeMemoryInfoList(memoryPool, queries, tasks)),
Optional.of(KillTarget.selectedTasks(
Expand Down Expand Up @@ -177,7 +177,7 @@ public void testWillNotKillWholeQueryWithTaskRetries()
// we expect "q_1" to be killed even though "q_2" is the biggest query here. We won't kill whole query if it has task retries enabled.

assertEquals(
lowMemoryKiller.chooseQueryToKill(
lowMemoryKiller.chooseTargetToKill(
toQueryMemoryInfoList(queries, ImmutableSet.of("q_2")),
toNodeMemoryInfoList(memoryPool, queries, tasks)),
Optional.of(KillTarget.wholeQuery(new QueryId("q_1"))));
Expand Down

0 comments on commit a6906e8

Please sign in to comment.