Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do DELETE instead of TRUNCATE when locks aren't acquired #7785

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kpan2034
Copy link
Contributor

@kpan2034 kpan2034 commented Mar 3, 2025

After compression, the uncompressed part of the chunk is truncated. This requires upgrading the ExclusiveLock to an
AccessExclusiveLock and hence is sometimes blocked by other other operations, including reads, on the chunk. This leads to longer compress times or potential deadlocks.

Instead of this, we fall back to deleting the tuples in the chunk row-by-row when the upgraded lock isn't immediately acquired.

Copy link

codecov bot commented Mar 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.90%. Comparing base (59f50f2) to head (43e54cd).
Report is 799 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7785      +/-   ##
==========================================
+ Coverage   80.06%   81.90%   +1.83%     
==========================================
  Files         190      247      +57     
  Lines       37181    45430    +8249     
  Branches     9450    11355    +1905     
==========================================
+ Hits        29770    37210    +7440     
- Misses       2997     3753     +756     
- Partials     4414     4467      +53     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

After compression, the uncompressed part of the chunk is truncated.
This requires upgrading the `ExclusiveLock` to an
`AccessExclusiveLock` and hence is sometimes blocked by other other
operations, including reads, on the chunk. This leads to longer
compress times or potential deadlocks.

Instead of this, we fall back to deleting the tuples in the chunk
row-by-row when the upgraded lock isn't immediately acquired.
@kpan2034 kpan2034 force-pushed the no-waiting-for-locks branch from 43e54cd to dba0e76 Compare March 4, 2025 09:23
# until the end when we drop the compressed chunk
# which happens after updates to the chunk catalog tuple
permutation "CA1" "CAc" "LockChunkTuple" "DA1" "SA" "SF" "UnlockChunkTuple" "DAc"

# Compressing a chunk should not stop any reads
# until it comes to truncating the uncompressed chunk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to check whether truncate or deletion is happening during compression? Using a log here seems unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant