You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "jalphonso (via GitHub)" <gi...@apache.org> on 2024/12/27 19:21:59 UTC
[PR] add DeepCopy to ColumnVisibility [accumulo]
jalphonso opened a new pull request, #5217:
URL: https://github.com/apache/accumulo/pull/5217
Added in DeepCopy methods for ColumnVisibility and the related Node class to save processing time in datawave.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#issuecomment-2575867843
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 my influence these changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#discussion_r1920415714
##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -505,6 +516,12 @@ public ColumnVisibility(byte[] expression) {
validate(expression);
}
+ public ColumnVisibility(ColumnVisibility visibility) {
Review Comment:
This needs javadoc with a `@since 2.1.4` tag. Would also be nice to mention in the javadoc that deep copy is done.
##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -125,6 +125,17 @@ public Node(int start, int end) {
this.end = end;
}
+ public Node(Node node) {
Review Comment:
This also needs the javadoc since tag and could document that a deep copy is done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#issuecomment-2567801689
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](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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#discussion_r1920821972
##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -125,6 +125,23 @@ public Node(int start, int end) {
this.end = end;
}
+ /**
+ * Creates a new node by performing a deep copy of an existing node object
+ *
+ * @param node Node object
+ * @since 2.1.4
+ */
+ public Node(Node node) {
+ List<Node> childrenNew = new ArrayList<>(node.children.size());
+ for (Node child : node.children) {
+ childrenNew.add(new Node(child));
+ }
Review Comment:
Looked over the existing code and noticed it had some handling to avoid allocating empty list in the nodes. Can do that here also.
```suggestion
List<Node> childrenNew = node.children.isEmpty() ? EMPTY : new ArrayList<>(node.children.size());
for (Node child : node.children) {
childrenNew.add(new Node(child));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "jalphonso (via GitHub)" <gi...@apache.org>.
jalphonso commented on PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#issuecomment-2598683579
> 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](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.
Thanks Dave
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "jalphonso (via GitHub)" <gi...@apache.org>.
jalphonso commented on code in PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#discussion_r1925375725
##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -125,6 +125,23 @@ public Node(int start, int end) {
this.end = end;
}
+ /**
+ * Creates a new node by performing a deep copy of an existing node object
+ *
+ * @param node Node object
+ * @since 2.1.4
+ */
+ public Node(Node node) {
+ List<Node> childrenNew = new ArrayList<>(node.children.size());
+ for (Node child : node.children) {
+ childrenNew.add(new Node(child));
+ }
Review Comment:
Sounds good
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#issuecomment-2576178542
Opened #5232 to remove the deprecated column visibility code in 4.0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "jalphonso (via GitHub)" <gi...@apache.org>.
jalphonso commented on code in PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#discussion_r1920447865
##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -505,6 +516,12 @@ public ColumnVisibility(byte[] expression) {
validate(expression);
}
+ public ColumnVisibility(ColumnVisibility visibility) {
Review Comment:
added javadoc
##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -125,6 +125,17 @@ public Node(int start, int end) {
this.end = end;
}
+ public Node(Node node) {
Review Comment:
added javadoc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#discussion_r1935548097
##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -505,6 +523,19 @@ public ColumnVisibility(byte[] expression) {
validate(expression);
}
+ /**
+ * Creates a new column visibility by performing a deep copy of an existing column visibility
+ * object
+ *
+ * @param visibility ColumnVisibility object
+ * @since 2.1.4
+ */
+ public ColumnVisibility(ColumnVisibility visibility) {
+ byte[] incomingExpression = visibility.expression;
+ this.expression = Arrays.copyOf(incomingExpression, incomingExpression.length);
+ this.node = new Node(visibility.node);
Review Comment:
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "jalphonso (via GitHub)" <gi...@apache.org>.
jalphonso closed pull request #5217: add DeepCopy to ColumnVisibility
URL: https://github.com/apache/accumulo/pull/5217
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#discussion_r1935787269
##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -505,6 +523,19 @@ public ColumnVisibility(byte[] expression) {
validate(expression);
}
+ /**
+ * Creates a new column visibility by performing a deep copy of an existing column visibility
+ * object
+ *
+ * @param visibility ColumnVisibility object
+ * @since 2.1.4
+ */
+ public ColumnVisibility(ColumnVisibility visibility) {
+ byte[] incomingExpression = visibility.expression;
+ this.expression = Arrays.copyOf(incomingExpression, incomingExpression.length);
+ this.node = new Node(visibility.node);
Review Comment:
I am experimenting w/ adding an immutable parse tree to accumulo-access as a possible way to address this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "jalphonso (via GitHub)" <gi...@apache.org>.
jalphonso commented on PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#issuecomment-2598682623
> Opened #5232 to remove the deprecated column visibility code in 4.0
nice
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "jalphonso (via GitHub)" <gi...@apache.org>.
jalphonso commented on PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#issuecomment-2598687782
> 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.
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] add DeepCopy to ColumnVisibility [accumulo]
Posted by "ddanielr (via GitHub)" <gi...@apache.org>.
ddanielr commented on code in PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#discussion_r1934283305
##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -125,6 +125,24 @@ public Node(int start, int end) {
this.end = end;
}
+ /**
+ * Creates a new node by performing a deep copy of an existing node object
+ *
+ * @param node Node object
+ * @since 2.1.4
+ */
+ public Node(Node node) {
Review Comment:
Since Node is removed in newer versions of accumulo this constructor could be switched to private to avoid standardizing its usage
```suggestion
private Node(Node node) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org