Skip to content

Commit

Permalink
Rename resource_over_commit to resource_overcommit
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Jan 5, 2016
1 parent fb8bb28 commit a278e8e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion presto-docs/src/main/sphinx/release/release-0.132.rst
Expand Up @@ -9,7 +9,7 @@ General Changes
* Add support for creating constant arrays with more than 255 elements.
* Fix analyzer for queries with ``GROUP BY ()`` such that errors are raised
during analysis rather than execution.
* Add ``resource_over_commit`` session property. This disables all memory
* Add ``resource_overcommit`` session property. This disables all memory
limits for the query. Instead it may be killed at any time, if the coordinator
needs to reclaim memory.
* Add support for transactional connectors.
Expand Down
Expand Up @@ -47,7 +47,7 @@ public final class SystemSessionProperties
public static final String TASK_SHARE_INDEX_LOADING = "task_share_index_loading";
public static final String QUERY_MAX_MEMORY = "query_max_memory";
public static final String QUERY_MAX_RUN_TIME = "query_max_run_time";
public static final String RESOURCE_OVER_COMMIT = "resource_over_commit";
public static final String RESOURCE_OVERCOMMIT = "resource_overcommit";
public static final String REDISTRIBUTE_WRITES = "redistribute_writes";
public static final String PUSH_TABLE_WRITE_THROUGH_UNION = "push_table_write_through_union";
public static final String EXECUTION_POLICY = "execution_policy";
Expand Down Expand Up @@ -161,7 +161,7 @@ public SystemSessionProperties(
true,
value -> DataSize.valueOf((String) value)),
booleanSessionProperty(
RESOURCE_OVER_COMMIT,
RESOURCE_OVERCOMMIT,
"Use resources which are not guaranteed to be available to the query",
false,
false),
Expand Down Expand Up @@ -272,9 +272,9 @@ public static Duration getQueryMaxRunTime(Session session)
return session.getProperty(QUERY_MAX_RUN_TIME, Duration.class);
}

public static boolean resourceOverCommit(Session session)
public static boolean resourceOvercommit(Session session)
{
return session.getProperty(RESOURCE_OVER_COMMIT, Boolean.class);
return session.getProperty(RESOURCE_OVERCOMMIT, Boolean.class);
}

private static <T> T getPropertyOr(Session session, String propertyName, String defaultPropertyName, Class<T> type)
Expand Down
Expand Up @@ -53,7 +53,7 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import static com.facebook.presto.SystemSessionProperties.resourceOverCommit;
import static com.facebook.presto.SystemSessionProperties.resourceOvercommit;
import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.transform;
Expand Down Expand Up @@ -259,9 +259,9 @@ public TaskInfo updateTask(Session session, TaskId taskId, PlanFragment fragment
requireNonNull(sources, "sources is null");
requireNonNull(outputBuffers, "outputBuffers is null");

if (resourceOverCommit(session)) {
if (resourceOvercommit(session)) {
// TODO: This should have been done when the QueryContext was created. However, the session isn't available at that point.
queryContexts.getUnchecked(taskId.getQueryId()).setResourceOverCommit();
queryContexts.getUnchecked(taskId.getQueryId()).setResourceOvercommit();
}

SqlTask sqlTask = tasks.getUnchecked(taskId);
Expand Down
Expand Up @@ -47,9 +47,9 @@
import java.util.concurrent.atomic.AtomicLong;

import static com.facebook.presto.ExceededMemoryLimitException.exceededGlobalLimit;
import static com.facebook.presto.SystemSessionProperties.RESOURCE_OVER_COMMIT;
import static com.facebook.presto.SystemSessionProperties.RESOURCE_OVERCOMMIT;
import static com.facebook.presto.SystemSessionProperties.getQueryMaxMemory;
import static com.facebook.presto.SystemSessionProperties.resourceOverCommit;
import static com.facebook.presto.SystemSessionProperties.resourceOvercommit;
import static com.facebook.presto.memory.LocalMemoryManager.GENERAL_POOL;
import static com.facebook.presto.memory.LocalMemoryManager.RESERVED_POOL;
import static com.facebook.presto.spi.NodeState.ACTIVE;
Expand Down Expand Up @@ -138,12 +138,12 @@ public synchronized void process(Iterable<QueryExecution> queries)
long queryMemoryLimit = Math.min(maxQueryMemory.toBytes(), sessionMaxQueryMemory.toBytes());
totalBytes += bytes;
if (bytes > queryMemoryLimit) {
if (resourceOverCommit(query.getSession())) {
// If a query has requested resource over commit, only kill it if the cluster has run out of memory
if (resourceOvercommit(query.getSession())) {
// If a query has requested resource overcommit, only kill it if the cluster has run out of memory
if (outOfMemory) {
DataSize memory = succinctDataSize(bytes, BYTE);
query.fail(new PrestoException(CLUSTER_OUT_OF_MEMORY,
format("The cluster is out of memory, you set %s=true, and your query is using %s of memory, so it was killed.", RESOURCE_OVER_COMMIT, memory)));
format("The cluster is out of memory, you set %s=true, and your query is using %s of memory, so it was killed.", RESOURCE_OVERCOMMIT, memory)));
queryKilled = true;
}
}
Expand Down Expand Up @@ -222,9 +222,9 @@ private MemoryPoolAssignmentsRequest updateAssignments(Iterable<QueryExecution>
QueryExecution biggestQuery = null;
long maxMemory = -1;
for (QueryExecution queryExecution : queries) {
if (resourceOverCommit(queryExecution.getSession())) {
// Don't promote queries that requested resource over commit to the reserved pool, since their memory
// usage is unbounded.
if (resourceOvercommit(queryExecution.getSession())) {
// Don't promote queries that requested resource overcommit to the reserved pool,
// since their memory usage is unbounded.
continue;
}
long bytesUsed = queryExecution.getTotalMemoryReservation();
Expand Down
Expand Up @@ -64,7 +64,7 @@ public QueryContext(QueryId queryId, DataSize maxMemory, MemoryPool memoryPool,
}

// TODO: This method should be removed, and the correct limit set in the constructor. However, due to the way QueryContext is constructed the memory limit is not known in advance
public synchronized void setResourceOverCommit()
public synchronized void setResourceOvercommit()
{
// Don't enforce any limit. The coordinator will kill the query if the cluster runs out of memory.
maxMemory = Long.MAX_VALUE;
Expand Down
Expand Up @@ -34,7 +34,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;

import static com.facebook.presto.SystemSessionProperties.RESOURCE_OVER_COMMIT;
import static com.facebook.presto.SystemSessionProperties.RESOURCE_OVERCOMMIT;
import static com.facebook.presto.execution.QueryState.FINISHED;
import static com.facebook.presto.execution.StageInfo.getAllStages;
import static com.facebook.presto.memory.LocalMemoryManager.GENERAL_POOL;
Expand Down Expand Up @@ -86,7 +86,7 @@ public void testResourceOverCommit()
catch (RuntimeException e) {
// expected
}
Session session = TINY_SESSION.withSystemProperty(RESOURCE_OVER_COMMIT, "true");
Session session = TINY_SESSION.withSystemProperty(RESOURCE_OVERCOMMIT, "true");
queryRunner.execute(session, "SELECT COUNT(*), clerk FROM orders GROUP BY clerk");
}
}
Expand Down

0 comments on commit a278e8e

Please sign in to comment.