Skip to content

Comments

SequenceStore での処理が失敗したときに正常に採番できないケースがある問題を解決します#57

Merged
tksugimoto merged 34 commits intofeature/fix-sequence-factoryfrom
fix-sequence-factory
Sep 28, 2021
Merged

SequenceStore での処理が失敗したときに正常に採番できないケースがある問題を解決します#57
tksugimoto merged 34 commits intofeature/fix-sequence-factoryfrom
fix-sequence-factory

Conversation

@negokaz
Copy link
Contributor

@negokaz negokaz commented Sep 2, 2021

Closes #49

  • SequenceFactoryWorkerSequenceStore の応答があるまで追加の採番値を予約するのを控える実装を廃止します
  • SequenceFactoryWorker は採番できる値があるのか、あるいは無いのかの基準でのみ振る舞いを変えます
  • SequenceFactoryWorkerSequenceStore の状態によらず採番値を予約するようになったことにより Cassandra へのクエリ発行の頻度が高くなることが予想されます。そこで SequenceStore 側で不要な書き込みを行わないよう処理対象とする予約を調整します
    • SequenceStore は複数の sequenceSubId で共有する構造のため、sequenceSubId を考慮して予約の調整を行う必要がありました。そのような細かな調整を行うと実装が複雑になることが予想されるため、調整はしない方針としました。
  • 前のバージョンから存在していた問題ですが、採番値の予約時に余分に 1 つ多く採番値が予約されてしまう問題を解消しました (comment)
  • 前のバージョンでは maxSequenceValue を超えた採番値予約も許可していました(ただし、採番時に採番しない制御をしていた)が、 仕様の複雑性を軽減するため、そもそも maxSequenceValue を超えた採番値の予約を行わないよう変更しました 59c6134
    • 修正のきっかけはこちら:(comment)

@negokaz negokaz force-pushed the fix-sequence-factory branch 3 times, most recently from 06f12ec to c80c086 Compare September 2, 2021 11:10
SequenceFactoryWorker で SequenceStore と採番値の 2 つの状態の管理を
行っていて実装が複雑になっている問題を解消します
予約途中に SequenceFactoryWorker が追加の予約要求をしないようにしていた実装を削除したため
@negokaz negokaz force-pushed the fix-sequence-factory branch from c80c086 to 2ab6ac1 Compare September 2, 2021 11:13
This reverts commit 2ab6ac1.

sequenceSubId は混在して SequenceStore に採番予約を行うため、
採番予約要求を間引いてしまうと一部の sequenceSubId
の予約に失敗してしまう
@negokaz negokaz marked this pull request as ready for review September 3, 2021 06:04
@negokaz negokaz requested a review from tksugimoto September 6, 2021 07:04
@tksugimoto tksugimoto added this to the v3.0.0 milestone Sep 9, 2021
@negokaz negokaz changed the base branch from main to feature/fix-sequence-factory September 13, 2021 08:07
@tksugimoto tksugimoto closed this Sep 13, 2021
@tksugimoto tksugimoto reopened this Sep 13, 2021
@tksugimoto tksugimoto force-pushed the feature/fix-sequence-factory branch from 8410a62 to 5a62c30 Compare September 27, 2021 01:52
tksugimoto
tksugimoto previously approved these changes Sep 27, 2021
@tksugimoto tksugimoto enabled auto-merge (squash) September 27, 2021 09:21
次のテストケースはシナリオが同じであり、重複していたため片方を削除します
- 採番値が枯渇しているときに予約に失敗した場合は次の採番要求で再度予約が要求される
- 採番値が枯渇しているときに予約が失敗した場合は次の採番要求で再度予約が要求される
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.

[lerna-util-sequence] (Cassandra) SequenceStore での処理が失敗した場合正常に採番できない場合がある

3 participants