You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by la...@apache.org on 2019/11/26 00:23:33 UTC
[phoenix] branch 4.x-HBase-1.4 updated: PHOENIX-5584 Older clients
don't get correct view metadata when a 4.15 client creates a view.
This is an automated email from the ASF dual-hosted git repository.
larsh pushed a commit to branch 4.x-HBase-1.4
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push:
new 35e19bd PHOENIX-5584 Older clients don't get correct view metadata when a 4.15 client creates a view.
35e19bd is described below
commit 35e19bde32613bca31b09c48e8047b979136a951
Author: Lars Hofhansl <la...@apache.org>
AuthorDate: Mon Nov 25 16:20:58 2019 -0800
PHOENIX-5584 Older clients don't get correct view metadata when a 4.15 client creates a view.
---
.../apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 9fc6020..21c0823 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -601,6 +601,14 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso
getCoprocessorHost().preGetTable(Bytes.toString(tenantId), SchemaUtil.getTableName(schemaName, tableName),
TableName.valueOf(table.getPhysicalName().getBytes()));
+ if (request.getClientVersion() < MIN_SPLITTABLE_SYSTEM_CATALOG
+ && table.getType() == PTableType.VIEW
+ && table.getViewType() != ViewType.MAPPED) {
+ try (PhoenixConnection connection = QueryUtil.getConnectionOnServer(env.getConfiguration()).unwrap(PhoenixConnection.class)) {
+ PTable pTable = PhoenixRuntime.getTableNoCache(connection, table.getParentName().getString());
+ table = ViewUtil.addDerivedColumnsAndIndexesFromParent(connection, table, pTable);
+ }
+ }
builder.setReturnCode(MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS);
builder.setMutationTime(currentTime);
if (blockWriteRebuildIndex) {
@@ -2806,14 +2814,13 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso
}
/**
- * Looks up the table locally if its present on this region, or else makes an rpc call
- * to look up the region using PhoenixRuntime.getTable
+ * Looks up the table locally if its present on this region.
*/
private PTable doGetTable(byte[] tenantId, byte[] schemaName, byte[] tableName,
long clientTimeStamp, RowLock rowLock, int clientVersion) throws IOException, SQLException {
Region region = env.getRegion();
final byte[] key = SchemaUtil.getTableKey(tenantId, schemaName, tableName);
- // if this region doesn't contain the metadata rows look up the table by using PhoenixRuntime.getTable
+ // if this region doesn't contain the metadata rows then fail
if (!region.getRegionInfo().containsRow(key)) {
throw new SQLExceptionInfo.Builder(SQLExceptionCode.GET_TABLE_ERROR)
.setSchemaName(Bytes.toString(schemaName))