phoenix-dev mailing list archives

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

    https://github.com/apache/phoenix/pull/317#discussion_r206326382
  
    --- 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 --
    
    I think we need to keep the single VIEW_INDEX_ID column and make sure it's type is defined
(through a property) at create time (and not allow it to be changed). The issue isn't with
the metadata, but with the row key of the rows of the table. In old tables, it'll be a short
while for new tables it'll be a long. We don't want to have to rewrite the data.


---

Mime
View raw message