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

James Taylor commented on PHOENIX-1619:
---------------------------------------

One further clarification: The option #2 requires either 2a or a 2b to be done. 
If you're using HBase APIs to write the data for an immutable table, the index 
won't be updated. For an immutable table, the index maintenance is done on the 
client side when you go through Phoenix APIs. If you want to stick with using 
HBase APIs to write the data, then you'll need to also write the index data. 
The code I pointed you to, MutationState.addRowMutations(), is the code that'll 
generate the index Puts given the data Puts. This is option
2b.

Another alternative: 2a (use our 4.2 RC0 for this one): create your index as a 
local index: CREATE LOCAL INDEX ... And then see MutationState.commit(), as 
you'd need to set these two attributes on each Put that you're generating from 
HBase.
{code}
    mutation.setAttribute(PhoenixIndexCodec.INDEX_UUID, uuidValue);
    mutation.setAttribute(PhoenixIndexCodec.INDEX_MD, attribValue);
{code}

But why not just use option 1: use Phoenix APIs to write the data. All this 
work above would not be necessary as Phoenix would do all of this for you (with 
the same perf you're seeing now).


> Read-only/mapped views directly on HBase tables do not maintain secondary 
> indexes
> ---------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1619
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1619
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: James Taylor
>
> A read-only/mapped view does not maintain its secondary indexes. This is by 
> design currently, as the Phoenix APIs are being bypassed so there's not much 
> Phoenix can do. However, it would be possible for a client to push the same 
> metadata that Phoenix does through the HBase API for this to occur. Phoenix 
> may be able to provide some APIs to make this easier.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to