[ https://issues.apache.org/jira/browse/HIVE-24586?focusedWorklogId=531963&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-531963 ]
ASF GitHub Bot logged work on HIVE-24586: ----------------------------------------- Author: ASF GitHub Bot Created on: 06/Jan/21 16:38 Start Date: 06/Jan/21 16:38 Worklog Time Spent: 10m Work Description: pvargacl commented on a change in pull request #1831: URL: https://github.com/apache/hive/pull/1831#discussion_r552788738 ########## File path: ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java ########## @@ -1159,6 +1163,42 @@ public void resolveUserToRunAs() throws Exception { Assert.assertNotEquals(userFromConf, initiator.resolveUserToRunAs(tblNameOwners, t, null)); } + @Test public void testInitiatorFailure() throws Exception { + String tableName = "my_table"; + Table t = newTable("default", tableName, false); + + HiveConf.setIntVar(conf, HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_THRESHOLD, 1); + + // 2 aborts + for (int i = 0; i < 2; i++) { + long txnid = openTxn(); + LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, "default"); + comp.setTablename(tableName); + comp.setOperationType(DataOperationType.UPDATE); + List<LockComponent> components = new ArrayList<LockComponent>(1); + components.add(comp); + LockRequest req = new LockRequest(components, "me", "localhost"); + req.setTxnid(txnid); + LockResponse res = txnHandler.lock(req); + txnHandler.abortTxn(new AbortTxnRequest(txnid)); + } + + // run and fail initiator + Initiator initiator = Mockito.spy(new Initiator()); + initiator.setThreadId((int) t.getId()); + initiator.setConf(conf); + initiator.init(new AtomicBoolean(true)); + doThrow(new RuntimeException()).when(initiator).resolveValidWriteIds(any()); + initiator.run(); + + // verify status of table compaction + ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); + List<ShowCompactResponseElement> compacts = rsp.getCompacts(); + Assert.assertEquals(1, compacts.size()); + Assert.assertEquals("did not initiate", compacts.get(0).getState()); Review comment: I just noticed that in Initiator.scheduleCompactionIfRequired the exception is not passed to CompactionInfo, so it won't get saved. Could you also fix that, and here you could check if it was saved correctly. ---------------------------------------------------------------- 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: 531963) Time Spent: 20m (was: 10m) > Rename compaction "attempted" status > ------------------------------------ > > Key: HIVE-24586 > URL: https://issues.apache.org/jira/browse/HIVE-24586 > Project: Hive > Issue Type: Improvement > Reporter: Karen Coppage > Assignee: Karen Coppage > Priority: Minor > Labels: pull-request-available > Time Spent: 20m > Remaining Estimate: 0h > > A compaction with "attempted" status sounds like compactor tried to compact > the table/partition and failed. In reality it means one of these: > * the Initiator did not queue compaction because the number of previously > failed compactions has passed a threshold > * the Initiator did not queue compaction because of an error > In both these cases the user is still able initiate compaction manually. This > should be made clearer. -- This message was sent by Atlassian Jira (v8.3.4#803005)