Allow statisitcs page reset in LifespanAndStageState
The total memory for all statistics page could be
large and cause full GC issue. Removing page that
will not be accessed.
@@ -409,7 +409,11 @@ public class TableFinishOperator
return ImmutableList.of();
}
checkState(!uncommittedRecoverableLifespanAndStageStates.containsKey(lifespanAndStage), "lifespanAndStage %s is already committed", lifespanAndStage);
- return committedRecoverableLifespanAndStages.get(lifespanAndStage).getStatisticsPages();
+ LifespanAndStageState lifespanAndStageState = committedRecoverableLifespanAndStages.get(lifespanAndStage);
+ List<Page> pages = lifespanAndStageState.getStatisticsPages();
+ // statistics data in this lifespanAndStageState will not be accessed any more
+ lifespanAndStageState.resetStatisticsPages();
+ return pages;
}
public long getFinalRowCount()
@@ -493,12 +497,12 @@ public class TableFinishOperator
private static class LifespanAndStageState
{
- private long rowCount;
private final ImmutableList.Builder<Slice> fragmentBuilder = ImmutableList.builder();
- private final Optional<ImmutableList.Builder<Page>> statisticsPages;
-
private final TaskId taskId;
+ private long rowCount;
+ private Optional<ImmutableList.Builder<Page>> statisticsPages;
+
public LifespanAndStageState(TaskId taskId, boolean trackStatisticsPages)
{
this.taskId = requireNonNull(taskId, "taskId is null");
@@ -542,6 +546,11 @@ public class TableFinishOperator
{
return taskId;
}
+
+ public void resetStatisticsPages()
+ {
+ statisticsPages = Optional.empty();
+ }
}
}
}
