- private class SnapshotRecoveryTask extends ShardRecoveryTask {
-
- private final byte[] snapshotBytes;
-
- SnapshotRecoveryTask(byte[] snapshotBytes, DOMStoreWriteTransaction resultingTx) {
- super(resultingTx);
- this.snapshotBytes = snapshotBytes;
+ /**
+ * Applies a recovered snapshot to the data store.
+ *
+ * @param snapshotBytes the serialized snapshot
+ */
+ @Override
+ public void applyRecoverySnapshot(final byte[] snapshotBytes) {
+ log.debug("{}: Applying recovered snapshot", shardName);
+
+ final NormalizedNode<?, ?> node = SerializationUtils.deserializeNormalizedNode(snapshotBytes);
+ final PruningDataTreeModification tx = new PruningDataTreeModification(store.newModification(),
+ store.getDataTree(), schemaContext);
+ tx.write(YangInstanceIdentifier.EMPTY, node);
+ try {
+ commitTransaction(tx);
+ } catch (DataValidationFailedException e) {
+ log.error("{}: Failed to apply recovery snapshot", shardName, e);