You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2014/08/07 23:49:14 UTC

[jira] [Commented] (PHOENIX-1147) Ensure data table is sent to client if index table changes states

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

James Taylor commented on PHOENIX-1147:
---------------------------------------

Thanks for the patch, [~jeffreyz]. Looking good - just a one minor items, I believe. Code similar to the code you added in MetaDataClient already exists in PMetaDataImpl.removeTable(), so I don't believe it's necessary. The code there updates the list of index tables for the parent table by removing the index that was removed. If this isn't working correctly, we should fix it there, rather than in MetaDataClient, as that's the code responsible for maintaining the meta data cache on the client. Also, FYI, you shouldn't do a equalsIgnoreCase, as the case will match exactly (and you may find one you didn't intend to).

{code}
+                    // try to remove its reference from parent table cache
+                    if(parentTableName != null && !parentTableName.isEmpty()) {
+                        PTable parentTable = connection.getMetaDataCache().getTable(
+                            new PTableKey(tenantId, SchemaUtil.getTableName(schemaName, parentTableName)));
+                        if(parentTable != null) {
+                            List<PTable> oldIndexes = parentTable.getIndexes();
+                            if(oldIndexes != null && !oldIndexes.isEmpty()) {
+                                Iterator<PTable> it = oldIndexes.iterator();
+                                while(it.hasNext()) {
+                                    PTable index = it.next();
+                                    if((index.getTenantId() == null || index.getTenantId().equals(tenantId)) && 
+                                            index.getName().getString().equalsIgnoreCase(SchemaUtil.getTableName(schemaName, tableName))){
+                                         it.remove();
+                                         // update table cache
+                                         connection.addTable(PTableImpl.makePTable(parentTable, parentTable.getTimeStamp(), oldIndexes));
+                                         break;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                                        
{code}

> Ensure data table is sent to client if index table changes states
> -----------------------------------------------------------------
>
>                 Key: PHOENIX-1147
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1147
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.0.0, 5.0.0
>            Reporter: Jeffrey Zhong
>            Assignee: Jeffrey Zhong
>         Attachments: Phoenix-1147-v1.patch, Phoenix-1147-v2.patch, Phoenix-1147-v3.patch
>
>
> Add one test to cover RegionServer being killed while index is begin updated
> Add steps to make sure UPSERT & SELECT should still work after index is disabled.



--
This message was sent by Atlassian JIRA
(v6.2#6252)