org.apache.flink.runtime.state.StateUtil Java Examples

The following examples show how to use org.apache.flink.runtime.state.StateUtil. 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: OperatorSubtaskState.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public void discardState() {
	try {
		List<StateObject> toDispose =
			new ArrayList<>(
					managedOperatorState.size() +
					rawOperatorState.size() +
					managedKeyedState.size() +
					rawKeyedState.size());
		toDispose.addAll(managedOperatorState);
		toDispose.addAll(rawOperatorState);
		toDispose.addAll(managedKeyedState);
		toDispose.addAll(rawKeyedState);
		StateUtil.bestEffortDiscardAllStateObjects(toDispose);
	} catch (Exception e) {
		LOG.warn("Error while discarding operator states.", e);
	}
}
 
Example #2
Source File: OperatorSubtaskState.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void discardState() {
	try {
		List<StateObject> toDispose =
			new ArrayList<>(
					managedOperatorState.size() +
					rawOperatorState.size() +
					managedKeyedState.size() +
					rawKeyedState.size());
		toDispose.addAll(managedOperatorState);
		toDispose.addAll(rawOperatorState);
		toDispose.addAll(managedKeyedState);
		toDispose.addAll(rawKeyedState);
		StateUtil.bestEffortDiscardAllStateObjects(toDispose);
	} catch (Exception e) {
		LOG.warn("Error while discarding operator states.", e);
	}
}
 
Example #3
Source File: OperatorSubtaskState.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void discardState() {
	try {
		List<StateObject> toDispose =
			new ArrayList<>(
					managedOperatorState.size() +
					rawOperatorState.size() +
					managedKeyedState.size() +
					rawKeyedState.size() +
					inputChannelState.size() +
					resultSubpartitionState.size());
		toDispose.addAll(managedOperatorState);
		toDispose.addAll(rawOperatorState);
		toDispose.addAll(managedKeyedState);
		toDispose.addAll(rawKeyedState);
		toDispose.addAll(collectUniqueDelegates(inputChannelState, resultSubpartitionState));
		StateUtil.bestEffortDiscardAllStateObjects(toDispose);
	} catch (Exception e) {
		LOG.warn("Error while discarding operator states.", e);
	}
}
 
Example #4
Source File: SubtaskState.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void discardState() {
	try {
		StateUtil.bestEffortDiscardAllStateObjects(
			Arrays.asList(
				managedOperatorState,
				rawOperatorState,
				managedKeyedState,
				rawKeyedState));
	} catch (Exception e) {
		LOG.warn("Error while discarding operator states.", e);
	}
}
 
Example #5
Source File: PendingCheckpoint.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private void dispose(boolean releaseState) {

		synchronized (lock) {
			try {
				numAcknowledgedTasks = -1;
				if (!discarded && releaseState) {
					executor.execute(new Runnable() {
						@Override
						public void run() {

							// discard the private states.
							// unregistered shared states are still considered private at this point.
							try {
								StateUtil.bestEffortDiscardAllStateObjects(operatorStates.values());
								targetLocation.disposeOnFailure();
							} catch (Throwable t) {
								LOG.warn("Could not properly dispose the private states in the pending checkpoint {} of job {}.",
									checkpointId, jobId, t);
							} finally {
								operatorStates.clear();
							}
						}
					});

				}
			} finally {
				discarded = true;
				notYetAcknowledgedTasks.clear();
				acknowledgedTasks.clear();
				cancelCanceller();
			}
		}
	}
 
Example #6
Source File: SubtaskState.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void discardState() {
	try {
		StateUtil.bestEffortDiscardAllStateObjects(
			Arrays.asList(
				managedOperatorState,
				rawOperatorState,
				managedKeyedState,
				rawKeyedState));
	} catch (Exception e) {
		LOG.warn("Error while discarding operator states.", e);
	}
}
 
Example #7
Source File: PendingCheckpoint.java    From flink with Apache License 2.0 5 votes vote down vote up
private void dispose(boolean releaseState) {

		synchronized (lock) {
			try {
				numAcknowledgedTasks = -1;
				if (!discarded && releaseState) {
					executor.execute(new Runnable() {
						@Override
						public void run() {

							// discard the private states.
							// unregistered shared states are still considered private at this point.
							try {
								StateUtil.bestEffortDiscardAllStateObjects(operatorStates.values());
								targetLocation.disposeOnFailure();
							} catch (Throwable t) {
								LOG.warn("Could not properly dispose the private states in the pending checkpoint {} of job {}.",
									checkpointId, jobId, t);
							} finally {
								operatorStates.clear();
							}
						}
					});

				}
			} finally {
				discarded = true;
				notYetAcknowledgedTasks.clear();
				acknowledgedTasks.clear();
				cancelCanceller();
			}
		}
	}
 
Example #8
Source File: SubtaskState.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void discardState() {
	try {
		StateUtil.bestEffortDiscardAllStateObjects(
			Arrays.asList(
				managedOperatorState,
				rawOperatorState,
				managedKeyedState,
				rawKeyedState));
	} catch (Exception e) {
		LOG.warn("Error while discarding operator states.", e);
	}
}
 
Example #9
Source File: PendingCheckpoint.java    From flink with Apache License 2.0 5 votes vote down vote up
private void dispose(boolean releaseState) {

		synchronized (lock) {
			try {
				numAcknowledgedTasks = -1;
				if (!discarded && releaseState) {
					executor.execute(new Runnable() {
						@Override
						public void run() {

							// discard the private states.
							// unregistered shared states are still considered private at this point.
							try {
								StateUtil.bestEffortDiscardAllStateObjects(operatorStates.values());
								targetLocation.disposeOnFailure();
							} catch (Throwable t) {
								LOG.warn("Could not properly dispose the private states in the pending checkpoint {} of job {}.",
									checkpointId, jobId, t);
							} finally {
								operatorStates.clear();
							}
						}
					});

				}
			} finally {
				discarded = true;
				notYetAcknowledgedTasks.clear();
				acknowledgedTasks.clear();
				cancelCanceller();
			}
		}
	}
 
Example #10
Source File: StateObjectCollection.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void discardState() throws Exception {
	StateUtil.bestEffortDiscardAllStateObjects(stateObjects);
}
 
Example #11
Source File: TaskStateSnapshot.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void discardState() throws Exception {
	StateUtil.bestEffortDiscardAllStateObjects(subtaskStatesByOperatorID.values());
}
 
Example #12
Source File: StateObjectCollection.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void discardState() throws Exception {
	StateUtil.bestEffortDiscardAllStateObjects(stateObjects);
}
 
Example #13
Source File: TaskStateSnapshot.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void discardState() throws Exception {
	StateUtil.bestEffortDiscardAllStateObjects(subtaskStatesByOperatorID.values());
}
 
Example #14
Source File: StateObjectCollection.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void discardState() throws Exception {
	StateUtil.bestEffortDiscardAllStateObjects(stateObjects);
}
 
Example #15
Source File: TaskStateSnapshot.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void discardState() throws Exception {
	StateUtil.bestEffortDiscardAllStateObjects(subtaskStatesByOperatorID.values());
}