[41/50] [abbrv] phoenix git commit: PHOENIX-3534 Support multi region SYSTEM.CATALOG table (Thomas D'Silva and Rahul Gidwani)
http://git-wip-us.apache.org/repos/asf/phoenix/blob/c53d9ada/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java index 883f96d..29cf2a3 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java @@ -91,8 +91,9 @@ public abstract class MetaDataProtocol extends MetaDataService { public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_12_0 = MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0; public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_13_0 = MIN_SYSTEM_TABLE_TIMESTAMP_4_11_0; public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_14_0 = MIN_TABLE_TIMESTAMP + 28; +public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_15_0 = MIN_TABLE_TIMESTAMP + 29; // MIN_SYSTEM_TABLE_TIMESTAMP needs to be set to the max of all the MIN_SYSTEM_TABLE_TIMESTAMP_* constants -public static final long MIN_SYSTEM_TABLE_TIMESTAMP = MIN_SYSTEM_TABLE_TIMESTAMP_4_14_0; +public static final long MIN_SYSTEM_TABLE_TIMESTAMP = MIN_SYSTEM_TABLE_TIMESTAMP_4_15_0; // Version below which we should disallow usage of mutable secondary indexing. public static final int MUTABLE_SI_VERSION_THRESHOLD = VersionUtil.encodeVersion("0", "94", "10"); public static final int MAX_LOCAL_SI_VERSION_DISALLOW = VersionUtil.encodeVersion("0", "98", "8"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/c53d9ada/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableInfo.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableInfo.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableInfo.java new file mode 100644 index 000..b1c5f65 --- /dev/null +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableInfo.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.coprocessor; + +import java.util.Arrays; + +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.phoenix.util.SchemaUtil; + +public class TableInfo { + +private final byte[] tenantId; +private final byte[] schema; +private final byte[] name; + +public TableInfo(byte[] tenantId, byte[] schema, byte[] name) { +this.tenantId = tenantId; +this.schema = schema; +this.name = name; +} + +public byte[] getRowKeyPrefix() { +return SchemaUtil.getTableKey(tenantId, schema, name); +} + +@Override +public String toString() { +return Bytes.toStringBinary(getRowKeyPrefix()); +} + +public byte[] getTenantId() { +return tenantId; +} + +public byte[] getSchemaName() { +return schema; +} + +public byte[] getTableName() { +return name; +} + +@Override +public int hashCode() { +final int prime = 31; +int result = 1; +result = prime * result + Arrays.hashCode(name); +result = prime * result + Arrays.hashCode(schema); +result = prime * result + Arrays.hashCode(tenantId); +return result; +} + +@Override +public boolean equals(Object obj) { +if (this == obj) return true; +if (obj == null) return false; +if (getClass() != obj.getClass()) return false; +TableInfo other = (TableInfo) obj; +if (!Arrays.equals(name, other.name)) return false; +if (!Arrays.equals(schema, other.schema)) return false; +if (!Arrays.equals(tenantId, other.tenantId)) return false; +return true; +} +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/c53d9ada/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableViewFinderResult.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableViewFinderRe
[41/50] [abbrv] phoenix git commit: PHOENIX-3534 Support multi region SYSTEM.CATALOG table (Thomas D'Silva and Rahul Gidwani)
http://git-wip-us.apache.org/repos/asf/phoenix/blob/d56fd3c9/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java index 0bd1f8c..874a382 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java @@ -94,8 +94,10 @@ public abstract class MetaDataProtocol extends MetaDataService { // TODO Was there a system table upgrade? // TODO Need to account for the inevitable 4.14 release too public static final long MIN_SYSTEM_TABLE_TIMESTAMP_5_0_0 = MIN_SYSTEM_TABLE_TIMESTAMP_4_14_0; +public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_15_0 = MIN_TABLE_TIMESTAMP + 29; +public static final long MIN_SYSTEM_TABLE_TIMESTAMP_5_1_0 = MIN_SYSTEM_TABLE_TIMESTAMP_4_15_0; // MIN_SYSTEM_TABLE_TIMESTAMP needs to be set to the max of all the MIN_SYSTEM_TABLE_TIMESTAMP_* constants -public static final long MIN_SYSTEM_TABLE_TIMESTAMP = MIN_SYSTEM_TABLE_TIMESTAMP_5_0_0; +public static final long MIN_SYSTEM_TABLE_TIMESTAMP = MIN_SYSTEM_TABLE_TIMESTAMP_5_1_0; // Version below which we should disallow usage of mutable secondary indexing. public static final int MUTABLE_SI_VERSION_THRESHOLD = VersionUtil.encodeVersion("0", "94", "10"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/d56fd3c9/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableInfo.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableInfo.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableInfo.java new file mode 100644 index 000..b1c5f65 --- /dev/null +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableInfo.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.coprocessor; + +import java.util.Arrays; + +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.phoenix.util.SchemaUtil; + +public class TableInfo { + +private final byte[] tenantId; +private final byte[] schema; +private final byte[] name; + +public TableInfo(byte[] tenantId, byte[] schema, byte[] name) { +this.tenantId = tenantId; +this.schema = schema; +this.name = name; +} + +public byte[] getRowKeyPrefix() { +return SchemaUtil.getTableKey(tenantId, schema, name); +} + +@Override +public String toString() { +return Bytes.toStringBinary(getRowKeyPrefix()); +} + +public byte[] getTenantId() { +return tenantId; +} + +public byte[] getSchemaName() { +return schema; +} + +public byte[] getTableName() { +return name; +} + +@Override +public int hashCode() { +final int prime = 31; +int result = 1; +result = prime * result + Arrays.hashCode(name); +result = prime * result + Arrays.hashCode(schema); +result = prime * result + Arrays.hashCode(tenantId); +return result; +} + +@Override +public boolean equals(Object obj) { +if (this == obj) return true; +if (obj == null) return false; +if (getClass() != obj.getClass()) return false; +TableInfo other = (TableInfo) obj; +if (!Arrays.equals(name, other.name)) return false; +if (!Arrays.equals(schema, other.schema)) return false; +if (!Arrays.equals(tenantId, other.tenantId)) return false; +return true; +} +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/d56fd3c9/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableViewFinderResult.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableViewFinderResult.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TableViewFi