[ https://issues.apache.org/jira/browse/HIVE-26472?focusedWorklogId=801237&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-801237 ]
ASF GitHub Bot logged work on HIVE-26472: ----------------------------------------- Author: ASF GitHub Bot Created on: 17/Aug/22 06:56 Start Date: 17/Aug/22 06:56 Worklog Time Spent: 10m Work Description: sonarcloud[bot] commented on PR #3524: URL: https://github.com/apache/hive/pull/3524#issuecomment-1217536771 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3524) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3524&resolved=false&types=BUG) [![E](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/E-16px.png 'E')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3524&resolved=false&types=BUG) [103 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3524&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3524&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3524&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3524&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3524&resolved=false&types=SECURITY_HOTSPOT) [![E](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/E-16px.png 'E')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3524&resolved=false&types=SECURITY_HOTSPOT) [33 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3524&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3524&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3524&resolved=false&types=CODE_SMELL) [1772 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3524&resolved=false&types=CODE_SMELL) [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3524&metric=coverage&view=list) No Coverage information [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3524&metric=duplicated_lines_density&view=list) No Duplication information Issue Time Tracking ------------------- Worklog Id: (was: 801237) Time Spent: 0.5h (was: 20m) > Concurrent UPDATEs can cause duplicate rows > ------------------------------------------- > > Key: HIVE-26472 > URL: https://issues.apache.org/jira/browse/HIVE-26472 > Project: Hive > Issue Type: Bug > Components: HiveServer2 > Affects Versions: 4.0.0-alpha-1 > Reporter: John Sherman > Assignee: John Sherman > Priority: Critical > Labels: pull-request-available > Attachments: debug.diff > > Time Spent: 0.5h > Remaining Estimate: 0h > > Concurrent UPDATEs to the same table can cause duplicate rows when the > following occurs: > Two UPDATEs get assigned txnIds and writeIds like this: > UPDATE #1 = txnId: 100 writeId: 50 <--- commits first > UPDATE #2 = txnId: 101 writeId: 49 > To replicate the issue: > I applied the attach debug.diff patch which adds hive.lock.sleep.writeid > (which controls the amount to sleep before acquiring a writeId) and > hive.lock.sleep.post.writeid (which controls the amount to sleep after > acquiring a writeId). > {code:java} > CREATE TABLE test_update(i int) STORED AS ORC > TBLPROPERTIES('transactional'="true"); > INSERT INTO test_update VALUES (1); > Start two beeline connections. > In connection #1 - run: > set hive.driver.parallel.compilation = true; > set hive.lock.sleep.writeid=5s; > update test_update set i = 1 where i = 1; > Wait one second and in connection #2 - run: > set hive.driver.parallel.compilation = true; > set hive.lock.sleep.post.writeid=10s; > update test_update set i = 1 where i = 1; > After both updates complete - it is likely that test_update contains two rows > now. > {code} > HIVE-24211 seems to address the case when: > UPDATE #1 = txnId: 100 writeId: 50 > UPDATE #2 = txnId: 101 writeId: 49 <--- commits first (I think this causes > UPDATE #1 to detect the snapshot is out of date because commitedTxn > UPDATE > #1s txnId) > A possible work around is to set hive.driver.parallel.compilation = false, > but this would only help in cases there is only one HS2 instance. -- This message was sent by Atlassian Jira (v8.20.10#820010)