[ https://issues.apache.org/jira/browse/HIVE-25154?focusedWorklogId=608218&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-608218 ]
ASF GitHub Bot logged work on HIVE-25154: ----------------------------------------- Author: ASF GitHub Bot Created on: 08/Jun/21 02:07 Start Date: 08/Jun/21 02:07 Worklog Time Spent: 10m Work Description: pkumarsinha commented on a change in pull request #2311: URL: https://github.com/apache/hive/pull/2311#discussion_r647057749 ########## File path: ql/src/test/org/apache/hadoop/hive/ql/stats/TestStatsUpdaterThread.java ########## @@ -608,6 +607,63 @@ private void testNoStatsUpdateForReplTable(String tblNamePrefix, String txnPrope msClient.close(); } + @Test(timeout=80000) + public void testNoStatsUpdateForSimpleFailoverDb() throws Exception { + testNoStatsUpdateForFailoverDb("simple", ""); + } + + @Test(timeout=80000) + public void testNoStatsUpdateForTxnFailoverDb() throws Exception { + testNoStatsUpdateForFailoverDb("txn", + "TBLPROPERTIES (\"transactional\"=\"true\",\"transactional_properties\"=\"insert_only\")"); + } + + private void testNoStatsUpdateForFailoverDb(String tblNamePrefix, String txnProperty) throws Exception { + // Set high worker count so we get a longer queue. + hiveConf.setInt(MetastoreConf.ConfVars.STATS_AUTO_UPDATE_WORKER_COUNT.getVarname(), 4); + String tblWOStats = tblNamePrefix + "_repl_failover_nostats"; + String ptnTblWOStats = tblNamePrefix + "_ptn_repl_failover_nostats"; + String dbName = ss.getCurrentDatabase(); + StatsUpdaterThread su = createUpdater(); + IMetaStoreClient msClient = new HiveMetaStoreClient(hiveConf); + hiveConf.setBoolVar(HiveConf.ConfVars.HIVESTATSAUTOGATHER, false); + hiveConf.setBoolVar(HiveConf.ConfVars.HIVESTATSCOLAUTOGATHER, false); + + executeQuery("create table " + tblWOStats + "(i int, s string) " + txnProperty); + executeQuery("insert into " + tblWOStats + "(i, s) values (1, 'test')"); + verifyStatsUpToDate(tblWOStats, Lists.newArrayList("i"), msClient, false); + + executeQuery("create table " + ptnTblWOStats + "(s string) partitioned by (i int) " + txnProperty); + executeQuery("insert into " + ptnTblWOStats + "(i, s) values (1, 'test')"); + executeQuery("insert into " + ptnTblWOStats + "(i, s) values (2, 'test2')"); + executeQuery("insert into " + ptnTblWOStats + "(i, s) values (3, 'test3')"); + verifyPartStatsUpToDate(3, 1, msClient, ptnTblWOStats, false); + + assertTrue(su.runOneIteration()); + Assert.assertEquals(2, su.getQueueLength()); + executeQuery("alter database " + dbName + " set dbproperties('" + ReplConst.REPL_FAILOVER_ENABLED + "'='true')"); + //StatsUpdaterThread would not run analyze commands for the tables which were inserted before + //failover property was enabled for that database + drainWorkQueue(su, 2); + verifyStatsUpToDate(tblWOStats, Lists.newArrayList("i"), msClient, false); + verifyPartStatsUpToDate(3, 1, msClient, ptnTblWOStats, false); + Assert.assertEquals(0, su.getQueueLength()); + + executeQuery("create table new_table(s string) partitioned by (i int) " + txnProperty); + executeQuery("insert into new_table(i, s) values (4, 'test4')"); + + assertFalse(su.runOneIteration()); + Assert.assertEquals(0, su.getQueueLength()); + verifyStatsUpToDate(tblWOStats, Lists.newArrayList("i"), msClient, false); + verifyPartStatsUpToDate(3, 1, msClient, ptnTblWOStats, false); + + executeQuery("alter database " + dbName + " set dbproperties('" + ReplConst.REPL_FAILOVER_ENABLED + "'='')"); + executeQuery("drop table " + tblWOStats); Review comment: Actually it would make sense to re-verify after removing this property REPL_FAILOVER_ENABLED that stat updation is happening -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 608218) Time Spent: 4h 40m (was: 4.5h) > Disable StatsUpdaterThread and PartitionManagementTask for db that is being > failoved over. > ------------------------------------------------------------------------------------------ > > Key: HIVE-25154 > URL: https://issues.apache.org/jira/browse/HIVE-25154 > Project: Hive > Issue Type: Improvement > Reporter: Haymant Mangla > Assignee: Haymant Mangla > Priority: Major > Labels: pull-request-available > Time Spent: 4h 40m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.3.4#803005)