HI ,thank you for this eamil,  My question is if multiple threads modifying 
user permissions at the same time, will lead to a problem? For example, a users 
will need to admin, B users will need to root, assuming the two at the same 
time, will lead to a problem.



panqing...@163.com
 
From: Eric Newton [via Apache Accumulo]
Date: 2015-01-22 00:32
To: panqing...@163.com
Subject: Re: accumulo query delete
Ah. OK. 

All users' permissions and Authorizations are stored in zookeeper and 
update servers asynchronously. The assumption is that these operations are 
not needed to be fast and atomic: they are performed infrequently. That is, 
a few seconds update delay is acceptable, caching the data is good. 

If you need row-level atomic updates, please look into ConditionalWriter. 
In some cases, an IsolatedScanner may work better than the 
WholeRowIterator, though for small records, the WholeRowIterator works fine. 

You probably want the priority of the WholeRowIterator to be higher than 
the VersioningIterator, so that you do not get multiple versions for a 
particular cell of the table. 

-Eric 

On Wed, Jan 21, 2015 at 3:12 AM, [hidden email] <[hidden email]> 
wrote: 

> Thank your  reply this question. 
>    1、  public void deleteUser(String licenseKey, String userId) throws 
> AccumuloException { 
>         Connector conn = AccumuloClientSingleton.INSTANCE.getConnector(); 
>         BatchDeleter bd = null; 
>         try { 
> 
> 
> conn.securityOperations().changeUserAuthorizations(AccumuloConstants.USER_NAME,
>  
>                     new Authorizations(licenseKey)); 
>             bd = conn.createBatchDeleter(AccumuloConstants.XT_USER, new 
> Authorizations(licenseKey), 10, 
>                     new BatchWriterConfig()); 
>             Set<Range> ranges = new HashSet<Range>(); 
>             ranges.add(new Range(userId)); 
>             bd.setRanges(ranges); 
>             bd.delete(); 
>         } catch (Exception e) { 
>             throw new AccumuloException("删除用户信息时异常", e); 
>         } finally { 
>             if (bd != null) 
>                 bd.close(); 
>         } 
>     } 
> 2、  public XtUser getUser(String licenseKey, String userAccount) throws 
> AccumuloException { 
>         Connector conn = AccumuloClientSingleton.INSTANCE.getConnector(); 
>         Map<String, XtUser> map = new HashMap<String, XtUser>(); 
>         try { 
> 
> 
> conn.securityOperations().changeUserAuthorizations(AccumuloConstants.USER_NAME,
>  
>                     new Authorizations(licenseKey)); 
>             Scanner scanner = 
> conn.createScanner(AccumuloConstants.USER_NAME, new 
> Authorizations(licenseKey)); 
>             // 行迭代器 
>             IteratorSetting it = new IteratorSetting(1, "WholeRowIterator", 
> WholeRowIterator.class); 
>             scanner.addScanIterator(it); 
>             for (Entry<Key, Value> entry : scanner) { 
>                 XtUser xtUser = new XtUser(); 
>                 for (Entry<Key, Value> actualEntry : 
> WholeRowIterator.decodeRow(entry.getKey(), entry.getValue()) 
>                         .entrySet()) { 
>                     String qualifier = 
> actualEntry.getKey().getColumnFamily().toString(); 
>                     String value = actualEntry.getValue().toString(); 
>                     if (qualifier.equals("role_id")) { 
>                         xtUser.setRoleId(value); 
>                     } else if (qualifier.equals("role_name")) { 
>                         xtUser.setRoleName("role_name"); 
>                     } else if (qualifier.equals("user_account")) { 
>                         xtUser.setUserAccount(value); 
>                     } 
>                     map.put(xtUser.getUserAccount(), xtUser); 
>                 } 
>             } 
>         } catch (Exception e) { 
>             throw new AccumuloException("获取用户消息异常", e); 
>         } 
>         return map.get(userAccount); 
>     } 
> 
> Method 1, method 2 will modify the user's permission, if concurrent case, 
> is 
> also the method 1, method 2 and is called, should be how to deal with? 
> 
> 
> 
> -- 
> View this message in context: 
> http://apache-accumulo.1065345.n5.nabble.com/accumulo-query-delete-tp12965p12969.html
> Sent from the Developers mailing list archive at Nabble.com. 
> 




If you reply to this email, your message will be added to the discussion below:
http://apache-accumulo.1065345.n5.nabble.com/accumulo-query-delete-tp12965p12976.html
 
To unsubscribe from accumulo query delete, click here.
NAML 




--
View this message in context: 
http://apache-accumulo.1065345.n5.nabble.com/accumulo-query-delete-tp12965p12993.html
Sent from the Developers mailing list archive at Nabble.com.

Reply via email to