Github user lvfangmin commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/647#discussion_r221391402
--- Diff: src/java/main/org/apache/zookeeper/server/DataTree.java ---
@@ -527,6 +527,24 @@ public void deleteNode(String path, long zxid)
int lastSlash = path.lastIndexOf('/');
String parentName = path.substring(0, lastSlash);
String childName = path.substring(lastSlash + 1);
+
+ // The child might already be deleted during taking fuzzy snapshot,
+ // but we still need to update the pzxid here before throw
exception
+ // for no such child
+ DataNode parent = nodes.get(parentName);
+ if (parent == null) {
+ throw new KeeperException.NoNodeException();
+ }
+ synchronized (parent) {
+ parent.removeChild(childName);
+ // Only update pzxid when the zxid is larger than the current
pzxid,
+ // otherwise we might override higher pzxid set by a following
create
+ // Txn, which could cause the cversion and pzxid inconsistent
+ if (zxid > parent.stat.getPzxid()) {
--- End diff --
This is a new bug I found recently, the previous change in ZOOKEEPER-3125
has a bug which could revert pzxid. Given it's a known issue in that Jira, I
think it's reasonable to fix it in the same patch here before porting back to
3.5.
---