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

James Taylor commented on PHOENIX-1882:
---------------------------------------

Patch looks good - I like the new test. I think you can get rid of this hacky 
code in IndexMaintainer too (function name will be isRowDeleted there, though, 
but you get the idea):
{code}
    private DeleteType getDeleteTypeOrNull(Collection<Cell> pendingUpdates) {
        int nDeleteCF = 0;
        int nDeleteVersionCF = 0;
        for (Cell kv : pendingUpdates) {
            if (kv.getTypeByte() == KeyValue.Type.DeleteFamily.getCode()) {
                nDeleteCF++;
                boolean isEmptyCF = Bytes.compareTo(kv.getFamilyArray(), 
kv.getFamilyOffset(), kv.getFamilyLength(), 
                  dataEmptyKeyValueCF, 0, dataEmptyKeyValueCF.length) == 0;
                // This is what a delete looks like on the client side for 
immutable indexing...
                if (isEmptyCF) {
                    return DeleteType.ALL_VERSIONS;
                }
            } else if (kv.getTypeByte() == 
KeyValue.Type.DeleteFamilyVersion.getCode()) {
                nDeleteVersionCF++;
            }
        }
        // This is what a delete looks like on the server side for mutable 
indexing...
        // Should all be one or the other for DeleteFamily versus 
DeleteFamilyVersion, but just in case not
        return nDeleteVersionCF >= this.nDataCFs ? DeleteType.SINGLE_VERSION : 
nDeleteCF + nDeleteVersionCF >= this.nDataCFs ? DeleteType.ALL_VERSIONS : null;
    }
{code}

Can just look like this now:
{code}
    private DeleteType getDeleteTypeOrNull(Collection<Cell> pendingUpdates) {
        int nDeleteCF = 0;
        int nDeleteVersionCF = 0;
        for (Cell kv : pendingUpdates) {
            if (kv.getTypeByte() == KeyValue.Type.DeleteFamily.getCode()) {
                nDeleteCF++;
            } else if (kv.getTypeByte() == 
KeyValue.Type.DeleteFamilyVersion.getCode()) {
                nDeleteVersionCF++;
            }
        }
        // This is what a delete looks like on the server side for mutable 
indexing...
        // Should all be one or the other for DeleteFamily versus 
DeleteFamilyVersion, but just in case not
        return nDeleteVersionCF >= this.nDataCFs ? DeleteType.SINGLE_VERSION : 
nDeleteCF + nDeleteVersionCF >= this.nDataCFs ? DeleteType.ALL_VERSIONS : null;
    }
{code}

> Issue column family deletes instead of row deletes in PTableImpl
> ----------------------------------------------------------------
>
>                 Key: PHOENIX-1882
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1882
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: James Taylor
>            Assignee: Thomas D'Silva
>             Fix For: 5.0.0, 4.4.0
>
>         Attachments: PHOENIX-1882-4.x-HBase-0.98-v2.patch, 
> PHOENIX-1882-4.x-HBase-0.98.patch, PHOENIX-1882-master-v2.patch, 
> PHOENIX-1882-master.patch
>
>
> Since PTable knows which column families are under control of Phoenix 
> (table.getColumnFamilies()), we should issue a column family delete for each 
> of them instead of a row delete (this is what it gets translated to anyway 
> when it gets to the server). This is actually better, as Phoenix should not 
> attempt to manage undeclared column families.



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

Reply via email to