From dev-return-52128-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Thu May 31 00:14:47 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6B58718063B for ; Thu, 31 May 2018 00:14:47 +0200 (CEST) Received: (qmail 98453 invoked by uid 500); 30 May 2018 22:14:46 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 98414 invoked by uid 99); 30 May 2018 22:14:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 May 2018 22:14:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B3F96E0BC7; Wed, 30 May 2018 22:14:45 +0000 (UTC) From: JamesRTaylor To: dev@phoenix.apache.org Reply-To: dev@phoenix.apache.org References: In-Reply-To: Subject: [GitHub] phoenix pull request #303: PHOENIX-3534 Support multi region SYSTEM.CATALOG ... Content-Type: text/plain Message-Id: <20180530221445.B3F96E0BC7@git1-us-west.apache.org> Date: Wed, 30 May 2018 22:14:45 +0000 (UTC) Github user JamesRTaylor commented on a diff in the pull request: https://github.com/apache/phoenix/pull/303#discussion_r191939788 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java --- @@ -1457,28 +1761,69 @@ private static void getSchemaTableNames(Mutation row, byte[][] schemaTableNames) schemaTableNames[2] = tName; } } - + @Override public void createTable(RpcController controller, CreateTableRequest request, RpcCallback done) { MetaDataResponse.Builder builder = MetaDataResponse.newBuilder(); byte[][] rowKeyMetaData = new byte[3][]; byte[] schemaName = null; byte[] tableName = null; + String fullTableName = SchemaUtil.getTableName(schemaName, tableName); try { int clientVersion = request.getClientVersion(); List tableMetadata = ProtobufUtil.getMutations(request); MetaDataUtil.getTenantIdAndSchemaAndTableName(tableMetadata, rowKeyMetaData); byte[] tenantIdBytes = rowKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX]; schemaName = rowKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX]; tableName = rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX]; + // TODO before creating a table we need to see if the table was previously created and then dropped + // and clean up any parent->child links or child views boolean isNamespaceMapped = MetaDataUtil.isNameSpaceMapped(tableMetadata, GenericKeyValueBuilder.INSTANCE, new ImmutableBytesWritable()); final IndexType indexType = MetaDataUtil.getIndexType(tableMetadata, GenericKeyValueBuilder.INSTANCE, new ImmutableBytesWritable()); + byte[] parentTenantId = null; byte[] parentSchemaName = null; byte[] parentTableName = null; PTableType tableType = MetaDataUtil.getTableType(tableMetadata, GenericKeyValueBuilder.INSTANCE, new ImmutableBytesWritable()); + ViewType viewType = MetaDataUtil.getViewType(tableMetadata, GenericKeyValueBuilder.INSTANCE, new ImmutableBytesWritable()); + + // Here we are passed the parent's columns to add to a view, PHOENIX-3534 allows for a splittable + // System.Catalog thus we only store the columns that are new to the view, not the parents columns, + // thus here we remove everything that is ORDINAL.POSITION <= baseColumnCount and update the + // ORDINAL.POSITIONS to be shifted accordingly. --- End diff -- Important to file and reference a JIRA here to remove the dedup code once clients have been upgraded to the release in which we no longer send the duplicate information. Can we stop sending the duplicate info in the same release that SYSTEM.CATALOG becomes splittable? Seems like yes. ---