[ 
https://issues.apache.org/jira/browse/HBASE-18500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16121382#comment-16121382
 ] 

Guanghao Zhang commented on HBASE-18500:
----------------------------------------

AccessController.grant method will check permission first, then use 
runAsLoginUser to put a record to ACL table.
{code}
        switch(request.getUserPermission().getPermission().getType()) {
          case Global :
          case Table :
            requirePermission(caller, "grant", perm.getTableName(),
                perm.getFamily(), perm.getQualifier(), Action.ADMIN);
            break;
          case Namespace :
            requireNamespacePermission(caller, "grant", perm.getNamespace(), 
Action.ADMIN);
           break;
        }

        User.runAsLoginUser(new PrivilegedExceptionAction<Void>() {
          @Override
          public Void run() throws Exception {
            AccessControlLists.addUserPermission(regionEnv.getConfiguration(), 
perm,
              regionEnv.getTable(AccessControlLists.ACL_TABLE_NAME), 
request.getMergeExistingPermissions());
            return null;
          }
        });
{code}

When put record to ACL, it will check permission, too. And it will get active 
user from Context first, then get the logged user.
{code}
  private User getActiveUser(ObserverContext ctx) throws IOException {
    User user = ctx.getCaller();
    if (user == null) {
      // for non-rpc handling, fallback to system user
      user = userProvider.getCurrent();
    }
    return user;
  }
{code}

And when we use table.put(Put) to write record to ACL, I found it still print 
log in a same thread. Then it will use context user to require permission. When 
use put(List<put>), it will use AsyncProcess and will run it in a new thread. 
Then the context user is null, it will use the logged user to require 
permission. I thought the problem is the runAsLoginUser method didn't change 
the context user when it run in a same thread. But I don't have a good idea to 
fix this. Any ideas about this?

> Performance issue: Don't use BufferedMutator for HTable's put method
> --------------------------------------------------------------------
>
>                 Key: HBASE-18500
>                 URL: https://issues.apache.org/jira/browse/HBASE-18500
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Guanghao Zhang
>            Assignee: Guanghao Zhang
>         Attachments: HBASE-18500-v1.patch, HBASE-18500-v2.patch, 
> HBASE-18500-v3.patch, HBASE-18500-v4.patch, HBASE-18500-v5.patch, 
> HBASE-18500-v5.patch, HBASE-18500-v5.patch
>
>
> Copied the test result from HBASE-17994.
> Run start-hbase.sh in my local computer and use the default config to test 
> with PE tool.
> {code}
> ./bin/hbase org.apache.hadoop.hbase.PerformanceEvaluation --rows=100000 
> --nomapred --autoFlush=True randomWrite 1
> ./bin/hbase org.apache.hadoop.hbase.PerformanceEvaluation --rows=100000 
> --nomapred --autoFlush=True asyncRandomWrite 1
> {code}
> Mean latency test result.
> || || Test1 || Test2 || Test3 || Test4 || Test5 ||
> | randomWrite | 164.39 | 161.22 | 164.78 | 140.61 | 151.69 |
> | asyncRandomWrite | 122.29 | 125.58 | 122.23 | 113.18 | 123.02 |
> 50th latency test result.
> || || Test1 || Test2 || Test3 || Test4 || Test5 ||
> | randomWrite | 130.00 | 125.00 | 123.00 | 112.00 | 121.00 |
> | asyncRandomWrite | 95.00 | 97.00 | 95.00 | 88.00 | 95.00 |
> 99th latency test result.
> || || Test1 || Test2 || Test3 || Test4 || Test5 ||
> | randomWrite | 600.00 | 600.00 | 650.00 | 404.00 | 425.00 |
> | asyncRandomWrite | 339.00 | 327.00 | 297.00 | 311.00 | 318.00 |
> In our internal 0.98 branch, the PE test result shows the async write has the 
> almost same latency with the blocking write. But for master branch, the 
> result shows the async write has better latency than the blocking client.  
> Take a look about the code, I thought the difference is the BufferedMutator. 
> For master branch, HTable don't have a write buffer and all write request 
> will be flushed directly. And user can use BufferedMutator when user want to 
> perform client-side buffering of writes. For the performance issue 
> (autoFlush=True), I thought we can use rpc caller directly in HTable's put 
> method. Thanks.
> Review: https://reviews.apache.org/r/61454/



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to