- void applyRecoveredSnapshot(final byte[] snapshotBytes) {
- log.debug("{}: Applyng recovered sbapshot", shardName);
-
- DOMStoreWriteTransaction writeTx = store.newWriteOnlyTransaction();
-
- NormalizedNode<?, ?> node = SerializationUtils.deserializeNormalizedNode(snapshotBytes);
-
- writeTx.write(YangInstanceIdentifier.builder().build(), node);
+ @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);
+ }
+ }