From c570de3f81a437b6591f7fc0f570a6ee2914c615 Mon Sep 17 00:00:00 2001 From: HeYunBo Date: Fri, 18 Aug 2017 20:31:39 +0800 Subject: [PATCH] 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 (cherry picked from commit 0077859d16ed922af1449f075033069f4d9dbffe) --- .../node/utils/stream/AbstractNormalizedNodeDataOutput.java | 2 +- .../node/utils/stream/NormalizedNodeInputStreamReader.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractNormalizedNodeDataOutput.java mode change 100644 => 100755 opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java 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; } -- 2.36.6