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

Scott Chen commented on HBASE-5542:
-----------------------------------

@Lars: It seems to me that the major difference in doMiniBatchPut is that it 
gets the locks with non-block option and process the locked rows. It remembers 
a index of processed row and keeps continuing.

How about making MultiRowProcessor having an atomic option?
{code}
interface MultiRowProcessor {

  boolean isAtomic();

  Collection<byte[]> rowsToLock();

  // need to tell processor which rows to process in the non-atomic mode
  process(Collection<byte[]> rowsLocked); 

}
{code}

In HRegion, we check if the processor is atomic.
If it is not, we get as many lock as possible and process them in a loop.
{code}
HRegion.processRowsWithLocks(MultiRowProcessor processor) {

  while (done) {
    if (processor.isAtomic()) {
      // get all locks with blocking option
    } else {
      // get as many locks with non-blocking option
    }
    processor.process(lockedRows);
    
    if (/*we process all the rows*/) {
      done = true;
    }
  }

}
{code}

What do you think?
                
> Unify HRegion.mutateRowsWithLocks() and HRegion.processRow()
> ------------------------------------------------------------
>
>                 Key: HBASE-5542
>                 URL: https://issues.apache.org/jira/browse/HBASE-5542
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Scott Chen
>            Assignee: Scott Chen
>             Fix For: 0.96.0
>
>         Attachments: HBASE-5542.D2217.1.patch, HBASE-5542.D2217.2.patch, 
> HBASE-5542.D2217.3.patch
>
>
> mutateRowsWithLocks() does atomic mutations on multiple rows.
> processRow() does atomic read-modify-writes on a single row.
> It will be useful to generalize both and have a
> processRowsWithLocks() that does atomic read-modify-writes on multiple rows.
> This also helps reduce some redundancy in the codes.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to