-
Notifications
You must be signed in to change notification settings - Fork 459
add DeepCopy to ColumnVisibility #5217
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
Conversation
I think this looks ok, but have added @keith-turner as a reviewer. He has recently modified newer versions of this code. The Node and parse tree are deprecated in 3.1 and will be removed in 4.0 and has been replaced by the AccessExpression in github.com/apache/accumulo-access. I also reviewed the commit history to see if there was a clone or deepCopy method that used to exist, but was removed for some reason, and did not see anything. |
Looked at 3.1 and 4.0 version of Accumulo to see how this change would merge forward. While doing that I realized the deprecated code could be removed in 4.0 in ColumnVisibility. Removing that would influence how this would merge forward which would help thinking through these changes. I will try to remove the deprecated code soon to see how that may influence these changes. |
Opened #5232 to remove the deprecated column visibility code in 4.0 |
d73a47d
to
93942d0
Compare
nice |
Thanks Dave |
Thanks Keith. I refactored the code to use the copy constructor instead of deepCopy to keep in line with the API. I do agree it looks cleaner this way and keeps the guarantee that the expression has been previously validated. |
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java
Show resolved
Hide resolved
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java
Show resolved
Hide resolved
d6765f1
to
a53da7d
Compare
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java
Outdated
Show resolved
Hide resolved
…ibility.java EMPTY optimization Co-authored-by: Keith Turner <[email protected]>
5cadfc6
to
e27aec1
Compare
* @param node Node object | ||
* @since 2.1.4 | ||
*/ | ||
public Node(Node node) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Node is removed in newer versions of accumulo this constructor could be switched to private to avoid standardizing its usage
public Node(Node node) { | |
private Node(Node node) { |
public ColumnVisibility(ColumnVisibility visibility) { | ||
byte[] incomingExpression = visibility.expression; | ||
this.expression = Arrays.copyOf(incomingExpression, incomingExpression.length); | ||
this.node = new Node(visibility.node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a comment in #5293 that is applicable here also. I think it's possible that another thread could be mutating the parse tree (visibility.node) while this thread is trying to make a copy of the ColumnVisibility because the parse tree is accessible and mutable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am experimenting w/ adding an immutable parse tree to accumulo-access as a possible way to address this.
Added in DeepCopy methods for ColumnVisibility and the related Node class to save processing time in datawave.