Skip to content

feat: compact segment #8261

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

Merged
merged 31 commits into from
Oct 19, 2022
Merged

Conversation

dantengsky
Copy link
Member

@dantengsky dantengsky commented Oct 17, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

  • introduce optimize table compact segment statement:
    optimize table t compact SEGMENT
  • which compacts segments according to the table option block_per_segment , default value is 1000 (blocks per segment)
  • resolves conflicts with append only operations in a way of OOC retry (retry without backoff, 10 times at most)
    the idea of conflict detection is stolen from PR fix(storage): support mutation during insertion #8205, originating from @zhyass

NOTE:

To increase the possibility of success committing (of compact operation), the compaction is done in the target_select phase, and if concurrent resolvable conflicts(append-only txs) are detected during the commit phase, the newly appended segments will NOT be compacted again during retries, just merged with the compaction (and recalculates the statistics). the non-compacted newly appended segments are hopefully being compacted in the subsequence optimize compact segment operations.

Fixes #8247

@vercel
Copy link

vercel bot commented Oct 17, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
databend ⬜️ Ignored (Inspect) Oct 19, 2022 at 8:11AM (UTC)

@dantengsky dantengsky changed the title Feat: compact segment feat: compact segment Oct 17, 2022
@dantengsky dantengsky changed the title feat: compact segment feature: compact segment Oct 17, 2022
@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Oct 17, 2022
@dantengsky dantengsky changed the title feature: compact segment feat: compact segment Oct 17, 2022
@dantengsky dantengsky marked this pull request as ready for review October 18, 2022 16:27
@dantengsky dantengsky requested a review from zhyass October 18, 2022 16:28
@dantengsky dantengsky marked this pull request as draft October 18, 2022 17:54
@dantengsky dantengsky marked this pull request as ready for review October 19, 2022 06:20
@BohuTANG BohuTANG requested a review from zhyass October 19, 2022 06:27
Copy link
Member

@zhyass zhyass left a comment

Choose a reason for hiding this comment

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

LGTM

@BohuTANG BohuTANG merged commit 76efae6 into databendlabs:main Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: optimize table t compact segment only
3 participants