Skip to content

Conversation

@drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Jun 30, 2025

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

Summary

feat(meta): Add conflict-free sequence generator v1

Introduce a new conflict-free sequence generator (storage version 1)
alongside the existing version 0 generator. The v1 generator eliminates
conflicts during concurrent sequence number generation by using a new
FetchAddU64 operation instead of check-and-set semantics.

Key changes:

  • V1 generator stores sequence values in external standalone keys
  • Uses atomic FetchAddU64 operation for conflict-free updates
  • V0 generator remains unchanged for backward compatibility

The FetchAddU64 operation performs in-place atomic updates without
requiring metadata assertions, eliminating conflicts between concurrent
sequence requests and improving throughput for sequence generation
workloads.

Both storage versions coexist, allowing gradual migration from the
conflict-prone v0 implementation to the high-concurrency v1 design.

Non-Breaking:

This Commit just add this function but does not used anywhere.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Other

Related Issues


This change is Reviewable

@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Jun 30, 2025
@drmingdrmer drmingdrmer force-pushed the 327-seq-inc branch 3 times, most recently from c4e0b3f to 552768d Compare June 30, 2025 13:46
@drmingdrmer drmingdrmer marked this pull request as ready for review June 30, 2025 13:46
Introduce a new conflict-free sequence generator (storage version 1)
alongside the existing version 0 generator. The v1 generator eliminates
conflicts during concurrent sequence number generation by using a new
`FetchAddU64` operation instead of check-and-set semantics.

Key changes:
- V1 generator stores sequence values in external standalone keys
- Uses atomic FetchAddU64 operation for conflict-free updates
- V0 generator remains unchanged for backward compatibility

The FetchAddU64 operation performs in-place atomic updates without
requiring metadata assertions, eliminating conflicts between concurrent
sequence requests and improving throughput for sequence generation
workloads.

Both storage versions coexist, allowing gradual migration from the
conflict-prone v0 implementation to the high-concurrency v1 design.

**Non-Breaking**:

This Commit just add this function but does not used anywhere.
@drmingdrmer drmingdrmer merged commit 6533304 into databendlabs:main Jun 30, 2025
182 of 189 checks passed
@drmingdrmer drmingdrmer deleted the 327-seq-inc branch June 30, 2025 17:28
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.

1 participant