@Test public void testApplyRecoverySnapshot() throws DataValidationFailedException { coordinator.applyRecoverySnapshot(createSnapshot()); assertFalse(readCars(peopleDataTree).isPresent()); assertTrue(readPeople(peopleDataTree).isPresent()); }
@Override @SuppressWarnings("checkstyle:IllegalCatch") public void applyRecoverySnapshot(final Snapshot.State snapshotState) { if (!(snapshotState instanceof ShardSnapshotState)) { log.debug("{}: applyRecoverySnapshot ignoring snapshot: {}", shardName, snapshotState); return; } log.debug("{}: Applying recovered snapshot", shardName); final ShardSnapshotState shardSnapshotState = (ShardSnapshotState)snapshotState; try { store.applyRecoverySnapshot(shardSnapshotState); } catch (Exception e) { final ShardDataTreeSnapshot shardSnapshot = shardSnapshotState.getSnapshot(); final File f = writeRoot("snapshot", shardSnapshot.getRootNode().orElse(null)); throw new IllegalStateException(String.format( "%s: Failed to apply recovery snapshot %s. Node data was written to file %s", shardName, shardSnapshot, f), e); } }
ShardRecoveryCoordinator implements RaftActorRecoveryCohort { @Override @SuppressWarnings("checkstyle:IllegalCatch") public void applyRecoverySnapshot(final Snapshot.State snapshotState) { if (!(snapshotState instanceof ShardSnapshotState)) { log.debug("{}: applyRecoverySnapshot ignoring snapshot: {}", shardName, snapshotState); return; } log.debug("{}: Applying recovered snapshot", shardName); final ShardSnapshotState shardSnapshotState = (ShardSnapshotState)snapshotState; try { store.applyRecoverySnapshot(shardSnapshotState); } catch (Exception e) { final ShardDataTreeSnapshot shardSnapshot = shardSnapshotState.getSnapshot(); final File f = writeRoot("snapshot", shardSnapshot.getRootNode().orElse(null)); throw new IllegalStateException(String.format( "%s: Failed to apply recovery snapshot %s. Node data was written to file %s", shardName, shardSnapshot, f), e); } } }
ShardRecoveryCoordinator implements RaftActorRecoveryCohort { @Override @SuppressWarnings("checkstyle:IllegalCatch") public void applyRecoverySnapshot(final Snapshot.State snapshotState) { if (!(snapshotState instanceof ShardSnapshotState)) { log.debug("{}: applyRecoverySnapshot ignoring snapshot: {}", shardName, snapshotState); return; } log.debug("{}: Applying recovered snapshot", shardName); final ShardSnapshotState shardSnapshotState = (ShardSnapshotState)snapshotState; try { store.applyRecoverySnapshot(shardSnapshotState); } catch (Exception e) { final ShardDataTreeSnapshot shardSnapshot = shardSnapshotState.getSnapshot(); final File f = writeRoot("snapshot", shardSnapshot.getRootNode().orElse(null)); throw new IllegalStateException(String.format( "%s: Failed to apply recovery snapshot %s. Node data was written to file %s", shardName, shardSnapshot, f), e); } } ShardRecoveryCoordinator(final ShardDataTree store, final String shardName, final Logger log); }
ShardRecoveryCoordinator implements RaftActorRecoveryCohort { @Override @SuppressWarnings("checkstyle:IllegalCatch") public void applyRecoverySnapshot(final Snapshot.State snapshotState) { if (!(snapshotState instanceof ShardSnapshotState)) { log.debug("{}: applyRecoverySnapshot ignoring snapshot: {}", shardName, snapshotState); return; } log.debug("{}: Applying recovered snapshot", shardName); final ShardSnapshotState shardSnapshotState = (ShardSnapshotState)snapshotState; try { store.applyRecoverySnapshot(shardSnapshotState); } catch (Exception e) { final ShardDataTreeSnapshot shardSnapshot = shardSnapshotState.getSnapshot(); final File f = writeRoot("snapshot", shardSnapshot.getRootNode().orElse(null)); throw new IllegalStateException(String.format( "%s: Failed to apply recovery snapshot %s. Node data was written to file %s", shardName, shardSnapshot, f), e); } } ShardRecoveryCoordinator(final ShardDataTree store, final String shardName, final Logger log); @Override void startLogRecoveryBatch(final int maxBatchSize); @Override @SuppressWarnings("checkstyle:IllegalCatch") void appendRecoveredLogEntry(final Payload payload); @Override void applyCurrentLogRecoveryBatch(); @Override @SuppressWarnings("checkstyle:IllegalCatch") void applyRecoverySnapshot(final Snapshot.State snapshotState); }
ShardRecoveryCoordinator implements RaftActorRecoveryCohort { @Override @SuppressWarnings("checkstyle:IllegalCatch") public void applyRecoverySnapshot(final Snapshot.State snapshotState) { if (!(snapshotState instanceof ShardSnapshotState)) { log.debug("{}: applyRecoverySnapshot ignoring snapshot: {}", shardName, snapshotState); return; } log.debug("{}: Applying recovered snapshot", shardName); final ShardSnapshotState shardSnapshotState = (ShardSnapshotState)snapshotState; try { store.applyRecoverySnapshot(shardSnapshotState); } catch (Exception e) { final ShardDataTreeSnapshot shardSnapshot = shardSnapshotState.getSnapshot(); final File f = writeRoot("snapshot", shardSnapshot.getRootNode().orElse(null)); throw new IllegalStateException(String.format( "%s: Failed to apply recovery snapshot %s. Node data was written to file %s", shardName, shardSnapshot, f), e); } } ShardRecoveryCoordinator(final ShardDataTree store, final String shardName, final Logger log); @Override void startLogRecoveryBatch(final int maxBatchSize); @Override @SuppressWarnings("checkstyle:IllegalCatch") void appendRecoveredLogEntry(final Payload payload); @Override void applyCurrentLogRecoveryBatch(); @Override @SuppressWarnings("checkstyle:IllegalCatch") void applyRecoverySnapshot(final Snapshot.State snapshotState);  }