@@ -445,7 +445,10 @@ public void createNode(final String path, byte[] data, List<ACL> acl, long ephem
445
445
if (parent == null ) {
446
446
throw new NoNodeException ();
447
447
}
448
+ List <ACL > parentAcl ;
448
449
synchronized (parent ) {
450
+ parentAcl = getACL (parent );
451
+
449
452
// Add the ACL to ACL cache first, to avoid the ACL not being
450
453
// created race condition during fuzzy snapshot sync.
451
454
//
@@ -518,8 +521,9 @@ public void createNode(final String path, byte[] data, List<ACL> acl, long ephem
518
521
updateQuotaStat (lastPrefix , bytes , 1 );
519
522
}
520
523
updateWriteStat (path , bytes );
521
- dataWatches .triggerWatch (path , Event .EventType .NodeCreated , zxid );
522
- childWatches .triggerWatch (parentName .equals ("" ) ? "/" : parentName , Event .EventType .NodeChildrenChanged , zxid );
524
+ dataWatches .triggerWatch (path , Event .EventType .NodeCreated , zxid , acl );
525
+ childWatches .triggerWatch (parentName .equals ("" ) ? "/" : parentName ,
526
+ Event .EventType .NodeChildrenChanged , zxid , parentAcl );
523
527
}
524
528
525
529
/**
@@ -559,16 +563,20 @@ public void deleteNode(String path, long zxid) throws NoNodeException {
559
563
if (node == null ) {
560
564
throw new NoNodeException ();
561
565
}
566
+ List <ACL > acl ;
562
567
nodes .remove (path );
563
568
synchronized (node ) {
569
+ acl = getACL (node );
564
570
aclCache .removeUsage (node .acl );
565
571
nodeDataSize .addAndGet (-getNodeSize (path , node .data ));
566
572
}
567
573
568
574
// Synchronized to sync the containers and ttls change, probably
569
575
// only need to sync on containers and ttls, will update it in a
570
576
// separate patch.
577
+ List <ACL > parentAcl ;
571
578
synchronized (parent ) {
579
+ parentAcl = getACL (parent );
572
580
long owner = node .stat .getEphemeralOwner ();
573
581
EphemeralType ephemeralType = EphemeralType .get (owner );
574
582
if (ephemeralType == EphemeralType .CONTAINER ) {
@@ -615,9 +623,10 @@ public void deleteNode(String path, long zxid) throws NoNodeException {
615
623
"childWatches.triggerWatch " + parentName );
616
624
}
617
625
618
- WatcherOrBitSet processed = dataWatches .triggerWatch (path , EventType .NodeDeleted , zxid );
619
- childWatches .triggerWatch (path , EventType .NodeDeleted , zxid , processed );
620
- childWatches .triggerWatch ("" .equals (parentName ) ? "/" : parentName , EventType .NodeChildrenChanged , zxid );
626
+ WatcherOrBitSet processed = dataWatches .triggerWatch (path , EventType .NodeDeleted , zxid , acl );
627
+ childWatches .triggerWatch (path , EventType .NodeDeleted , zxid , acl , processed );
628
+ childWatches .triggerWatch ("" .equals (parentName ) ? "/" : parentName ,
629
+ EventType .NodeChildrenChanged , zxid , parentAcl );
621
630
}
622
631
623
632
public Stat setData (String path , byte [] data , int version , long zxid , long time ) throws NoNodeException {
@@ -626,8 +635,10 @@ public Stat setData(String path, byte[] data, int version, long zxid, long time)
626
635
if (n == null ) {
627
636
throw new NoNodeException ();
628
637
}
638
+ List <ACL > acl ;
629
639
byte [] lastData ;
630
640
synchronized (n ) {
641
+ acl = getACL (n );
631
642
lastData = n .data ;
632
643
nodes .preChange (path , n );
633
644
n .data = data ;
@@ -649,7 +660,7 @@ public Stat setData(String path, byte[] data, int version, long zxid, long time)
649
660
nodeDataSize .addAndGet (getNodeSize (path , data ) - getNodeSize (path , lastData ));
650
661
651
662
updateWriteStat (path , dataBytes );
652
- dataWatches .triggerWatch (path , EventType .NodeDataChanged , zxid );
663
+ dataWatches .triggerWatch (path , EventType .NodeDataChanged , zxid , acl );
653
664
return s ;
654
665
}
655
666
0 commit comments