[ https://issues.apache.org/jira/browse/HIVE-26407?focusedWorklogId=800923&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-800923 ]
ASF GitHub Bot logged work on HIVE-26407: ----------------------------------------- Author: ASF GitHub Bot Created on: 16/Aug/22 11:51 Start Date: 16/Aug/22 11:51 Worklog Time Spent: 10m Work Description: InvisibleProgrammer commented on code in PR #3489: URL: https://github.com/apache/hive/pull/3489#discussion_r946679677 ########## ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java: ########## @@ -142,65 +139,10 @@ public void run() { public void init(AtomicBoolean stop) throws Exception { super.init(stop); this.workerName = getWorkerId(); + this.statsUpdater = new StatsUpdater(); Review Comment: If we go back to the single instance, it will be static. And the reason why we extracted the logic into its own service class is to avoid static and to be able to do unit tests. We can still do it as static but if we want to do that, it will introduce a larger refactor that affects existing test classes that use PowerMock. All the solutions have their drawback. I see no solution that can meet all the requirements. In case you want to make sure that will be a single instance only, I highly recommend removing PowerMock first. So my question is: what we should do first? Stop computing statistics or make the code easier to test in case of using static? To be honest, I would prefer using some dependency injection framework that can provide us with a single instance easily but I'm afraid it is too far from our current scope. Issue Time Tracking ------------------- Worklog Id: (was: 800923) Time Spent: 2h 40m (was: 2.5h) > Do not collect statistics if the compaction fails > ------------------------------------------------- > > Key: HIVE-26407 > URL: https://issues.apache.org/jira/browse/HIVE-26407 > Project: Hive > Issue Type: Test > Components: Hive > Reporter: Zsolt Miskolczi > Assignee: Zsolt Miskolczi > Priority: Minor > Labels: pull-request-available > Time Spent: 2h 40m > Remaining Estimate: 0h > > It can still compute statistics, even if compaction fails. > if (computeStats) \{ > StatsUpdater.gatherStats(ci, conf, runJobAsSelf(ci.runAs) ? ci.runAs : > t1.getOwner(), > CompactorUtil.getCompactorJobQueueName(conf, ci, t1)); > } -- This message was sent by Atlassian Jira (v8.20.10#820010)