package org.opendaylight.controller.cluster.datastore;
import com.google.common.base.Preconditions;
+import java.io.File;
import java.io.IOException;
+import org.opendaylight.controller.cluster.datastore.utils.DataTreeModificationOutput;
+import org.opendaylight.controller.cluster.datastore.utils.NormalizedNodeXMLOutput;
import org.opendaylight.controller.cluster.datastore.utils.PruningDataTreeModification;
import org.opendaylight.controller.cluster.datastore.utils.SerializationUtils;
import org.opendaylight.controller.cluster.raft.RaftActorRecoveryCohort;
log.debug("{}: Applying current log recovery batch with size {}", shardName, size);
try {
commitTransaction(transaction);
- } catch (DataValidationFailedException e) {
- log.error("{}: Failed to apply recovery batch", shardName, e);
+ } catch (Exception e) {
+ File file = new File(System.getProperty("karaf.data", "."),
+ "failed-recovery-batch-" + shardName + ".out");
+ DataTreeModificationOutput.toFile(file, transaction.getResultingModification());
+ throw new RuntimeException(String.format(
+ "%s: Failed to apply recovery batch. Modification data was written to file %s",
+ shardName, file), e);
}
transaction = null;
}
tx.write(YangInstanceIdentifier.EMPTY, node);
try {
commitTransaction(tx);
- } catch (DataValidationFailedException e) {
- log.error("{}: Failed to apply recovery snapshot", shardName, e);
+ } catch (Exception e) {
+ File file = new File(System.getProperty("karaf.data", "."),
+ "failed-recovery-snapshot-" + shardName + ".xml");
+ NormalizedNodeXMLOutput.toFile(file, node);
+ throw new RuntimeException(String.format(
+ "%s: Failed to apply recovery snapshot. Node data was written to file %s",
+ shardName, file), e);
}
}