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

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

As part of CP clean up for 2.0 I believe we have added this Private annotation 
for add() methods.  The idea is, even if we pass WALEdit type itself to come 
CPs, we dont want the CPs to change the state of that Object.  One can use 
getters only.  But again considering this class alone, it raises 2 questions now
1. There is a public method add(Map<byte[], List<Cell>> familyMap) in WALEdit 
which can do same work as that of add() APIs.  It was a miss for adding Private 
annotation for this method?   Also there is a getCells() API which return the 
same 'cells' data structure. One can change the state of the object by dealing 
with this List.
2. There are CP APIs around batchMutate() which gets 
MiniBatchOperationInProgress param.   This CP API allows a CP user to pass new 
Cells to be written to WAL for each of the mutations in the batch.  That can be 
done using the API
setWalEdit(int index, WALEdit walEdit)
This means the CP has to create the WALEdit object.  And then comes the  Q how 
to add Cells to it?  I can not see other static util API or a builder to create 
a new WALEdit with some cells.  
Said that already wrt the WALEdit we miss some thing
Also for batchMutate() API only we have the CP APIs which helps to pass a CP 
defined WALEdit for the Mutations. (Those WALEdit cells from CP will get 
combined with Mutation's data cells and get written to WAL).   For APIs like 
append/increment such a way is missing.
So I am +1 for the idea of the new CP API allowing Cells to be added to WALEdit 
and so to WAL.  (Only thing is with batchMutate() user needs to be careful. It 
will give 2 CP calls both allowing the same).   But we better do not expose the 
Region built WALEdit  and give a chance for the CPs to change its state 
directly.  Can we think of a way like the MiniBatchOperationInProgress doing 
way?  That the CP can some way pass it extra cells/WALEdit and we combine that 
along with the Mutation cells while write to WAL?

Note : Existing issue with how a CP to create new WALEdit with Cells in it for 
adding to MiniBatchOperationInProgress still there. May be to handle in another 
Jira.  

> Add RegionObserver coprocessor hook for preWALAppend
> ----------------------------------------------------
>
>                 Key: HBASE-22623
>                 URL: https://issues.apache.org/jira/browse/HBASE-22623
>             Project: HBase
>          Issue Type: New Feature
>            Reporter: Geoffrey Jacoby
>            Assignee: Geoffrey Jacoby
>            Priority: Major
>             Fix For: 3.0.0, 1.5.0, 2.3.0
>
>
> While many coprocessor hooks expose the WALEdit to implementing coprocs, 
> there aren't any that expose the WALKey before it's created and added to the 
> WALEntry. 
> It's sometimes useful for coprocessors to be able to edit the WALKey, for 
> example to add extended attributes using the fields to be added in 
> HBASE-22622. 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to