Repository: phoenix Updated Branches: refs/heads/master 303fff094 -> 466ea28be
http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java index 938ae1f..4a3b43f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/PTableProtos.java @@ -3695,15 +3695,15 @@ public final class PTableProtos { */ int getTransactionProvider(); - // optional int32 viewIndexType = 39 [default = 5]; + // optional int32 viewIndexIdType = 39 [default = 5]; /** - * <code>optional int32 viewIndexType = 39 [default = 5];</code> + * <code>optional int32 viewIndexIdType = 39 [default = 5];</code> */ - boolean hasViewIndexType(); + boolean hasViewIndexIdType(); /** - * <code>optional int32 viewIndexType = 39 [default = 5];</code> + * <code>optional int32 viewIndexIdType = 39 [default = 5];</code> */ - int getViewIndexType(); + int getViewIndexIdType(); } /** * Protobuf type {@code PTable} @@ -3962,7 +3962,7 @@ public final class PTableProtos { } case 312: { bitField1_ |= 0x00000002; - viewIndexType_ = input.readInt32(); + viewIndexIdType_ = input.readInt32(); break; } } @@ -4745,20 +4745,20 @@ public final class PTableProtos { return transactionProvider_; } - // optional int32 viewIndexType = 39 [default = 5]; - public static final int VIEWINDEXTYPE_FIELD_NUMBER = 39; - private int viewIndexType_; + // optional int32 viewIndexIdType = 39 [default = 5]; + public static final int VIEWINDEXIDTYPE_FIELD_NUMBER = 39; + private int viewIndexIdType_; /** - * <code>optional int32 viewIndexType = 39 [default = 5];</code> + * <code>optional int32 viewIndexIdType = 39 [default = 5];</code> */ - public boolean hasViewIndexType() { + public boolean hasViewIndexIdType() { return ((bitField1_ & 0x00000002) == 0x00000002); } /** - * <code>optional int32 viewIndexType = 39 [default = 5];</code> + * <code>optional int32 viewIndexIdType = 39 [default = 5];</code> */ - public int getViewIndexType() { - return viewIndexType_; + public int getViewIndexIdType() { + return viewIndexIdType_; } private void initFields() { @@ -4799,7 +4799,7 @@ public final class PTableProtos { encodedCQCounters_ = java.util.Collections.emptyList(); useStatsForParallelization_ = false; transactionProvider_ = 0; - viewIndexType_ = 5; + viewIndexIdType_ = 5; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -4979,7 +4979,7 @@ public final class PTableProtos { output.writeInt32(38, transactionProvider_); } if (((bitField1_ & 0x00000002) == 0x00000002)) { - output.writeInt32(39, viewIndexType_); + output.writeInt32(39, viewIndexIdType_); } getUnknownFields().writeTo(output); } @@ -5145,7 +5145,7 @@ public final class PTableProtos { } if (((bitField1_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(39, viewIndexType_); + .computeInt32Size(39, viewIndexIdType_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -5343,10 +5343,10 @@ public final class PTableProtos { result = result && (getTransactionProvider() == other.getTransactionProvider()); } - result = result && (hasViewIndexType() == other.hasViewIndexType()); - if (hasViewIndexType()) { - result = result && (getViewIndexType() - == other.getViewIndexType()); + result = result && (hasViewIndexIdType() == other.hasViewIndexIdType()); + if (hasViewIndexIdType()) { + result = result && (getViewIndexIdType() + == other.getViewIndexIdType()); } result = result && getUnknownFields().equals(other.getUnknownFields()); @@ -5509,9 +5509,9 @@ public final class PTableProtos { hash = (37 * hash) + TRANSACTIONPROVIDER_FIELD_NUMBER; hash = (53 * hash) + getTransactionProvider(); } - if (hasViewIndexType()) { - hash = (37 * hash) + VIEWINDEXTYPE_FIELD_NUMBER; - hash = (53 * hash) + getViewIndexType(); + if (hasViewIndexIdType()) { + hash = (37 * hash) + VIEWINDEXIDTYPE_FIELD_NUMBER; + hash = (53 * hash) + getViewIndexIdType(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; @@ -5711,7 +5711,7 @@ public final class PTableProtos { bitField1_ = (bitField1_ & ~0x00000008); transactionProvider_ = 0; bitField1_ = (bitField1_ & ~0x00000010); - viewIndexType_ = 5; + viewIndexIdType_ = 5; bitField1_ = (bitField1_ & ~0x00000020); return this; } @@ -5910,7 +5910,7 @@ public final class PTableProtos { if (((from_bitField1_ & 0x00000020) == 0x00000020)) { to_bitField1_ |= 0x00000002; } - result.viewIndexType_ = viewIndexType_; + result.viewIndexIdType_ = viewIndexIdType_; result.bitField0_ = to_bitField0_; result.bitField1_ = to_bitField1_; onBuilt(); @@ -6119,8 +6119,8 @@ public final class PTableProtos { if (other.hasTransactionProvider()) { setTransactionProvider(other.getTransactionProvider()); } - if (other.hasViewIndexType()) { - setViewIndexType(other.getViewIndexType()); + if (other.hasViewIndexIdType()) { + setViewIndexIdType(other.getViewIndexIdType()); } this.mergeUnknownFields(other.getUnknownFields()); return this; @@ -8234,35 +8234,35 @@ public final class PTableProtos { return this; } - // optional int32 viewIndexType = 39 [default = 5]; - private int viewIndexType_ = 5; + // optional int32 viewIndexIdType = 39 [default = 5]; + private int viewIndexIdType_ = 5; /** - * <code>optional int32 viewIndexType = 39 [default = 5];</code> + * <code>optional int32 viewIndexIdType = 39 [default = 5];</code> */ - public boolean hasViewIndexType() { + public boolean hasViewIndexIdType() { return ((bitField1_ & 0x00000020) == 0x00000020); } /** - * <code>optional int32 viewIndexType = 39 [default = 5];</code> + * <code>optional int32 viewIndexIdType = 39 [default = 5];</code> */ - public int getViewIndexType() { - return viewIndexType_; + public int getViewIndexIdType() { + return viewIndexIdType_; } /** - * <code>optional int32 viewIndexType = 39 [default = 5];</code> + * <code>optional int32 viewIndexIdType = 39 [default = 5];</code> */ - public Builder setViewIndexType(int value) { + public Builder setViewIndexIdType(int value) { bitField1_ |= 0x00000020; - viewIndexType_ = value; + viewIndexIdType_ = value; onChanged(); return this; } /** - * <code>optional int32 viewIndexType = 39 [default = 5];</code> + * <code>optional int32 viewIndexIdType = 39 [default = 5];</code> */ - public Builder clearViewIndexType() { + public Builder clearViewIndexIdType() { bitField1_ = (bitField1_ & ~0x00000020); - viewIndexType_ = 5; + viewIndexIdType_ = 5; onChanged(); return this; } @@ -8936,7 +8936,7 @@ public final class PTableProtos { "es\030\002 \003(\014\022\033\n\023guidePostsByteCount\030\003 \001(\003\022\025\n" + "\rkeyBytesCount\030\004 \001(\003\022\027\n\017guidePostsCount\030" + "\005 \001(\005\022!\n\013pGuidePosts\030\006 \001(\0132\014.PGuidePosts" + - "\"\307\007\n\006PTable\022\027\n\017schemaNameBytes\030\001 \002(\014\022\026\n\016" + + "\"\311\007\n\006PTable\022\027\n\017schemaNameBytes\030\001 \002(\014\022\026\n\016" + "tableNameBytes\030\002 \002(\014\022\036\n\ttableType\030\003 \002(\0162" + "\013.PTableType\022\022\n\nindexState\030\004 \001(\t\022\026\n\016sequ" + "enceNumber\030\005 \002(\003\022\021\n\ttimeStamp\030\006 \002(\003\022\023\n\013p" + @@ -8959,12 +8959,13 @@ public final class PTableProtos { "eme\030\" \001(\014\022\026\n\016encodingScheme\030# \001(\014\022,\n\021enc" + "odedCQCounters\030$ \003(\0132\021.EncodedCQCounter\022" + "\"\n\032useStatsForParallelization\030% \001(\010\022\033\n\023t" + - "ransactionProvider\030& \001(\005\022\030\n\rviewIndexTyp" + - "e\030\' \001(\005:\0015\"6\n\020EncodedCQCounter\022\021\n\tcolFam" + - "ily\030\001 \002(\t\022\017\n\007counter\030\002 \002(\005*A\n\nPTableType", - "\022\n\n\006SYSTEM\020\000\022\010\n\004USER\020\001\022\010\n\004VIEW\020\002\022\t\n\005INDE" + - "X\020\003\022\010\n\004JOIN\020\004B@\n(org.apache.phoenix.copr" + - "ocessor.generatedB\014PTableProtosH\001\210\001\001\240\001\001" + "ransactionProvider\030& \001(\005\022\032\n\017viewIndexIdT" + + "ype\030\' \001(\005:\0015\"6\n\020EncodedCQCounter\022\021\n\tcolF" + + "amily\030\001 \002(\t\022\017\n\007counter\030\002 \002(\005*A\n\nPTableTy", + "pe\022\n\n\006SYSTEM\020\000\022\010\n\004USER\020\001\022\010\n\004VIEW\020\002\022\t\n\005IN" + + "DEX\020\003\022\010\n\004JOIN\020\004B@\n(org.apache.phoenix.co" + + "processor.generatedB\014PTableProtosH\001\210\001\001\240\001" + + "\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -8988,7 +8989,7 @@ public final class PTableProtos { internal_static_PTable_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PTable_descriptor, - new java.lang.String[] { "SchemaNameBytes", "TableNameBytes", "TableType", "IndexState", "SequenceNumber", "TimeStamp", "PkNameBytes", "BucketNum", "Columns", "Indexes", "IsImmutableRows", "DataTableNameBytes", "DefaultFamilyName", "DisableWAL", "MultiTenant", "ViewType", "ViewStatement", "PhysicalNames", "TenantId", "ViewIndexId", "IndexType", "StatsTimeStamp", "StoreNulls", "BaseColumnCount", "RowKeyOrderOptimizable", "Transactional", "UpdateCacheFrequency", "IndexDisableTimestamp", "IsNamespaceMapped", "AutoParititonSeqName", "IsAppendOnlySchema", "ParentNameBytes", "StorageScheme", "EncodingScheme", "EncodedCQCounters", "UseStatsForParallelization", "TransactionProvider", "ViewIndexType", }); + new java.lang.String[] { "SchemaNameBytes", "TableNameBytes", "TableType", "IndexState", "SequenceNumber", "TimeStamp", "PkNameBytes", "BucketNum", "Columns", "Indexes", "IsImmutableRows", "DataTableNameBytes", "DefaultFamilyName", "DisableWAL", "MultiTenant", "ViewType", "ViewStatement", "PhysicalNames", "TenantId", "ViewIndexId", "IndexType", "StatsTimeStamp", "StoreNulls", "BaseColumnCount", "RowKeyOrderOptimizable", "Transactional", "UpdateCacheFrequency", "IndexDisableTimestamp", "IsNamespaceMapped", "AutoParititonSeqName", "IsAppendOnlySchema", "ParentNameBytes", "StorageScheme", "EncodingScheme", "EncodedCQCounters", "UseStatsForParallelization", "TransactionProvider", "ViewIndexIdType", }); internal_static_EncodedCQCounter_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_EncodedCQCounter_fieldAccessorTable = new http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java index c42b9df..138be15 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/generated/ServerCachingProtos.java @@ -2158,15 +2158,15 @@ public final class ServerCachingProtos { */ int getImmutableStorageScheme(); - // optional int32 viewIndexType = 22; + // optional int32 viewIndexIdType = 22; /** - * <code>optional int32 viewIndexType = 22;</code> + * <code>optional int32 viewIndexIdType = 22;</code> */ - boolean hasViewIndexType(); + boolean hasViewIndexIdType(); /** - * <code>optional int32 viewIndexType = 22;</code> + * <code>optional int32 viewIndexIdType = 22;</code> */ - int getViewIndexType(); + int getViewIndexIdType(); } /** * Protobuf type {@code IndexMaintainer} @@ -2362,7 +2362,7 @@ public final class ServerCachingProtos { } case 176: { bitField0_ |= 0x00010000; - viewIndexType_ = input.readInt32(); + viewIndexIdType_ = input.readInt32(); break; } } @@ -2849,20 +2849,20 @@ public final class ServerCachingProtos { return immutableStorageScheme_; } - // optional int32 viewIndexType = 22; - public static final int VIEWINDEXTYPE_FIELD_NUMBER = 22; - private int viewIndexType_; + // optional int32 viewIndexIdType = 22; + public static final int VIEWINDEXIDTYPE_FIELD_NUMBER = 22; + private int viewIndexIdType_; /** - * <code>optional int32 viewIndexType = 22;</code> + * <code>optional int32 viewIndexIdType = 22;</code> */ - public boolean hasViewIndexType() { + public boolean hasViewIndexIdType() { return ((bitField0_ & 0x00010000) == 0x00010000); } /** - * <code>optional int32 viewIndexType = 22;</code> + * <code>optional int32 viewIndexIdType = 22;</code> */ - public int getViewIndexType() { - return viewIndexType_; + public int getViewIndexIdType() { + return viewIndexIdType_; } private void initFields() { @@ -2887,7 +2887,7 @@ public final class ServerCachingProtos { indexedColumnInfo_ = java.util.Collections.emptyList(); encodingScheme_ = 0; immutableStorageScheme_ = 0; - viewIndexType_ = 0; + viewIndexIdType_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -3049,7 +3049,7 @@ public final class ServerCachingProtos { output.writeInt32(21, immutableStorageScheme_); } if (((bitField0_ & 0x00010000) == 0x00010000)) { - output.writeInt32(22, viewIndexType_); + output.writeInt32(22, viewIndexIdType_); } getUnknownFields().writeTo(output); } @@ -3151,7 +3151,7 @@ public final class ServerCachingProtos { } if (((bitField0_ & 0x00010000) == 0x00010000)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(22, viewIndexType_); + .computeInt32Size(22, viewIndexIdType_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -3266,10 +3266,10 @@ public final class ServerCachingProtos { result = result && (getImmutableStorageScheme() == other.getImmutableStorageScheme()); } - result = result && (hasViewIndexType() == other.hasViewIndexType()); - if (hasViewIndexType()) { - result = result && (getViewIndexType() - == other.getViewIndexType()); + result = result && (hasViewIndexIdType() == other.hasViewIndexIdType()); + if (hasViewIndexIdType()) { + result = result && (getViewIndexIdType() + == other.getViewIndexIdType()); } result = result && getUnknownFields().equals(other.getUnknownFields()); @@ -3368,9 +3368,9 @@ public final class ServerCachingProtos { hash = (37 * hash) + IMMUTABLESTORAGESCHEME_FIELD_NUMBER; hash = (53 * hash) + getImmutableStorageScheme(); } - if (hasViewIndexType()) { - hash = (37 * hash) + VIEWINDEXTYPE_FIELD_NUMBER; - hash = (53 * hash) + getViewIndexType(); + if (hasViewIndexIdType()) { + hash = (37 * hash) + VIEWINDEXIDTYPE_FIELD_NUMBER; + hash = (53 * hash) + getViewIndexIdType(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; @@ -3548,7 +3548,7 @@ public final class ServerCachingProtos { bitField0_ = (bitField0_ & ~0x00080000); immutableStorageScheme_ = 0; bitField0_ = (bitField0_ & ~0x00100000); - viewIndexType_ = 0; + viewIndexIdType_ = 0; bitField0_ = (bitField0_ & ~0x00200000); return this; } @@ -3690,7 +3690,7 @@ public final class ServerCachingProtos { if (((from_bitField0_ & 0x00200000) == 0x00200000)) { to_bitField0_ |= 0x00010000; } - result.viewIndexType_ = viewIndexType_; + result.viewIndexIdType_ = viewIndexIdType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -3869,8 +3869,8 @@ public final class ServerCachingProtos { if (other.hasImmutableStorageScheme()) { setImmutableStorageScheme(other.getImmutableStorageScheme()); } - if (other.hasViewIndexType()) { - setViewIndexType(other.getViewIndexType()); + if (other.hasViewIndexIdType()) { + setViewIndexIdType(other.getViewIndexIdType()); } this.mergeUnknownFields(other.getUnknownFields()); return this; @@ -5636,35 +5636,35 @@ public final class ServerCachingProtos { return this; } - // optional int32 viewIndexType = 22; - private int viewIndexType_ ; + // optional int32 viewIndexIdType = 22; + private int viewIndexIdType_ ; /** - * <code>optional int32 viewIndexType = 22;</code> + * <code>optional int32 viewIndexIdType = 22;</code> */ - public boolean hasViewIndexType() { + public boolean hasViewIndexIdType() { return ((bitField0_ & 0x00200000) == 0x00200000); } /** - * <code>optional int32 viewIndexType = 22;</code> + * <code>optional int32 viewIndexIdType = 22;</code> */ - public int getViewIndexType() { - return viewIndexType_; + public int getViewIndexIdType() { + return viewIndexIdType_; } /** - * <code>optional int32 viewIndexType = 22;</code> + * <code>optional int32 viewIndexIdType = 22;</code> */ - public Builder setViewIndexType(int value) { + public Builder setViewIndexIdType(int value) { bitField0_ |= 0x00200000; - viewIndexType_ = value; + viewIndexIdType_ = value; onChanged(); return this; } /** - * <code>optional int32 viewIndexType = 22;</code> + * <code>optional int32 viewIndexIdType = 22;</code> */ - public Builder clearViewIndexType() { + public Builder clearViewIndexIdType() { bitField0_ = (bitField0_ & ~0x00200000); - viewIndexType_ = 0; + viewIndexIdType_ = 0; onChanged(); return this; } @@ -8795,7 +8795,7 @@ public final class ServerCachingProtos { "ength\030\003 \002(\005\"4\n\017ColumnReference\022\016\n\006family" + "\030\001 \002(\014\022\021\n\tqualifier\030\002 \002(\014\"4\n\nColumnInfo\022" + "\022\n\nfamilyName\030\001 \001(\t\022\022\n\ncolumnName\030\002 \002(\t\"" + - "\335\005\n\017IndexMaintainer\022\023\n\013saltBuckets\030\001 \002(\005" + + "\337\005\n\017IndexMaintainer\022\023\n\013saltBuckets\030\001 \002(\005" + "\022\025\n\risMultiTenant\030\002 \002(\010\022\023\n\013viewIndexId\030\003" + " \001(\014\022(\n\016indexedColumns\030\004 \003(\0132\020.ColumnRef" + "erence\022 \n\030indexedColumnTypeOrdinal\030\005 \003(\005", @@ -8812,24 +8812,24 @@ public final class ServerCachingProtos { "ed\030\020 \002(\010\022\033\n\023indexRowKeyByteSize\030\021 \002(\005\022\021\n" + "\timmutable\030\022 \002(\010\022&\n\021indexedColumnInfo\030\023 " + "\003(\0132\013.ColumnInfo\022\026\n\016encodingScheme\030\024 \002(\005" + - "\022\036\n\026immutableStorageScheme\030\025 \002(\005\022\025\n\rview" + - "IndexType\030\026 \001(\005\"\370\001\n\025AddServerCacheReques" + - "t\022\020\n\010tenantId\030\001 \001(\014\022\017\n\007cacheId\030\002 \002(\014\022)\n\010" + - "cachePtr\030\003 \002(\0132\027.ImmutableBytesWritable\022" + - ")\n\014cacheFactory\030\004 \002(\0132\023.ServerCacheFacto" + - "ry\022\017\n\007txState\030\005 \001(\014\022\"\n\032hasProtoBufIndexM" + - "aintainer\030\006 \001(\010\022\025\n\rclientVersion\030\007 \001(\005\022\032", - "\n\022usePersistentCache\030\010 \001(\010\"(\n\026AddServerC" + - "acheResponse\022\016\n\006return\030\001 \002(\010\"=\n\030RemoveSe" + - "rverCacheRequest\022\020\n\010tenantId\030\001 \001(\014\022\017\n\007ca" + - "cheId\030\002 \002(\014\"+\n\031RemoveServerCacheResponse" + - "\022\016\n\006return\030\001 \002(\0102\245\001\n\024ServerCachingServic" + - "e\022A\n\016addServerCache\022\026.AddServerCacheRequ" + - "est\032\027.AddServerCacheResponse\022J\n\021removeSe" + - "rverCache\022\031.RemoveServerCacheRequest\032\032.R" + - "emoveServerCacheResponseBG\n(org.apache.p" + - "hoenix.coprocessor.generatedB\023ServerCach", - "ingProtosH\001\210\001\001\240\001\001" + "\022\036\n\026immutableStorageScheme\030\025 \002(\005\022\027\n\017view" + + "IndexIdType\030\026 \001(\005\"\370\001\n\025AddServerCacheRequ" + + "est\022\020\n\010tenantId\030\001 \001(\014\022\017\n\007cacheId\030\002 \002(\014\022)" + + "\n\010cachePtr\030\003 \002(\0132\027.ImmutableBytesWritabl" + + "e\022)\n\014cacheFactory\030\004 \002(\0132\023.ServerCacheFac" + + "tory\022\017\n\007txState\030\005 \001(\014\022\"\n\032hasProtoBufInde" + + "xMaintainer\030\006 \001(\010\022\025\n\rclientVersion\030\007 \001(\005", + "\022\032\n\022usePersistentCache\030\010 \001(\010\"(\n\026AddServe" + + "rCacheResponse\022\016\n\006return\030\001 \002(\010\"=\n\030Remove" + + "ServerCacheRequest\022\020\n\010tenantId\030\001 \001(\014\022\017\n\007" + + "cacheId\030\002 \002(\014\"+\n\031RemoveServerCacheRespon" + + "se\022\016\n\006return\030\001 \002(\0102\245\001\n\024ServerCachingServ" + + "ice\022A\n\016addServerCache\022\026.AddServerCacheRe" + + "quest\032\027.AddServerCacheResponse\022J\n\021remove" + + "ServerCache\022\031.RemoveServerCacheRequest\032\032" + + ".RemoveServerCacheResponseBG\n(org.apache" + + ".phoenix.coprocessor.generatedB\023ServerCa", + "chingProtosH\001\210\001\001\240\001\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -8859,7 +8859,7 @@ public final class ServerCachingProtos { internal_static_IndexMaintainer_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_IndexMaintainer_descriptor, - new java.lang.String[] { "SaltBuckets", "IsMultiTenant", "ViewIndexId", "IndexedColumns", "IndexedColumnTypeOrdinal", "DataTableColRefForCoveredColumns", "IndexTableColRefForCoveredColumns", "IsLocalIndex", "IndexTableName", "RowKeyOrderOptimizable", "DataTableEmptyKeyValueColFamily", "EmptyKeyValueColFamily", "IndexedExpressions", "RowKeyMetadata", "NumDataTableColFamilies", "IndexWalDisabled", "IndexRowKeyByteSize", "Immutable", "IndexedColumnInfo", "EncodingScheme", "ImmutableStorageScheme", "ViewIndexType", }); + new java.lang.String[] { "SaltBuckets", "IsMultiTenant", "ViewIndexId", "IndexedColumns", "IndexedColumnTypeOrdinal", "DataTableColRefForCoveredColumns", "IndexTableColRefForCoveredColumns", "IsLocalIndex", "IndexTableName", "RowKeyOrderOptimizable", "DataTableEmptyKeyValueColFamily", "EmptyKeyValueColFamily", "IndexedExpressions", "RowKeyMetadata", "NumDataTableColFamilies", "IndexWalDisabled", "IndexRowKeyByteSize", "Immutable", "IndexedColumnInfo", "EncodingScheme", "ImmutableStorageScheme", "ViewIndexIdType", }); internal_static_AddServerCacheRequest_descriptor = getDescriptor().getMessageTypes().get(4); internal_static_AddServerCacheRequest_fieldAccessorTable = new http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java index ffbf98f..3576c55 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java @@ -318,7 +318,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> { } private byte[] viewIndexId; - private PDataType viewIndexType; + private PDataType viewIndexIdType; private boolean isMultiTenant; // indexed expressions that are not present in the row key of the data table, the expression can also refer to a regular column private List<Expression> indexedExpressions; @@ -376,8 +376,8 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> { this(dataTable.getRowKeySchema(), dataTable.getBucketNum() != null); this.rowKeyOrderOptimizable = index.rowKeyOrderOptimizable(); this.isMultiTenant = dataTable.isMultiTenant(); - this.viewIndexId = index.getViewIndexId() == null ? null : index.getViewIndexType().toBytes(index.getViewIndexId()); - this.viewIndexType = index.getViewIndexType(); + this.viewIndexId = index.getViewIndexId() == null ? null : index.getviewIndexIdType().toBytes(index.getViewIndexId()); + this.viewIndexIdType = index.getviewIndexIdType(); this.isLocalIndex = index.getIndexType() == IndexType.LOCAL; this.encodingScheme = index.getEncodingScheme(); @@ -829,7 +829,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> { @Override public PDataType getDataType() { - return viewIndexType; + return viewIndexIdType; } @Override @@ -1231,7 +1231,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> { // Fixed length //Use legacy viewIndexIdType for clients older than 4.10 release viewIndexId = new byte[MetaDataUtil.getLegacyViewIndexIdDataType().getByteSize()]; - viewIndexType = MetaDataUtil.getLegacyViewIndexIdDataType(); + viewIndexIdType = MetaDataUtil.getLegacyViewIndexIdDataType(); input.readFully(viewIndexId); } int nIndexedColumns = Math.abs(encodedIndexedColumnsAndViewId) - 1; @@ -1348,8 +1348,8 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> { maintainer.nIndexSaltBuckets = proto.getSaltBuckets(); maintainer.isMultiTenant = proto.getIsMultiTenant(); maintainer.viewIndexId = proto.hasViewIndexId() ? proto.getViewIndexId().toByteArray() : null; - maintainer.viewIndexType = proto.hasViewIndexType() - ? PDataType.fromTypeId(proto.getViewIndexType()) + maintainer.viewIndexIdType = proto.hasViewIndexIdType() + ? PDataType.fromTypeId(proto.getViewIndexIdType()) : MetaDataUtil.getLegacyViewIndexIdDataType(); List<ServerCachingProtos.ColumnReference> indexedColumnsList = proto.getIndexedColumnsList(); maintainer.indexedColumns = new HashSet<ColumnReference>(indexedColumnsList.size()); @@ -1470,7 +1470,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> { builder.setIsMultiTenant(maintainer.isMultiTenant); if (maintainer.viewIndexId != null) { builder.setViewIndexId(ByteStringer.wrap(maintainer.viewIndexId)); - builder.setViewIndexType(maintainer.viewIndexType.getSqlType()); + builder.setViewIndexIdType(maintainer.viewIndexIdType.getSqlType()); } for (ColumnReference colRef : maintainer.indexedColumns) { ServerCachingProtos.ColumnReference.Builder cRefBuilder = ServerCachingProtos.ColumnReference.newBuilder(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java index 18c0d47..e1df403 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java @@ -318,7 +318,7 @@ public class PhoenixIndexFailurePolicy extends DelegateIndexFailurePolicy { new HashMap<ImmutableBytesWritable, String>(); for (PTable index : indexes) { if (localIndex == null) localIndex = index; - localIndexNames.put(new ImmutableBytesWritable(index.getViewIndexType().toBytes( + localIndexNames.put(new ImmutableBytesWritable(index.getviewIndexIdType().toBytes( index.getViewIndexId())), index.getName().getString()); } if (localIndex == null) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java index bf2bc59..34a973f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/DelegateTable.java @@ -218,8 +218,8 @@ public class DelegateTable implements PTable { } @Override - public PDataType getViewIndexType() { - return delegate.getViewIndexType(); + public PDataType getviewIndexIdType() { + return delegate.getviewIndexIdType(); } @Override @@ -332,4 +332,12 @@ public class DelegateTable implements PTable { public Boolean useStatsForParallelization() { return delegate.useStatsForParallelization(); } + + @Override public boolean hasViewModifiedUpdateCacheFrequency() { + return delegate.hasViewModifiedUpdateCacheFrequency(); + } + + @Override public boolean hasViewModifiedUseStatsForParallelization() { + return delegate.hasViewModifiedUseStatsForParallelization(); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 0851179..74f8830 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -98,6 +98,7 @@ import static org.apache.phoenix.query.QueryConstants.ENCODED_CQ_COUNTER_INITIAL import static org.apache.phoenix.query.QueryServices.DROP_METADATA_ATTRIB; import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_DROP_METADATA; import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_RUN_UPDATE_STATS_ASYNC; +import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.schema.PTable.EncodedCQCounter.NULL_COUNTER; import static org.apache.phoenix.schema.PTable.ImmutableStorageScheme.ONE_CELL_PER_COLUMN; import static org.apache.phoenix.schema.PTable.ImmutableStorageScheme.SINGLE_CELL_ARRAY_WITH_OFFSETS; @@ -1077,7 +1078,7 @@ public class MetaDataClient { } } - public MutationState createTable(CreateTableStatement statement, byte[][] splits, PTable parent, String viewStatement, ViewType viewType, PDataType viewIndexType, byte[][] viewColumnConstants, BitSet isViewColumnReferenced) throws SQLException { + public MutationState createTable(CreateTableStatement statement, byte[][] splits, PTable parent, String viewStatement, ViewType viewType, PDataType viewIndexIdType, byte[][] viewColumnConstants, BitSet isViewColumnReferenced) throws SQLException { TableName tableName = statement.getTableName(); Map<String,Object> tableProps = Maps.newHashMapWithExpectedSize(statement.getProps().size()); Map<String,Object> commonFamilyProps = Maps.newHashMapWithExpectedSize(statement.getProps().size() + 1); @@ -1086,19 +1087,20 @@ public class MetaDataClient { boolean isAppendOnlySchema = false; long updateCacheFrequency = connection.getQueryServices().getProps().getLong( QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, QueryServicesOptions.DEFAULT_UPDATE_CACHE_FREQUENCY); + Long updateCacheFrequencyProp = (Long) TableProperty.UPDATE_CACHE_FREQUENCY.getValue(tableProps); if (parent==null) { Boolean appendOnlySchemaProp = (Boolean) TableProperty.APPEND_ONLY_SCHEMA.getValue(tableProps); if (appendOnlySchemaProp != null) { isAppendOnlySchema = appendOnlySchemaProp; } - Long updateCacheFrequencyProp = (Long) TableProperty.UPDATE_CACHE_FREQUENCY.getValue(tableProps); if (updateCacheFrequencyProp != null) { updateCacheFrequency = updateCacheFrequencyProp; } } else { isAppendOnlySchema = parent.isAppendOnlySchema(); - updateCacheFrequency = parent.getUpdateCacheFrequency(); + updateCacheFrequency = (updateCacheFrequencyProp != null) ? + updateCacheFrequencyProp : parent.getUpdateCacheFrequency(); } // updateCacheFrequency cannot be set to ALWAYS if isAppendOnlySchema is true if (isAppendOnlySchema && updateCacheFrequency==0) { @@ -1138,7 +1140,7 @@ public class MetaDataClient { true, NamedTableNode.create(statement.getTableName()), statement.getTableType()); } } - table = createTableInternal(statement, splits, parent, viewStatement, viewType, viewIndexType, viewColumnConstants, isViewColumnReferenced, false, null, null, tableProps, commonFamilyProps); + table = createTableInternal(statement, splits, parent, viewStatement, viewType, viewIndexIdType, viewColumnConstants, isViewColumnReferenced, false, null, null, tableProps, commonFamilyProps); if (table == null || table.getType() == PTableType.VIEW /*|| table.isTransactional()*/) { return new MutationState(0, 0, connection); @@ -1986,7 +1988,7 @@ public class MetaDataClient { } private PTable createTableInternal(CreateTableStatement statement, byte[][] splits, - final PTable parent, String viewStatement, ViewType viewType, PDataType viewIndexType, + final PTable parent, String viewStatement, ViewType viewType, PDataType viewIndexIdType, final byte[][] viewColumnConstants, final BitSet isViewColumnReferenced, boolean allocateIndexId, IndexType indexType, Date asyncCreatedDate, Map<String,Object> tableProps, @@ -2680,7 +2682,7 @@ public class MetaDataClient { .setDisableWAL(Boolean.TRUE.equals(disableWAL)) .setMultiTenant(false) .setStoreNulls(false) - .setViewIndexType(viewIndexType) + .setViewIndexIdType(viewIndexIdType) .setIndexType(indexType) .setUpdateCacheFrequency(0) .setNamespaceMapped(isNamespaceMapped) @@ -2999,7 +3001,7 @@ public class MetaDataClient { .setMultiTenant(multiTenant) .setStoreNulls(storeNulls) .setViewType(viewType) - .setViewIndexType(viewIndexType) + .setViewIndexIdType(viewIndexIdType) .setViewIndexId(result.getViewIndexId()) .setIndexType(indexType) .setTransactionProvider(transactionProvider) @@ -3029,6 +3031,13 @@ public class MetaDataClient { .setPhysicalNames(physicalNames == null ? ImmutableList.of() : ImmutableList.copyOf(physicalNames)) .setColumns(columns.values()) + .setViewModifiedUpdateCacheFrequency(tableType == PTableType.VIEW && + parent != null && + parent.getUpdateCacheFrequency() != updateCacheFrequency) + .setViewModifiedUseStatsForParallelization(tableType == PTableType.VIEW && + parent != null && + parent.useStatsForParallelization() + != useStatsForParallelizationProp) .build(); result = new MetaDataMutationResult(code, result.getMutationTime(), table, true); addTableToCache(result); @@ -4177,7 +4186,7 @@ public class MetaDataClient { .setType(PTableType.INDEX) .setTimeStamp(ts) .setMultiTenant(table.isMultiTenant()) - .setViewIndexType(sharedTableState.getViewIndexType()) + .setViewIndexIdType(sharedTableState.getViewIndexIdType()) .setViewIndexId(sharedTableState.getViewIndexId()) .setNamespaceMapped(table.isNamespaceMapped()) .setAppendOnlySchema(false) http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java index 6dfe411..3e22225 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java @@ -736,7 +736,7 @@ public interface PTable extends PMetaDataEntity { ViewType getViewType(); String getViewStatement(); Long getViewIndexId(); - PDataType getViewIndexType(); + PDataType getviewIndexIdType(); PTableKey getKey(); IndexType getIndexType(); @@ -774,7 +774,9 @@ public interface PTable extends PMetaDataEntity { QualifierEncodingScheme getEncodingScheme(); EncodedCQCounter getEncodedCQCounter(); Boolean useStatsForParallelization(); - + boolean hasViewModifiedUpdateCacheFrequency(); + boolean hasViewModifiedUseStatsForParallelization(); + /** * Class to help track encoded column qualifier counters per column family. */ http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java index ab19a99..6143bac 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java @@ -26,6 +26,7 @@ import java.sql.DriverManager; import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; +import java.util.BitSet; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -101,6 +102,8 @@ import com.google.common.collect.Maps; */ public class PTableImpl implements PTable { private static final Integer NO_SALTING = -1; + private static final int VIEW_MODIFIED_UPDATE_CACHE_FREQUENCY_BIT_SET_POS = 0; + private static final int VIEW_MODIFIED_USE_STATS_FOR_PARALLELIZATION_BIT_SET_POS = 1; private IndexMaintainer indexMaintainer; private ImmutableBytesWritable indexMaintainersPtr; @@ -143,7 +146,7 @@ public class PTableImpl implements PTable { private final boolean storeNulls; private final TransactionFactory.Provider transactionProvider; private final ViewType viewType; - private final PDataType viewIndexType; + private final PDataType viewIndexIdType; private final Long viewIndexId; private final int estimatedSize; private final IndexType indexType; @@ -159,6 +162,7 @@ public class PTableImpl implements PTable { private final QualifierEncodingScheme qualifierEncodingScheme; private final EncodedCQCounter encodedCQCounter; private final Boolean useStatsForParallelization; + private final BitSet viewModifiedPropSet; public static class Builder { private PTableKey key; @@ -197,7 +201,7 @@ public class PTableImpl implements PTable { private boolean storeNulls; private TransactionFactory.Provider transactionProvider; private ViewType viewType; - private PDataType viewIndexType; + private PDataType viewIndexIdType; private Long viewIndexId; private int estimatedSize; private IndexType indexType; @@ -213,6 +217,8 @@ public class PTableImpl implements PTable { private QualifierEncodingScheme qualifierEncodingScheme; private EncodedCQCounter encodedCQCounter; private Boolean useStatsForParallelization; + // Used to denote which properties a view has explicitly modified + private BitSet viewModifiedPropSet = new BitSet(2); // Optionally set columns for the builder, but not for the actual PTable private Collection<PColumn> columns; @@ -407,8 +413,8 @@ public class PTableImpl implements PTable { return this; } - public Builder setViewIndexType(PDataType viewIndexType) { - this.viewIndexType = viewIndexType; + public Builder setViewIndexIdType(PDataType viewIndexIdType) { + this.viewIndexIdType = viewIndexIdType; return this; } @@ -487,6 +493,18 @@ public class PTableImpl implements PTable { return this; } + public Builder setViewModifiedUpdateCacheFrequency(boolean modified) { + this.viewModifiedPropSet.set(VIEW_MODIFIED_UPDATE_CACHE_FREQUENCY_BIT_SET_POS, + modified); + return this; + } + + public Builder setViewModifiedUseStatsForParallelization(boolean modified) { + this.viewModifiedPropSet.set(VIEW_MODIFIED_USE_STATS_FOR_PARALLELIZATION_BIT_SET_POS, + modified); + return this; + } + /** * Note: When set in the builder, we must call {@link Builder#initDerivedAttributes()} * before building the PTable in order to correctly populate other attributes of the PTable @@ -741,7 +759,7 @@ public class PTableImpl implements PTable { this.storeNulls = builder.storeNulls; this.transactionProvider = builder.transactionProvider; this.viewType = builder.viewType; - this.viewIndexType = builder.viewIndexType; + this.viewIndexIdType = builder.viewIndexIdType; this.viewIndexId = builder.viewIndexId; this.estimatedSize = builder.estimatedSize; this.indexType = builder.indexType; @@ -757,6 +775,7 @@ public class PTableImpl implements PTable { this.qualifierEncodingScheme = builder.qualifierEncodingScheme; this.encodedCQCounter = builder.encodedCQCounter; this.useStatsForParallelization = builder.useStatsForParallelization; + this.viewModifiedPropSet = builder.viewModifiedPropSet; } // When cloning table, ignore the salt column as it will be added back in the constructor @@ -791,7 +810,7 @@ public class PTableImpl implements PTable { .setMultiTenant(table.isMultiTenant()) .setStoreNulls(table.getStoreNulls()) .setViewType(table.getViewType()) - .setViewIndexType(table.getViewIndexType()) + .setViewIndexIdType(table.getviewIndexIdType()) .setViewIndexId(table.getViewIndexId()) .setIndexType(table.getIndexType()) .setTransactionProvider(table.getTransactionProvider()) @@ -820,7 +839,10 @@ public class PTableImpl implements PTable { .setParentSchemaName(table.getParentSchemaName()) .setParentTableName(table.getParentTableName()) .setPhysicalNames(table.getPhysicalNames() == null ? - ImmutableList.of() : ImmutableList.copyOf(table.getPhysicalNames())); + ImmutableList.of() : ImmutableList.copyOf(table.getPhysicalNames())) + .setViewModifiedUseStatsForParallelization(table + .hasViewModifiedUseStatsForParallelization()) + .setViewModifiedUpdateCacheFrequency(table.hasViewModifiedUpdateCacheFrequency()); } @Override @@ -1440,8 +1462,8 @@ public class PTableImpl implements PTable { } @Override - public PDataType getViewIndexType() { - return viewIndexType; + public PDataType getviewIndexIdType() { + return viewIndexIdType; } @Override @@ -1476,8 +1498,8 @@ public class PTableImpl implements PTable { if (table.hasViewIndexId()) { viewIndexId = table.getViewIndexId(); } - PDataType viewIndexType = table.hasViewIndexType() - ? PDataType.fromTypeId(table.getViewIndexType()) + PDataType viewIndexIdType = table.hasViewIndexIdType() + ? PDataType.fromTypeId(table.getViewIndexIdType()) : MetaDataUtil.getLegacyViewIndexIdDataType(); IndexType indexType = IndexType.getDefault(); if(table.hasIndexType()){ @@ -1600,7 +1622,7 @@ public class PTableImpl implements PTable { .setMultiTenant(multiTenant) .setStoreNulls(storeNulls) .setViewType(viewType) - .setViewIndexType(viewIndexType) + .setViewIndexIdType(viewIndexIdType) .setViewIndexId(viewIndexId) .setIndexType(indexType) .setTransactionProvider(transactionProvider) @@ -1651,7 +1673,7 @@ public class PTableImpl implements PTable { } if(table.getViewIndexId() != null) { builder.setViewIndexId(table.getViewIndexId()); - builder.setViewIndexType(table.getViewIndexType().getSqlType()); + builder.setViewIndexIdType(table.getviewIndexIdType().getSqlType()); } if(table.getIndexType() != null) { builder.setIndexType(ByteStringer.wrap(new byte[]{table.getIndexType().getSerializedValue()})); @@ -1831,6 +1853,14 @@ public class PTableImpl implements PTable { return useStatsForParallelization; } + @Override public boolean hasViewModifiedUpdateCacheFrequency() { + return viewModifiedPropSet.get(VIEW_MODIFIED_UPDATE_CACHE_FREQUENCY_BIT_SET_POS); + } + + @Override public boolean hasViewModifiedUseStatsForParallelization() { + return viewModifiedPropSet.get(VIEW_MODIFIED_USE_STATS_FOR_PARALLELIZATION_BIT_SET_POS); + } + private static final class KVColumnFamilyQualifier { @Nonnull private final String colFamilyName; http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java index 472fe48..a35409f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java @@ -32,10 +32,14 @@ import java.util.NavigableMap; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.CellUtil; +import org.apache.hadoop.hbase.ExtendedCell; +import org.apache.hadoop.hbase.ExtendedCellBuilder; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.TagUtil; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; @@ -53,6 +57,7 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminServic import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.ipc.RemoteException; import org.apache.phoenix.coprocessor.MetaDataProtocol; +import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder; import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr; import org.apache.phoenix.hbase.index.util.IndexManagementUtil; import org.apache.phoenix.hbase.index.util.KeyValueBuilder; @@ -244,7 +249,7 @@ public class MetaDataUtil { Cell replacementCell = new KeyValue(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength(), cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength(), cell.getTimestamp(), - KeyValue.Type.codeToType(cell.getTypeByte()), newValue, 0, newValue.length); + KeyValue.Type.codeToType(cell.getType().getCode()), newValue, 0, newValue.length); newCells.add(replacementCell); } else { newCells.add(cell); @@ -254,6 +259,51 @@ public class MetaDataUtil { } } + /** + * Iterates over the cells that are mutated by the put operation for the given column family and + * column qualifier and conditionally modifies those cells to add a tags list. We only add tags + * if the cell value does not match the passed valueArray. If we always want to add tags to + * these cells, we can pass in a null valueArray + * @param somePut Put operation + * @param family column family of the cells + * @param qualifier column qualifier of the cells + * @param cellBuilder ExtendedCellBuilder object + * @param valueArray byte array of values or null + * @param tagArray byte array of tags to add to the cells + */ + public static void conditionallyAddTagsToPutCells(Put somePut, byte[] family, byte[] qualifier, + ExtendedCellBuilder cellBuilder, byte[] valueArray, byte[] tagArray) { + NavigableMap<byte[], List<Cell>> familyCellMap = somePut.getFamilyCellMap(); + List<Cell> cells = familyCellMap.get(family); + List<Cell> newCells = Lists.newArrayList(); + if (cells != null) { + for (Cell cell : cells) { + if (Bytes.compareTo(cell.getQualifierArray(), cell.getQualifierOffset(), + cell.getQualifierLength(), qualifier, 0, qualifier.length) == 0 && + (valueArray == null || !CellUtil.matchingValue(cell, valueArray))) { + ExtendedCell extendedCell = cellBuilder + .setRow(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()) + .setFamily(cell.getFamilyArray(), cell.getFamilyOffset(), + cell.getFamilyLength()) + .setQualifier(cell.getQualifierArray(), cell.getQualifierOffset(), + cell.getQualifierLength()) + .setValue(cell.getValueArray(), cell.getValueOffset(), + cell.getValueLength()) + .setTimestamp(cell.getTimestamp()) + .setType(cell.getType()) + .setTags(TagUtil.concatTags(tagArray, cell)) + .build(); + // Replace existing cell with a cell that has the custom tags list + newCells.add(extendedCell); + } else { + // Add cell as is + newCells.add(cell); + } + } + familyCellMap.put(family, newCells); + } + } + public static Put cloneDeleteToPutAndAddColumn(Delete delete, byte[] family, byte[] qualifier, byte[] value) { NavigableMap<byte[], List<Cell>> familyCellMap = delete.getFamilyCellMap(); List<Cell> cells = familyCellMap.get(family); @@ -353,7 +403,7 @@ public class MetaDataUtil { } return 0; } - + public static long getParentSequenceNumber(List<Mutation> tableMetaData) { return getSequenceNumber(getParentTableHeaderRow(tableMetaData)); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java b/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java index 485a21f..783417d 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/util/MetaDataUtilTest.java @@ -19,11 +19,15 @@ package org.apache.phoenix.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.ExtendedCell; +import org.apache.hadoop.hbase.ExtendedCellBuilder; import org.apache.hadoop.hbase.KeyValue; +import org.apache.hadoop.hbase.TagUtil; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.VersionInfo; @@ -32,14 +36,45 @@ import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder; import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr; import org.apache.phoenix.hbase.index.util.KeyValueBuilder; import org.apache.phoenix.hbase.index.util.VersionUtil; -import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.HBaseFactoryProvider; import org.apache.phoenix.query.QueryServices; +import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.apache.hadoop.hbase.HConstants.EMPTY_BYTE_ARRAY; +import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES; public class MetaDataUtilTest { + private static final byte[] ROW = Bytes.toBytes("row"); + private static final byte[] QUALIFIER = Bytes.toBytes("qual"); + private static final byte[] ORIGINAL_VALUE = Bytes.toBytes("generic-value"); + private static final byte[] DUMMY_TAGS = Bytes.toBytes("tags"); + private final ExtendedCellBuilder mockBuilder = Mockito.mock(ExtendedCellBuilder.class); + private final ExtendedCell mockCellWithTags = Mockito.mock(ExtendedCell.class); + + @Before + public void setupMockCellBuilder() { + Mockito.when(mockBuilder.setRow(Mockito.any(byte[].class), Mockito.anyInt(), + Mockito.anyInt())).thenReturn(mockBuilder); + Mockito.when(mockBuilder.setFamily(Mockito.any(byte[].class), Mockito.anyInt(), + Mockito.anyInt())).thenReturn(mockBuilder); + Mockito.when(mockBuilder.setQualifier(Mockito.any(byte[].class), Mockito.anyInt(), + Mockito.anyInt())).thenReturn(mockBuilder); + Mockito.when(mockBuilder.setValue(Mockito.any(byte[].class), Mockito.anyInt(), + Mockito.anyInt())).thenReturn(mockBuilder); + Mockito.when(mockBuilder.setTimestamp(Mockito.anyLong())).thenReturn(mockBuilder); + Mockito.when(mockBuilder.setType(Mockito.any(Cell.Type.class))) + .thenReturn(mockBuilder); + Mockito.when(mockBuilder.setTags(Mockito.any(byte[].class))) + .thenReturn(mockBuilder); + Mockito.when(mockBuilder.build()).thenReturn(mockCellWithTags); + } + @Test public void testEncode() { assertEquals(VersionUtil.encodeVersion("0.94.5"),VersionUtil.encodeVersion("0.94.5-mapR")); @@ -65,21 +100,67 @@ public class MetaDataUtilTest { @Test public void testMutatingAPut() throws Exception { - String version = VersionInfo.getVersion(); - KeyValueBuilder builder = KeyValueBuilder.get(version); - byte[] row = Bytes.toBytes("row"); - byte[] family = PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES; - byte[] qualifier = Bytes.toBytes("qual"); - byte[] value = Bytes.toBytes("generic-value"); - KeyValue kv = builder.buildPut(wrap(row), wrap(family), wrap(qualifier), wrap(value)); - Put put = new Put(row); - KeyValueBuilder.addQuietly(put, builder, kv); + Put put = generateOriginalPut(); byte[] newValue = Bytes.toBytes("new-value"); - Cell cell = put.get(family, qualifier).get(0); - assertEquals(Bytes.toString(value), Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); - MetaDataUtil.mutatePutValue(put, family, qualifier, newValue); - cell = put.get(family, qualifier).get(0); - assertEquals(Bytes.toString(newValue), Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); + Cell cell = put.get(TABLE_FAMILY_BYTES, QUALIFIER).get(0); + assertEquals(Bytes.toString(ORIGINAL_VALUE), + Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); + MetaDataUtil.mutatePutValue(put, TABLE_FAMILY_BYTES, QUALIFIER, newValue); + cell = put.get(TABLE_FAMILY_BYTES, QUALIFIER).get(0); + assertEquals(Bytes.toString(newValue), + Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); + } + + @Test + public void testTaggingAPutWrongQualifier() throws Exception { + Put put = generateOriginalPut(); + Cell initialCell = put.get(TABLE_FAMILY_BYTES, QUALIFIER).get(0); + + // Different qualifier, so no tags should be set + MetaDataUtil.conditionallyAddTagsToPutCells(put, TABLE_FAMILY_BYTES, EMPTY_BYTE_ARRAY, + mockBuilder, EMPTY_BYTE_ARRAY, DUMMY_TAGS); + verify(mockBuilder, never()).setTags(Mockito.any(byte[].class)); + Cell newCell = put.getFamilyCellMap().get(TABLE_FAMILY_BYTES).get(0); + assertEquals(initialCell, newCell); + assertNull(TagUtil.carryForwardTags(newCell)); + } + + @Test + public void testTaggingAPutUnconditionally() throws Exception { + Put put = generateOriginalPut(); + + // valueArray is null so we always set tags + MetaDataUtil.conditionallyAddTagsToPutCells(put, TABLE_FAMILY_BYTES, QUALIFIER, + mockBuilder, null, DUMMY_TAGS); + verify(mockBuilder, times(1)).setTags(Mockito.any(byte[].class)); + Cell newCell = put.getFamilyCellMap().get(TABLE_FAMILY_BYTES).get(0); + assertEquals(mockCellWithTags, newCell); + } + + @Test + public void testSkipTaggingAPutDueToSameCellValue() throws Exception { + Put put = generateOriginalPut(); + Cell initialCell = put.get(TABLE_FAMILY_BYTES, QUALIFIER).get(0); + + // valueArray is set as the value stored in the cell, so we skip tagging the cell + MetaDataUtil.conditionallyAddTagsToPutCells(put, TABLE_FAMILY_BYTES, QUALIFIER, + mockBuilder, ORIGINAL_VALUE, DUMMY_TAGS); + verify(mockBuilder, never()).setTags(Mockito.any(byte[].class)); + Cell newCell = put.getFamilyCellMap().get(TABLE_FAMILY_BYTES).get(0); + assertEquals(initialCell, newCell); + assertNull(TagUtil.carryForwardTags(newCell)); + } + + @Test + public void testTaggingAPutDueToDifferentCellValue() throws Exception { + Put put = generateOriginalPut(); + + // valueArray is set to a value different than the one in the cell, so we tag the cell + MetaDataUtil.conditionallyAddTagsToPutCells(put, TABLE_FAMILY_BYTES, QUALIFIER, + mockBuilder, EMPTY_BYTE_ARRAY, DUMMY_TAGS); + verify(mockBuilder, times(1)).setTags(Mockito.any(byte[].class)); + Cell newCell = put.getFamilyCellMap().get(TABLE_FAMILY_BYTES).get(0); + assertEquals(mockCellWithTags, newCell); } /** @@ -90,31 +171,28 @@ public class MetaDataUtilTest { public void testGetMutationKeyValue() throws Exception { String version = VersionInfo.getVersion(); KeyValueBuilder builder = KeyValueBuilder.get(version); - byte[] row = Bytes.toBytes("row"); - byte[] family = PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES; - byte[] qualifier = Bytes.toBytes("qual"); - byte[] value = Bytes.toBytes("generic-value"); - KeyValue kv = builder.buildPut(wrap(row), wrap(family), wrap(qualifier), wrap(value)); - Put put = new Put(row); + KeyValue kv = builder.buildPut(wrap(ROW), wrap(TABLE_FAMILY_BYTES), wrap(QUALIFIER), + wrap(ORIGINAL_VALUE)); + Put put = new Put(ROW); KeyValueBuilder.addQuietly(put, builder, kv); // read back out the value ImmutableBytesPtr ptr = new ImmutableBytesPtr(); - assertTrue(MetaDataUtil.getMutationValue(put, qualifier, builder, ptr)); + assertTrue(MetaDataUtil.getMutationValue(put, QUALIFIER, builder, ptr)); assertEquals("Value returned doesn't match stored value for " + builder.getClass().getName() + "!", 0, - ByteUtil.BYTES_PTR_COMPARATOR.compare(ptr, wrap(value))); + ByteUtil.BYTES_PTR_COMPARATOR.compare(ptr, wrap(ORIGINAL_VALUE))); // try again, this time with the clientkeyvalue builder if (builder != GenericKeyValueBuilder.INSTANCE) { builder = GenericKeyValueBuilder.INSTANCE; - value = Bytes.toBytes("client-value"); - kv = builder.buildPut(wrap(row), wrap(family), wrap(qualifier), wrap(value)); - put = new Put(row); + byte[] value = Bytes.toBytes("client-value"); + kv = builder.buildPut(wrap(ROW), wrap(TABLE_FAMILY_BYTES), wrap(QUALIFIER), wrap(value)); + put = new Put(ROW); KeyValueBuilder.addQuietly(put, builder, kv); // read back out the value - assertTrue(MetaDataUtil.getMutationValue(put, qualifier, builder, ptr)); + assertTrue(MetaDataUtil.getMutationValue(put, QUALIFIER, builder, ptr)); assertEquals("Value returned doesn't match stored value for " + builder.getClass().getName() + "!", 0, ByteUtil.BYTES_PTR_COMPARATOR.compare(ptr, wrap(value))); @@ -159,5 +237,16 @@ public class MetaDataUtilTest { MetaDataProtocol.PHOENIX_MINOR_VERSION, MetaDataProtocol.PHOENIX_PATCH_NUMBER); assertEquals(expectedPhoenixVersion, phoenixVersion); } + + private Put generateOriginalPut() { + String version = VersionInfo.getVersion(); + KeyValueBuilder builder = KeyValueBuilder.get(version); + KeyValue kv = builder.buildPut(wrap(ROW), wrap(TABLE_FAMILY_BYTES), wrap(QUALIFIER), + wrap(ORIGINAL_VALUE)); + Put put = new Put(ROW); + KeyValueBuilder.addQuietly(put, builder, kv); + return put; + } + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-protocol/src/main/MetaDataService.proto ---------------------------------------------------------------------- diff --git a/phoenix-protocol/src/main/MetaDataService.proto b/phoenix-protocol/src/main/MetaDataService.proto index f10aa3c..290a65d 100644 --- a/phoenix-protocol/src/main/MetaDataService.proto +++ b/phoenix-protocol/src/main/MetaDataService.proto @@ -61,7 +61,7 @@ message SharedTableState { repeated PColumn columns = 4; repeated bytes physicalNames = 5; required int64 viewIndexId = 6; - optional int32 viewIndexType = 7 [default = 5]; + optional int32 viewIndexIdType = 7 [default = 5]; } message MetaDataResponse { @@ -77,7 +77,7 @@ message MetaDataResponse { optional PSchema schema = 10; optional int64 autoPartitionNum = 11; optional int64 viewIndexId = 12; - optional int32 viewIndexType = 13 [default = 5]; + optional int32 viewIndexIdType = 13 [default = 5]; } message GetTableRequest { http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-protocol/src/main/PTable.proto ---------------------------------------------------------------------- diff --git a/phoenix-protocol/src/main/PTable.proto b/phoenix-protocol/src/main/PTable.proto index be771a9..12dde49 100644 --- a/phoenix-protocol/src/main/PTable.proto +++ b/phoenix-protocol/src/main/PTable.proto @@ -103,7 +103,7 @@ message PTable { repeated EncodedCQCounter encodedCQCounters = 36; optional bool useStatsForParallelization = 37; optional int32 transactionProvider = 38; - optional int32 viewIndexType = 39 [default = 5]; + optional int32 viewIndexIdType = 39 [default = 5]; } message EncodedCQCounter { http://git-wip-us.apache.org/repos/asf/phoenix/blob/466ea28b/phoenix-protocol/src/main/ServerCachingService.proto ---------------------------------------------------------------------- diff --git a/phoenix-protocol/src/main/ServerCachingService.proto b/phoenix-protocol/src/main/ServerCachingService.proto index 0d2d1d2..5891d25 100644 --- a/phoenix-protocol/src/main/ServerCachingService.proto +++ b/phoenix-protocol/src/main/ServerCachingService.proto @@ -62,7 +62,7 @@ message IndexMaintainer { repeated ColumnInfo indexedColumnInfo = 19; required int32 encodingScheme = 20; required int32 immutableStorageScheme = 21; - optional int32 viewIndexType = 22 ; + optional int32 viewIndexIdType = 22 ; } message AddServerCacheRequest {