From: HeYunBo Date: Fri, 18 Aug 2017 12:31:39 +0000 (+0800) Subject: Bug 9008: Fix the error of the persisted journal data format X-Git-Tag: release/oxygen~117 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=0077859d16ed922af1449f075033069f4d9dbffe;ds=sidebyside Bug 9008: Fix the error of the persisted journal data format We have to clear the lastLeafSetQName while processing the end event for node in NormalizedNodeInputStreamReader and AbstractNormalizedNodeDataOutput. Otherwise while processing the leaf-list node, the leaf-list entry node may use the other LeafSetQName as it's node identifier incorrectly. The DataTree reconstructed from the persisted journal after the controller restart will be not equal to the DataTree before restart under certain circumstances. Change-Id: I4ee823f59fe477d08f982ae73e3850433dfea8ee Signed-off-by: HeYunBo --- diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractNormalizedNodeDataOutput.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractNormalizedNodeDataOutput.java old mode 100644 new mode 100755 index a057a35a96..c4db272989 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractNormalizedNodeDataOutput.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractNormalizedNodeDataOutput.java @@ -311,7 +311,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut @Override public void endNode() throws IOException, IllegalStateException { LOG.trace("Ending the node"); - + lastLeafSetQName = null; output.writeByte(NodeTypes.END_NODE); } diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java old mode 100644 new mode 100755 index 989884cebd..6316bf3f04 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java @@ -108,6 +108,7 @@ public class NormalizedNodeInputStreamReader implements NormalizedNodeDataInput if (nodeType == NodeTypes.END_NODE) { LOG.trace("End node reached. return"); + lastLeafSetQName = null; return null; }