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

James Taylor commented on PHOENIX-1249:
---------------------------------------

Thanks for the quick turnaround on the patch, [~rajesh23]. Here's some feedback:
- We'll want to tweak the way we do index maintenance if the table is marked as 
immutable, otherwise we'll get no perf advantage. You'll want to prevent the 
lookup of the "old" values (as we know there are no "old" values), but still 
create the index updates for the "new" values. [~jesse_yates] may be able to 
give you some pointers here, or you can likely figure it out on your own and he 
can review it.
- I think it's better if we can avoid passing in a boolean forceSerialize 
method. Instead, can we check if the index is local?
{code}
+    public static void serialize(PTable dataTable, ImmutableBytesWritable ptr,
+            List<PTable> indexes, boolean forceSerialize) {
         Iterator<PTable> indexesItr = 
nonDisabledIndexIterator(indexes.iterator());
-        if ((dataTable.isImmutableRows()) || !indexesItr.hasNext()) {
+        if ((!forceSerialize && dataTable.isImmutableRows()) || 
!indexesItr.hasNext()) {
{code}
- Avoid checking column names and instead start the column iteration after the 
position of the VIEW_INDEX_ID_COLUMN_NAME column. You'll need to take into 
account if the table is salted (+1) and then if it's local (another +1) as a 
position offset into the pkColumns.
{code}
+            List<PColumn> pkColumns = index.getPKColumns();
+            if (index.getIndexType() == IndexType.LOCAL
+                    && tableRef.getTable().getType() != PTableType.VIEW) {
+                for (PColumn column : pkColumns) {
+                    if 
(!column.getName().getString().equals(MetaDataUtil.VIEW_INDEX_ID_COLUMN_NAME) 
&& !IndexUtil.isDataPKColumn(column)) {
+                        return true;
+                    }
+                }
+            } else {
+                for (PColumn column : pkColumns) {
+                    if (!IndexUtil.isDataPKColumn(column)) {
+                        return true;
+                    }
{code}

Also, FYI, I'm planning to make a change where an index itself is marked as 
immutable instead of the entire table. Based on this, we'll want to allow an 
index to be marked as both immutable and local.


> Support local immutable index 
> ------------------------------
>
>                 Key: PHOENIX-1249
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1249
>             Project: Phoenix
>          Issue Type: Sub-task
>    Affects Versions: 4.1
>         Environment: Hbase 0.98.4-Hadoop2
> Phoenix 4.1
>            Reporter: Sun Fulin
>            Assignee: rajeshbabu
>             Fix For: 5.0.0, 4.2
>
>         Attachments: PHOENIX-1249.patch
>
>
> Currently local indexing are forced created as default mutable index which 
> requires index maintenance and server side processing, while immutable 
> indexes are appropriate for write-once/append-only use case that may fit for 
> many use cases. Hope some work for capability to create local index as 
> immutable index.



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

Reply via email to