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

Andrew Purtell commented on HBASE-3842:
---------------------------------------

Additionally I propose the addition of a new coprocessor observer type, 
{{CompactionObserver}}, with the following interface:

{code}
/**
 * Notification that compaction is about to begin.
 * @param context Observer context
 * @param store the Store that is about to be compacted
 * @return false to skip compaction
 */
boolean preCompact(ObserverContext<~> context, Store store);

/**
 * Notification that compaction completed
 * @param context Observer context
 * @param store the Store that was compacted
 */
void postCompact(ObserverContext<~> context, Store store);

/**
 * Called before a KV is written to the new store file.
 * <p>
 * WARNING: It is only safe, unless you <i>really</i> know what you are doing,
 * to signal the KV should be dropped by returning {{null}} or to return a KV
 * with only the value changed somehow.
 * @param context Observer context
 * @param store the Store that is being compacted
 * @param kv the KeyValue
 * @return the KeyValue to write, or null if none
 */
KeyValue preCompactWrite(ObserverContext<~> context, Store store, KeyValue kv);

/**
 * Called after a KV is written to the new store file.
 * @param context Observer context
 * @param store the Store that is being compacted
 * @param kv the KeyValue
 */
void postCompactWrite(ObserverContext<~> context, Store store, KeyValue kv);
{code}

If the coprocessor implements this interface, it is hooked into the compaction 
process such that it can operate on every KV. This is the same model we use for 
WAL observers.


> Refactor Coprocessor Compaction API
> -----------------------------------
>
>                 Key: HBASE-3842
>                 URL: https://issues.apache.org/jira/browse/HBASE-3842
>             Project: HBase
>          Issue Type: Improvement
>          Components: coprocessors, regionserver
>    Affects Versions: 0.92.0
>            Reporter: Nicolas Spiegelberg
>            Assignee: Nicolas Spiegelberg
>              Labels: compaction
>             Fix For: 0.92.0
>
>
> After HBASE-3797, the compaction logic flow has been significantly altered.  
> Because of this, the current compaction coprocessor API is insufficient for 
> gaining full insight into compaction requests/results.  Refactor coprocessor 
> API after HBASE-3797 is committed to be more extensible and increase 
> visibility.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to