nsivabalan opened a new pull request #3827:
URL: https://github.com/apache/hudi/pull/3827


   ## What is the purpose of the pull request
   
   - With recent [refactoring for synchronous 
metadata](https://github.com/apache/hudi/pull/3590) patch, there was 2 code 
paths where double locking is happening. This patch fixes this issue. 
   - While adding tests, also found a bug related to multi-writer and upgrade 
and fixed the same as well. 
   
   ## Brief change log
   
   - There are two code paths where deadlock happens. 
   a. When a table is being upgraded, and if multi-writer is enabled, we 
rollback all partial commits. This upgrade step itself happens within a lock, 
but the rollback also tries to acquire lock when committing the rollback
   b. When auto commit is enabled with inline cleaning, auto clean is triggered 
as part of post commit which happens within a lock. But cleaning at the end 
when trying to commit again tries to acquire lock. 
   Fix: Added optionality to both rollback and clean to skip locking. These two 
code paths will set true for skipLocking. Also, fixed to add guards to take 
locks only if metadata is enabled. Prior to this patch, we take locks and then 
check if metadata writer is available. Some minor optimization. 
   - While testing, came across a bug with upgrade and rollback relating to 
multi-writer. When a table needs an upgrade, and if multi-writer is enabled, we 
rollback all partial commits. This also rollsback the current transaction in 
flight. Added a filtering to ensure we don't rollback the current transaction 
that just started and is triggering the upgrade. 
   
   ## Verify this pull request
   
   This change added tests and can be verified as follows:
   - Added tests to TestHoodieBackedMetadata
      a. testMultiWriterForDoubleLocking
      b. testRollbackDuringUpgradeForDoubleLocking
   
   ## Committer checklist
   
    - [ ] Has a corresponding JIRA in PR title & commit
    
    - [ ] Commit message is descriptive of the change
    
    - [ ] CI is green
   
    - [ ] Necessary doc changes done or have another open PR
          
    - [ ] For large changes, please consider breaking it into sub-tasks under 
an umbrella JIRA.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to