[ 
https://issues.apache.org/jira/browse/HIVE-24291?focusedWorklogId=506564&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-506564
 ]

ASF GitHub Bot logged work on HIVE-24291:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Oct/20 07:55
            Start Date: 30/Oct/20 07:55
    Worklog Time Spent: 10m 
      Work Description: pvargacl commented on a change in pull request #1592:
URL: https://github.com/apache/hive/pull/1592#discussion_r514923203



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -1526,6 +1529,10 @@ private void 
updateWSCommitIdAndCleanUpMetadata(Statement stmt, long txnid, TxnT
     if (txnType == TxnType.MATER_VIEW_REBUILD) {
       queryBatch.add("DELETE FROM \"MATERIALIZATION_REBUILD_LOCKS\" WHERE 
\"MRL_TXN_ID\" = " + txnid);
     }
+    if (txnType == TxnType.COMPACTION) {

Review comment:
       I would prefer this method for two reasons:
   1. To work correctly, the first point when we can update the CQ_NEXT_TXN_ID, 
is inside the commitTxn, when we already have the lock for the txnId sequence. 
Anywhere before that, there can be a txn, that will have a higher txnId than 
the saved CQ_NEXT_TXN_ID and still not see the compaction as committed -> 
causing the Cleaner to clean up deltas, that should be kept for that txn. So if 
we don't do it in commitTxn, we only can do it after that, but that would mean, 
that the update won't be part of the transaction, and can fail "silently"
   2. In a follow up Jira, I need to provide a HMS notification for every 
committed compaction, for that I would also need CQ_TXN_ID




----------------------------------------------------------------
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: 506564)
    Time Spent: 1h  (was: 50m)

> Compaction Cleaner prematurely cleans up deltas
> -----------------------------------------------
>
>                 Key: HIVE-24291
>                 URL: https://issues.apache.org/jira/browse/HIVE-24291
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Peter Varga
>            Assignee: Peter Varga
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Since HIVE-23107 the cleaner can clean up deltas that are still used by 
> running queries.
> Example:
>  * TxnId 1-5 writes to a partition, all commits
>  * Compactor starts with txnId=6
>  * Long running query starts with txnId=7, it sees txnId=6 as open in its 
> snapshot
>  * Compaction commits
>  * Cleaner runs
> Previously min_history_level table would have prevented the Cleaner to delete 
> the deltas1-5 until txnId=7 is open, but now they will be deleted and the 
> long running query may fail if its tries to access the files.
> Solution could be to not run the cleaner until any txn is open that was 
> opened before the compaction was committed (CQ_NEXT_TXN_ID)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to