phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twdsilva <...@git.apache.org>
Subject [GitHub] phoenix pull request #317: PHOENIX-3547 Supporting more number of indices pe...
Date Sat, 28 Jul 2018 21:23:02 GMT
Github user twdsilva commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/317#discussion_r205954264
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
---
    @@ -1431,11 +1438,42 @@ private PTable getTable(RegionScanner scanner, long clientTimeStamp,
long tableT
             // server while holding this lock is a bad idea and likely to cause contention.
             return PTableImpl.makePTable(tenantId, schemaName, tableName, tableType, indexState,
timeStamp, tableSeqNum,
                     pkName, saltBucketNum, columns, parentSchemaName, parentTableName, indexes,
isImmutableRows, physicalTables, defaultFamilyName,
    -                viewStatement, disableWAL, multiTenant, storeNulls, viewType, viewIndexId,
indexType,
    +                viewStatement, disableWAL, multiTenant, storeNulls, viewType, viewIndexType,
viewIndexId, indexType,
                     rowKeyOrderOptimizable, transactionProvider, updateCacheFrequency, baseColumnCount,
                     indexDisableTimestamp, isNamespaceMapped, autoPartitionSeq, isAppendOnlySchema,
storageScheme, encodingScheme, cqCounter, useStatsForParallelization);
         }
    +    private Long getViewIndexId(Cell[] tableKeyValues, PDataType viewIndexType) {
    +        Cell viewIndexIdKv = tableKeyValues[VIEW_INDEX_ID_INDEX];
    +        return viewIndexIdKv == null ? null :
    +                decodeViewIndexId(viewIndexIdKv, viewIndexType);
    +    }
     
    +    /**
    +     * check the value for {@value USE_LONG_VIEW_INDEX} and if its present consider viewIndexId
as long otherwise
    +     * read as short and convert it to long
    +     *
    +     * @param tableKeyValues
    +     * @param viewIndexType
    +     * @return
    +     */
    +    private Long decodeViewIndexId(Cell viewIndexIdKv,  PDataType viewIndexType) {
    +        boolean useLongViewIndex = MetaDataUtil.getViewIndexIdDataType().equals(viewIndexType);
    +		return new Long(
    +				useLongViewIndex
    +						? viewIndexType.getCodec().decodeLong(viewIndexIdKv.getValueArray(),
    +						viewIndexIdKv.getValueOffset(), SortOrder.getDefault())
    +						: MetaDataUtil.getLegacyViewIndexIdDataType().getCodec().decodeShort(viewIndexIdKv.getValueArray(),
    +						viewIndexIdKv.getValueOffset(), SortOrder.getDefault())
    +		);
    +    }
    +
    +    private PDataType getViewIndexType(Cell[] tableKeyValues) {
    +        Cell useLongViewIndexKv = tableKeyValues[USE_LONG_VIEW_INDEX];
    --- End diff --
    
    For existing tables the VIEW_INDEX_ID  column will store the index as a short while for
new tables the value will be stored as a long. 
    Would it be cleaner to create a new column that stores the view index id as a long. In
QueryServicesConnectionImpl.upgradeSystemTables()  we would set the new column based on the
existing value. Finally we can remove the existing VIEW_INDEX_ID in the next release. 
    WDYT @JamesRTaylor ?
    
    
    



---

Mime
View raw message