- @Override
- public void run() {
- try {
- NormalizedNodeMessages.Node serializedNode = NormalizedNodeMessages.Node.parseFrom(snapshot);
- NormalizedNode<?, ?> node = new NormalizedNodeToNodeCodec(schemaContext).decode(
- serializedNode);
-
- // delete everything first
- resultingTx.delete(YangInstanceIdentifier.builder().build());
-
- // Add everything from the remote node back
- resultingTx.write(YangInstanceIdentifier.builder().build(), node);
- } catch (InvalidProtocolBufferException e) {
- LOG.error("Error deserializing snapshot", e);
- }
+ 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);