[ https://issues.apache.org/jira/browse/HIVE-25346?focusedWorklogId=666312&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-666312 ]
ASF GitHub Bot logged work on HIVE-25346: ----------------------------------------- Author: ASF GitHub Bot Created on: 18/Oct/21 14:03 Start Date: 18/Oct/21 14:03 Worklog Time Spent: 10m Work Description: pvary commented on a change in pull request #2716: URL: https://github.com/apache/hive/pull/2716#discussion_r730955860 ########## File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java ########## @@ -1444,76 +1444,84 @@ public void commitTxn(CommitTxnRequest rqst) String conflictSQLSuffix = "FROM \"TXN_COMPONENTS\" WHERE \"TC_TXNID\"=" + txnid + " AND \"TC_OPERATION_TYPE\" IN (" + OperationType.UPDATE + "," + OperationType.DELETE + ")"; - long tempCommitId = generateTemporaryId(); - if (txnType.get() != TxnType.READ_ONLY - && !isReplayedReplTxn - && isUpdateOrDelete(stmt, conflictSQLSuffix)) { - - isUpdateDelete = 'Y'; - //if here it means currently committing txn performed update/delete and we should check WW conflict - /** - * "select distinct" is used below because - * 1. once we get to multi-statement txns, we only care to record that something was updated once - * 2. if {@link #addDynamicPartitions(AddDynamicPartitions)} is retried by caller it may create - * duplicate entries in TXN_COMPONENTS - * but we want to add a PK on WRITE_SET which won't have unique rows w/o this distinct - * even if it includes all of its columns - * - * First insert into write_set using a temporary commitID, which will be updated in a separate call, - * see: {@link #updateWSCommitIdAndCleanUpMetadata(Statement, long, TxnType, Long, long)}}. - * This should decrease the scope of the S4U lock on the next_txn_id table. - */ - Savepoint undoWriteSetForCurrentTxn = dbConn.setSavepoint(); - stmt.executeUpdate("INSERT INTO \"WRITE_SET\" (\"WS_DATABASE\", \"WS_TABLE\", \"WS_PARTITION\", \"WS_TXNID\", \"WS_COMMIT_ID\", \"WS_OPERATION_TYPE\")" + - " SELECT DISTINCT \"TC_DATABASE\", \"TC_TABLE\", \"TC_PARTITION\", \"TC_TXNID\", " + tempCommitId + ", \"TC_OPERATION_TYPE\" " + conflictSQLSuffix); - /** - * This S4U will mutex with other commitTxn() and openTxns(). - * -1 below makes txn intervals look like [3,3] [4,4] if all txns are serial - * Note: it's possible to have several txns have the same commit id. Suppose 3 txns start - * at the same time and no new txns start until all 3 commit. - * We could've incremented the sequence for commitId as well but it doesn't add anything functionally. - */ + if (txnType.get() == TxnType.COMPACTION) { Review comment: I think this `if` clause causes behavioural change, and the `else` path will not be executer for `COMPACTION` queries, but it was executed before. But I could be wrong, just testing my understanding -- 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. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 666312) Time Spent: 11h 20m (was: 11h 10m) > cleanTxnToWriteIdTable breaks SNAPSHOT isolation > ------------------------------------------------ > > Key: HIVE-25346 > URL: https://issues.apache.org/jira/browse/HIVE-25346 > Project: Hive > Issue Type: Bug > Reporter: Zoltan Chovan > Assignee: Zoltan Chovan > Priority: Major > Labels: pull-request-available > Time Spent: 11h 20m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.3.4#803005)