@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context); StreamingFunctionUtils.snapshotFunctionState(context, getOperatorStateBackend(), userFunction); }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context);
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context); Preconditions.checkState(this.checkpointedState != null, "The operator state has not been properly initialized."); saveHandleInState(context.getCheckpointId(), context.getCheckpointTimestamp()); this.checkpointedState.clear(); try { for (PendingCheckpoint pendingCheckpoint : pendingCheckpoints) { // create a new partition for each entry. this.checkpointedState.add(pendingCheckpoint); } } catch (Exception e) { checkpointedState.clear(); throw new Exception("Could not add panding checkpoints to operator state " + "backend of operator " + getOperatorName() + '.', e); } int subtaskIdx = getRuntimeContext().getIndexOfThisSubtask(); if (LOG.isDebugEnabled()) { LOG.debug("{} (taskIdx= {}) checkpointed {}.", getClass().getSimpleName(), subtaskIdx, this.pendingCheckpoints); } }
when(operator.snapshotState(anyLong(), anyLong(), any(CheckpointOptions.class), any(CheckpointStreamFactory.class))).thenCallRealMethod(); doReturn(containingTask).when(operator).getContainingTask(); doThrow(failingException).when(operator).snapshotState(eq(context)); operator.snapshotState( checkpointId, timestamp,
getContainingTask().getCancelables())) { snapshotState(snapshotContext);
/** * Checks that the state snapshot context is closed after a successful snapshot operation. */ @Test public void testSnapshotMethod() throws Exception { final long checkpointId = 42L; final long timestamp = 1L; final CloseableRegistry closeableRegistry = new CloseableRegistry(); StateSnapshotContextSynchronousImpl context = spy(new StateSnapshotContextSynchronousImpl(0L, 0L)); whenNew(StateSnapshotContextSynchronousImpl.class).withAnyArguments().thenReturn(context); StreamTask<Void, AbstractStreamOperator<Void>> containingTask = mock(StreamTask.class); when(containingTask.getCancelables()).thenReturn(closeableRegistry); AbstractStreamOperator<Void> operator = mock(AbstractStreamOperator.class); when(operator.snapshotState(anyLong(), anyLong(), any(CheckpointOptions.class), any(CheckpointStreamFactory.class))).thenCallRealMethod(); doReturn(containingTask).when(operator).getContainingTask(); operator.snapshotState( checkpointId, timestamp, CheckpointOptions.forCheckpointWithDefaultLocation(), new MemCheckpointStreamFactory(Integer.MAX_VALUE)); verify(context).close(); }
when(operator.snapshotState(anyLong(), anyLong(), any(CheckpointOptions.class), any(CheckpointStreamFactory.class))).thenCallRealMethod(); operator.snapshotState( checkpointId, timestamp,
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context); checkpointSiddhiRuntimeState(); checkpointRecordQueueState(); }
@SuppressWarnings("unchecked") @Override public void snapshotState(StateSnapshotContext context) throws Exception { while (isInFinishingBundle) { checkpointingLock.wait(); } super.snapshotState(context); if (!finishBundleBeforeSnapshot) { // clear state first bufferState.removeAll(); // update state bufferState.putAll(buffer); } }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context); StreamingFunctionUtils.snapshotFunctionState(context, getOperatorStateBackend(), userFunction); }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context); StreamingFunctionUtils.snapshotFunctionState(context, getOperatorStateBackend(), userFunction); }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context); StreamingFunctionUtils.snapshotFunctionState(context, getOperatorStateBackend(), userFunction); }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context); StreamingFunctionUtils.snapshotFunctionState(context, getOperatorStateBackend(), function); }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context); checkpointSiddhiRuntimeState(); checkpointRecordQueueState(); }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { // Forced finish a bundle in checkpoint barrier otherwise may lose data. // Careful, it use OperatorState or KeyGroupState to store outputs, So it // must be called before their snapshot. outputManager.openBuffer(); invokeFinishBundle(); outputManager.closeBuffer(); super.snapshotState(context); }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { // Forced finish a bundle in checkpoint barrier otherwise may lose data. // Careful, it use OperatorState or KeyGroupState to store outputs, So it // must be called before their snapshot. outputManager.openBuffer(); invokeFinishBundle(); outputManager.closeBuffer(); super.snapshotState(context); }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { while (isInFinishingBundle) { checkpointingLock.wait(); } super.snapshotState(context); if (!finishBundleBeforeSnapshot) { // clear state first leftBufferState.removeAll(); rightBufferState.removeAll(); // update state leftBufferState.putAll(leftBuffer); rightBufferState.putAll(rightBuffer); } }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context);
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context);
@Override public void snapshotState(StateSnapshotContext context) throws Exception { super.snapshotState(context); Preconditions.checkState(this.checkpointedState != null, "The operator state has not been properly initialized."); saveHandleInState(context.getCheckpointId(), context.getCheckpointTimestamp()); this.checkpointedState.clear(); try { for (PendingCheckpoint pendingCheckpoint : pendingCheckpoints) { // create a new partition for each entry. this.checkpointedState.add(pendingCheckpoint); } } catch (Exception e) { checkpointedState.clear(); throw new Exception("Could not add panding checkpoints to operator state " + "backend of operator " + getOperatorName() + '.', e); } int subtaskIdx = getRuntimeContext().getIndexOfThisSubtask(); if (LOG.isDebugEnabled()) { LOG.debug("{} (taskIdx= {}) checkpointed {}.", getClass().getSimpleName(), subtaskIdx, this.pendingCheckpoints); } }