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

Anoop Sam John commented on HBASE-6942:
---------------------------------------

In the Delete template way, pass one Delete object only. The rowkey will be 
dummy only.. What we grab from this is which all family/col/version delete 
needed. User can create the Delete object and call deleteColumn(s) etc on that 
object....
At Endpoint side we will make use of the Delete object and get the family map 
from that.. We will use that family map to create the family map for the new 
Delete objects that we have created..
Here is the sample code for that
{code}
Delete delete = new Delete(deleteRowKey);
            if (deleteTemplate != null) {
              // when a delete is passed, get all the properties of that delete 
other than the
              // rowkey and give to the new Delete objects being created
              // No need to check for row locks. No way to get these locks at 
the client
              // side as the rows itself is not known.
              delete.setTimestamp(deleteTemplate.getTimeStamp());
              delete.setWriteToWAL(deleteTemplate.getWriteToWAL());
              setFamilyMap(deleteRowKey, deleteTemplate, delete);
            }
private void setFamilyMap(byte[] deleteRowKey, Delete deleteTemplate, Delete 
delete) {
    Map<byte[], List<KeyValue>> deleteTemplateFamilyMap = 
deleteTemplate.getFamilyMap();
    Map<byte[], List<KeyValue>> deleteFamilyMap = new HashMap<byte[], 
List<KeyValue>>();
    for (Entry<byte[], List<KeyValue>> entry : 
deleteTemplateFamilyMap.entrySet()) {
      List<KeyValue> deleteTemplateKVs = entry.getValue();
      List<KeyValue> deleteKVs = new 
ArrayList<KeyValue>(deleteTemplateKVs.size());
      for (KeyValue kv : deleteTemplateKVs) {
        deleteKVs.add(new KeyValue(deleteRowKey, entry.getKey(), 
kv.getQualifier(), kv
            .getTimestamp(), Type.codeToType(kv.getType())));
      }
      deleteFamilyMap.put(entry.getKey(), deleteKVs);
    }
    delete.setFamilyMap(deleteFamilyMap);
  }
{code}
                
> Endpoint implementation for bulk delete rows
> --------------------------------------------
>
>                 Key: HBASE-6942
>                 URL: https://issues.apache.org/jira/browse/HBASE-6942
>             Project: HBase
>          Issue Type: Improvement
>          Components: Coprocessors, Performance
>            Reporter: Anoop Sam John
>            Assignee: Anoop Sam John
>             Fix For: 0.94.3, 0.96.0
>
>         Attachments: HBASE-6942.patch, HBASE-6942_V2.patch, 
> HBASE-6942_V3.patch, HBASE-6942_V4.patch, HBASE-6942_V5.patch
>
>
> We can provide an end point implementation for doing a bulk deletion of 
> rows(based on a scan) at the server side. This can reduce the time taken for 
> such an operation as right now it need to do a scan to client and issue 
> delete(s) using rowkeys.
> Query like  delete from table1 where...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to