Java Code Examples for org.apache.flink.runtime.checkpoint.TaskStateSnapshot#discardState()

The following examples show how to use org.apache.flink.runtime.checkpoint.TaskStateSnapshot#discardState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskLocalStateStoreImpl.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method that discards state objects with an executor and reports exceptions to the log.
 */
private void discardLocalStateForCheckpoint(long checkpointID, TaskStateSnapshot o) {

	if (LOG.isTraceEnabled()) {
		LOG.trace("Discarding local task state snapshot of checkpoint {} for subtask ({} - {} - {}).",
			checkpointID, jobID, jobVertexID, subtaskIndex);
	} else {
		LOG.debug("Discarding local task state snapshot {} of checkpoint {} for subtask ({} - {} - {}).",
			o, checkpointID, jobID, jobVertexID, subtaskIndex);
	}

	try {
		o.discardState();
	} catch (Exception discardEx) {
		LOG.warn("Exception while discarding local task state snapshot of checkpoint {} in subtask ({} - {} - {}).",
			checkpointID, jobID, jobVertexID, subtaskIndex, discardEx);
	}

	LocalRecoveryDirectoryProvider directoryProvider = localRecoveryConfig.getLocalStateDirectoryProvider();
	File checkpointDir = directoryProvider.subtaskSpecificCheckpointDirectory(checkpointID);

	LOG.debug("Deleting local state directory {} of checkpoint {} for subtask ({} - {} - {}).",
		checkpointDir, checkpointID, jobID, jobVertexID, subtaskIndex);

	try {
		deleteDirectory(checkpointDir);
	} catch (IOException ex) {
		LOG.warn("Exception while deleting local state directory of checkpoint {} in subtask ({} - {} - {}).",
			checkpointID, jobID, jobVertexID, subtaskIndex, ex);
	}
}
 
Example 2
Source File: TestTaskLocalStateStore.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public void dispose() {
	if (!disposed) {
		disposed = true;
		for (TaskStateSnapshot stateSnapshot : taskStateSnapshotsByCheckpointID.values()) {
			try {
				stateSnapshot.discardState();
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		taskStateSnapshotsByCheckpointID.clear();
	}
}
 
Example 3
Source File: TaskLocalStateStoreImpl.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method that discards state objects with an executor and reports exceptions to the log.
 */
private void discardLocalStateForCheckpoint(long checkpointID, TaskStateSnapshot o) {

	if (LOG.isTraceEnabled()) {
		LOG.trace("Discarding local task state snapshot of checkpoint {} for subtask ({} - {} - {}).",
			checkpointID, jobID, jobVertexID, subtaskIndex);
	} else {
		LOG.debug("Discarding local task state snapshot {} of checkpoint {} for subtask ({} - {} - {}).",
			o, checkpointID, jobID, jobVertexID, subtaskIndex);
	}

	try {
		o.discardState();
	} catch (Exception discardEx) {
		LOG.warn("Exception while discarding local task state snapshot of checkpoint {} in subtask ({} - {} - {}).",
			checkpointID, jobID, jobVertexID, subtaskIndex, discardEx);
	}

	LocalRecoveryDirectoryProvider directoryProvider = localRecoveryConfig.getLocalStateDirectoryProvider();
	File checkpointDir = directoryProvider.subtaskSpecificCheckpointDirectory(checkpointID);

	LOG.debug("Deleting local state directory {} of checkpoint {} for subtask ({} - {} - {}).",
		checkpointDir, checkpointID, jobID, jobVertexID, subtaskIndex);

	try {
		deleteDirectory(checkpointDir);
	} catch (IOException ex) {
		LOG.warn("Exception while deleting local state directory of checkpoint {} in subtask ({} - {} - {}).",
			checkpointID, jobID, jobVertexID, subtaskIndex, ex);
	}
}
 
Example 4
Source File: TestTaskLocalStateStore.java    From flink with Apache License 2.0 5 votes vote down vote up
public void dispose() {
	if (!disposed) {
		disposed = true;
		for (TaskStateSnapshot stateSnapshot : taskStateSnapshotsByCheckpointID.values()) {
			try {
				stateSnapshot.discardState();
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		taskStateSnapshotsByCheckpointID.clear();
	}
}
 
Example 5
Source File: TaskLocalStateStoreImpl.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method that discards state objects with an executor and reports exceptions to the log.
 */
private void discardLocalStateForCheckpoint(long checkpointID, TaskStateSnapshot o) {

	if (LOG.isTraceEnabled()) {
		LOG.trace("Discarding local task state snapshot of checkpoint {} for subtask ({} - {} - {}).",
			checkpointID, jobID, jobVertexID, subtaskIndex);
	} else {
		LOG.debug("Discarding local task state snapshot {} of checkpoint {} for subtask ({} - {} - {}).",
			o, checkpointID, jobID, jobVertexID, subtaskIndex);
	}

	try {
		o.discardState();
	} catch (Exception discardEx) {
		LOG.warn("Exception while discarding local task state snapshot of checkpoint {} in subtask ({} - {} - {}).",
			checkpointID, jobID, jobVertexID, subtaskIndex, discardEx);
	}

	LocalRecoveryDirectoryProvider directoryProvider = localRecoveryConfig.getLocalStateDirectoryProvider();
	File checkpointDir = directoryProvider.subtaskSpecificCheckpointDirectory(checkpointID);

	LOG.debug("Deleting local state directory {} of checkpoint {} for subtask ({} - {} - {}).",
		checkpointDir, checkpointID, jobID, jobVertexID, subtaskIndex);

	try {
		deleteDirectory(checkpointDir);
	} catch (IOException ex) {
		LOG.warn("Exception while deleting local state directory of checkpoint {} in subtask ({} - {} - {}).",
			checkpointID, jobID, jobVertexID, subtaskIndex, ex);
	}
}
 
Example 6
Source File: TestTaskLocalStateStore.java    From flink with Apache License 2.0 5 votes vote down vote up
public void dispose() {
	if (!disposed) {
		disposed = true;
		for (TaskStateSnapshot stateSnapshot : taskStateSnapshotsByCheckpointID.values()) {
			try {
				stateSnapshot.discardState();
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		taskStateSnapshotsByCheckpointID.clear();
	}
}