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 01A5E2009C5 for ; Mon, 16 May 2016 23:37:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 004EA160131; Mon, 16 May 2016 21:37:18 +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 4ABCF160A16 for ; Mon, 16 May 2016 23:37:17 +0200 (CEST) Received: (qmail 11922 invoked by uid 500); 16 May 2016 21:37:16 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 11905 invoked by uid 99); 16 May 2016 21:37:16 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 May 2016 21:37:16 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id E13192BA621; Mon, 16 May 2016 21:37:14 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============8964786901083672557==" MIME-Version: 1.0 Subject: Re: Review Request 47353: HIVE-13616: Investigate renaming a table without invalidating the column stats From: Ashutosh Chauhan To: Chaoyu Tang Cc: Ashutosh Chauhan , hive , Aihua Xu Date: Mon, 16 May 2016 21:37:14 -0000 Message-ID: <20160516213714.8624.646@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Ashutosh Chauhan X-ReviewGroup: hive X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/47353/ X-Sender: Ashutosh Chauhan References: <20160516212257.8623.521@reviews.apache.org> In-Reply-To: <20160516212257.8623.521@reviews.apache.org> X-ReviewBoard-Diff-For: ql/src/test/results/clientpositive/rename_table_update_column_stats.q.out X-ReviewBoard-Diff-For: ql/src/test/queries/clientpositive/rename_table_update_column_stats.q Reply-To: Ashutosh Chauhan X-ReviewRequest-Repository: hive-git archived-at: Mon, 16 May 2016 21:37:18 -0000 --===============8964786901083672557== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On May 16, 2016, 9:22 p.m., Aihua Xu wrote: > > metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java, lines 698-699 > > > > > > Similar to openTransaction, commitTransaction will not do the real commit until openTrasactionCalls reaches 0. So deleteTableColumnStatistics() or updateTableColumnStatistics() will not be committed actually, until line 244 in which all the operations will be committed. > > > > > > Here is the commitTransaction() logic. > > > > openTrasactionCalls--; > > debugLog("Commit transaction: count = " + openTrasactionCalls + ", isactive "+ currentTransaction.isActive()); > > > > if ((openTrasactionCalls == 0) && currentTransaction.isActive()) { > > transactionStatus = TXN_STATUS.COMMITED; > > currentTransaction.commit(); > > } I didn't verify in debugger. But I would expect following is whats gonna happen. AlterHandler calls deleteTableStats() which will call openTransaction() which increases openTransactionCalls to 1. Before returning deleteTableStats call commitTransaction() which will set openTransactionCalls to 0. Later when AlterHandler calls updateTableColumnStats() it will start new transaction, since openTransactionCalls now is 0. May be I am missing something obvious. - Ashutosh ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/47353/#review133447 ----------------------------------------------------------- On May 13, 2016, 7:17 p.m., Aihua Xu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/47353/ > ----------------------------------------------------------- > > (Updated May 13, 2016, 7:17 p.m.) > > > Review request for hive and Chaoyu Tang. > > > Repository: hive-git > > > Description > ------- > > HIVE-13616: Investigate renaming a table without invalidating the column stats > > > Diffs > ----- > > metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java 0652b9db1a4224262611ff9258e871647442cfeb > ql/src/test/queries/clientpositive/rename_table_update_column_stats.q PRE-CREATION > ql/src/test/results/clientpositive/rename_table_update_column_stats.q.out PRE-CREATION > > Diff: https://reviews.apache.org/r/47353/diff/ > > > Testing > ------- > > Tests have been run and the failed tests don't seem to be related. > > To carry over the column stats during renaming the table, the patch > 1. Save affected column stats > 2. Rename the table > 3. Write the saved column stats for the new table. > > In this order, column stats will find the foreign key when writing in 3). > > > Thanks, > > Aihua Xu > > --===============8964786901083672557==--