- @Override
- public void run() {
- NormalizedNode<?, ?> node = SerializationUtils.deserializeNormalizedNode(snapshotBytes);
-
- // delete everything first
- resultingTx.delete(YangInstanceIdentifier.builder().build());
-
- // Add everything from the remote node back
- resultingTx.write(YangInstanceIdentifier.builder().build(), node);
+ 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);