Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 514A7200D26 for ; Fri, 6 Oct 2017 00:24:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4F7C71609E2; Thu, 5 Oct 2017 22:24:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 97F5A160BDA for ; Fri, 6 Oct 2017 00:24:05 +0200 (CEST) Received: (qmail 28995 invoked by uid 500); 5 Oct 2017 22:24:04 -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 28984 invoked by uid 99); 5 Oct 2017 22:24:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Oct 2017 22:24:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E80E91A3BAE for ; Thu, 5 Oct 2017 22:24:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id fFv7xfA9RsCo for ; Thu, 5 Oct 2017 22:24:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 8E8DA5F1BA for ; Thu, 5 Oct 2017 22:24:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 75427E0E4F for ; Thu, 5 Oct 2017 22:24:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 7630724337 for ; Thu, 5 Oct 2017 22:24:00 +0000 (UTC) Date: Thu, 5 Oct 2017 22:24:00 +0000 (UTC) From: "Thomas D'Silva (JIRA)" To: dev@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PHOENIX-4229) Parent-Child linking rows in System.Catalog break tenant view replication MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 05 Oct 2017 22:24:06 -0000 [ https://issues.apache.org/jira/browse/PHOENIX-4229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16193839#comment-16193839 ] Thomas D'Silva commented on PHOENIX-4229: ----------------------------------------- The child to parent link uses LinkType.PARENT_TABLE and parent to child link uses LinkType.CHILD_TABLE. This happens in MetadataClient createTableInternal {code} // Add row linking view to its parent PreparedStatement linkStatement = connection.prepareStatement(CREATE_VIEW_LINK); linkStatement.setString(1, tenantIdStr); linkStatement.setString(2, schemaName); linkStatement.setString(3, tableName); linkStatement.setString(4, parent.getName().getString()); linkStatement.setByte(5, LinkType.PARENT_TABLE.getSerializedValue()); linkStatement.setString(6, parent.getTenantId() == null ? null : parent.getTenantId().getString()); linkStatement.execute(); // Add row linking parent to view linkStatement = connection.prepareStatement(CREATE_CHILD_LINK); linkStatement.setString(1, parent.getTenantId() == null ? null : parent.getTenantId().getString()); linkStatement.setString(2, parent.getSchemaName() == null ? null : parent.getSchemaName().getString()); linkStatement.setString(3, parent.getTableName().getString()); linkStatement.setString(4, tenantIdStr); linkStatement.setString(5, SchemaUtil.getTableName(schemaName, tableName)); linkStatement.setByte(6, LinkType.CHILD_TABLE.getSerializedValue()); linkStatement.execute(); {code} The parent to child link is created using CREATE_CHILD_LINK, you only need to replicate a single cell (LINK_TYPE) and check that the row key of cell matches the format. As James said, you can use MetaDataUtil.getVarChars() to decompose the row key and check if rowViewKeyMetaData[PhoenixDatabaseMetaData.FAMILY_NAME_INDEX] is not null and the link type value is 4 (the serialized value of LinkType.CHILD_TABLE) > Parent-Child linking rows in System.Catalog break tenant view replication > ------------------------------------------------------------------------- > > Key: PHOENIX-4229 > URL: https://issues.apache.org/jira/browse/PHOENIX-4229 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.11.0, 4.12.0 > Reporter: Geoffrey Jacoby > Assignee: Geoffrey Jacoby > > PHOENIX-2051 introduced new Parent-Child linking rows to System.Catalog that speed up view deletion. Unfortunately, this breaks assumptions in PHOENIX-3639, which gives a way to replicate tenant views from one cluster to another. (It assumes that all the metadata for a tenant view is owned by the tenant -- the linking rows are not.) > PHOENIX-3639 was a workaround in the first place to the more fundamental design problem that Phoenix places the metadata for both table schemas -- which should never be replicated -- in the same table and column family as the metadata for tenant views, which should be replicated. > Note that the linking rows also make it more difficult to ever split these two datasets apart, as proposed in PHOENIX-3520. -- This message was sent by Atlassian JIRA (v6.4.14#64029)