Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZOOKEEPER-4677] Cleanup code in the DataTree class #1968

Merged
merged 5 commits into from Feb 27, 2023

Conversation

tisonkun
Copy link
Member

Today I read the DataTree class and do these cleanups along with the path.

cc @symat @eolivelli

Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@@ -781,7 +773,7 @@ public List<ACL> getACL(String path, Stat stat) throws KeeperException.NoNodeExc
if (stat != null) {
n.copyStat(stat);
}
return new ArrayList<ACL>(aclCache.convertLong(n.acl));
return new ArrayList<>(aclCache.convertLong(n.acl));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

20% of developers fix this issue

💬 5 similar findings have been found in this PR


THREAD_SAFETY_VIOLATION: Read/Write race. Non-private method DataTree.getACL(...) indirectly reads with synchronization from container this.aclCache.longKeyMap via call to Map.get(...). Potentially races with unsynchronized write in method DataTree.deserialize(...).
Reporting because this access may occur on a background thread.


🔎 Expand here to view all instances of this finding
File Path Line Number
zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java 1467
zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java 195
zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java 1368
zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java 1440
zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java 461

Visit the Lift Web Console to find more details in your report.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eolivelli
Copy link
Contributor

eolivelli commented Jan 18, 2023

@tisonkun can you please create a JIRA and change the title and the commit message ?

@tisonkun tisonkun changed the title Cleanup code in the DataTree class [ZOOKEEPER-4677] Cleanup code in the DataTree class Feb 25, 2023
@tisonkun
Copy link
Member Author

@eolivelli ticket created. Commit title should be default to PR title if you merge from WebUI.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

how did you create this patch ? manually or with a tool ?

@tisonkun
Copy link
Member Author

@eolivelli Manually.

@tisonkun
Copy link
Member Author

Merging...

FYI I may take a look at sonatype-lift reports to see if we can fix or disable it, preventing merging patches with CI fails.

@tisonkun tisonkun merged commit a9517d8 into apache:master Feb 27, 2023
@tisonkun tisonkun deleted the tidycode branch February 27, 2023 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants