-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-22377 Provide API to check the existence of a namespace which does not require ADMIN permissions #225
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
| import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.TruncateTableResponse; | ||
| import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.UnassignRegionRequest; | ||
| import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.UnassignRegionResponse; | ||
| import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.*; |
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.
Shall we avoid import *
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.
Yeah Eclipse did this behind my back. Will manually undo it.
| import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.TruncateTableResponse; | ||
| import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.UnassignRegionRequest; | ||
| import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.UnassignRegionResponse; | ||
| import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.*; |
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.
Ditto
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.
Same :-(
|
LGTM overall, I just left two comments about import check-style. |
| public void preListNamespaces(final List<String> namespaces) throws IOException { | ||
| execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() { | ||
| @Override | ||
| public void call(MasterObserver oserver) throws IOException { |
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.
Just a minor spelling nit:
| public void call(MasterObserver oserver) throws IOException { | |
| public void call(MasterObserver observer) throws IOException { |
| execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() { | ||
| @Override | ||
| public void call(MasterObserver oserver) throws IOException { | ||
| oserver.preListNamespaces(this, namespaces); |
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.
| oserver.preListNamespaces(this, namespaces); | |
| observer.preListNamespaces(this, namespaces); |
| public void postListNamespaces(final List<String> namespaces) throws IOException { | ||
| execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() { | ||
| @Override | ||
| public void call(MasterObserver oserver) throws IOException { |
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.
| public void call(MasterObserver oserver) throws IOException { | |
| public void call(MasterObserver observer) throws IOException { |
| execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() { | ||
| @Override | ||
| public void call(MasterObserver oserver) throws IOException { | ||
| oserver.postListNamespaces(this, namespaces); |
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.
| oserver.postListNamespaces(this, namespaces); | |
| observer.postListNamespaces(this, namespaces); |
the-sakthi
left a comment
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.
Looks good to me. Just left a minor nit.
|
Also, would it make sense to add a comment somewhere in master or preListNamespaces or even the client side about making sure no accesscontroller check is skipped on purpose so that folks who try to introduce that change are aware of the the requirement of this issue? And how about putting in few tests cases around admin.listNamespaces() that checks this as well in the future as there aren't very many tests hitting the admin.listNamespaces codepath currently? |
Good suggestion
I can certainly add one, no problem. Also, over on the JIRA there is a TestInterfaceAlign result that tells me I missed an update to AsyncAdmin so let me add that too. |
|
💔 -1 overall
This message was automatically generated. |
|
First force push above was just a rebase; second (latest) push is the update. Changes:
|
|
💔 -1 overall
This message was automatically generated. |
|
Updated patch to fix checkstyle nits |
|
💔 -1 overall
This message was automatically generated. |
|
The rubocop result is silly. I left the formatting the same as I found it. Somehow it was not valid before? But if someone feels this is legitimate, I can just drop the change to admin.rb, it is just a trivial thing. The unit test failure looks unrelated, perhaps environmental. |
| list = @admin.listNamespaceDescriptors.map(&:getName) | ||
| list.select { |s| pattern.match(s) } | ||
| list = @admin.listNamespaces | ||
| list.select {|s| pattern.match(s) } |
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 think the warning pointing here {|s| which should be { |s|
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.
Thank you. I was blind to that whitespace change.
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.
Actually I didn't change that line intentionally, so that was my confusion. Will update it...
|
Confirmed, the failed test is unrelated. |
|
Updated patch with admin.rb whitespace fix |
xcangCRM
left a comment
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.
+1
and just 2 nitpickings.
| * List available namespace descriptors. | ||
| * List available namespaces | ||
| * | ||
| * @return List of descriptors |
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.
Nit: also change this to "List of namespace names", not descriptors anymore
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.
Will fix on commit, thanks
| String[] res = new String[list.size()]; | ||
| for(int i = 0; i < list.size(); i++) { | ||
| res[i] = list.get(i); | ||
| } |
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.
Nit:
should we just use toArray to convert a list to an array, removing the for loop?
res = list.toArray(res);
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.
Ok, will fix on commit
…oes not require ADMIN permissions
|
💔 -1 overall
This message was automatically generated. |
…oes not require ADMIN permissions (#225) Signed-off-by: Xu Cang <xucang@apache.org>
…oes not require ADMIN permissions (#225) Signed-off-by: Xu Cang <xucang@apache.org>
…oes not require ADMIN permissions (apache#225) Signed-off-by: Xu Cang <xucang@apache.org>
No description provided.