Skip to content

Comments

採番時に確保(予約)失敗した場合に確保できていない番号が使用されてしまう問題を修正#43

Closed
tksugimoto wants to merge 3 commits intomainfrom
lerna-util-sequence/fix/SequenceFactoryWorker
Closed

採番時に確保(予約)失敗した場合に確保できていない番号が使用されてしまう問題を修正#43
tksugimoto wants to merge 3 commits intomainfrom
lerna-util-sequence/fix/SequenceFactoryWorker

Conversation

@tksugimoto
Copy link
Contributor

No description provided.

@tksugimoto tksugimoto force-pushed the lerna-util-sequence/fix/SequenceFactoryWorker branch from d97d57d to 54132ec Compare July 14, 2021 11:10
val storeProbe = createTestProbe[SequenceStore.Command]()
val firstValue = 3
val incrementStep = 10
val reservationAmount = 2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

val reservationAmount = 2

val reservationAmount = 1 の場合に、予約失敗 SequenceStore.ReservationFailed が発生すると、SKIPされる番号がある影響でずっと予約され続けて採番が成功しない問題があった。

2021-07-14 19:48:55.348 INFO    lerna.util.sequence.SequenceFactoryWorker$      akka://SequenceFactoryWorkerSpec/user/$c        -       dummy   Reserving sequence: remain 0, add 1, current max reserved: 3

2021-07-14 19:48:55.462 INFO    lerna.util.sequence.SequenceFactoryWorker$      akka://SequenceFactoryWorkerSpec/user/$c        -       dummy   Reserving sequence: remain 0, add 1, current max reserved: 13

2021-07-14 19:48:55.566 INFO    lerna.util.sequence.SequenceFactoryWorker$      akka://SequenceFactoryWorkerSpec/user/$c        -       dummy   Reserving sequence: remain 0, add 1, current max reserved: 23

2021-07-14 19:48:55.675 INFO    lerna.util.sequence.SequenceFactoryWorker$      akka://SequenceFactoryWorkerSpec/user/$c        -       dummy   Reserving sequence: remain 0, add 1, current max reserved: 33

TODO:
別Issue対応

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#44 reservationAmount = 1 での採番で無限ループのリスク · Issue #44 · lerna-stack/lerna-app-library

Copy link
Contributor

Choose a reason for hiding this comment

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

@tksugimoto
reserving から ready に戻すときに元の nextValue に戻すと問題がありますか?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

できそうですが、複雑になるので別のバグの発生を気にして選択しませんでした。

現状、結構複雑なので状態の整理をしたほうが良さそうです。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

val reservationAmount = 1 の場合に、予約失敗 SequenceStore.ReservationFailed が発生すると、SKIPされる番号がある影響でずっと予約され続けて採番が成功しない問題があった。

別Issue対応

  1. nextValue <= maxReservedValue の条件により stash
  2. ReservationFailed によって unstash & ready 遷移
  3. 無限ループ

という流れなのでこのPRの修正が原因(の一つ)だった

@tksugimoto tksugimoto changed the title Lerna util sequence/fix/sequence factory worker 採番時に確保(予約)失敗した場合に確保できていない番号が使用されてしまう問題を修正 Jul 14, 2021
@tksugimoto tksugimoto marked this pull request as ready for review July 14, 2021 11:20
@tksugimoto
Copy link
Contributor Author

tksugimoto commented Jul 19, 2021

このPRの対応だと問題があったので close
#44 reservationAmount = 1 での採番で無限ループのリスク · Issue #44 · lerna-stack/lerna-app-library

別 Issue で対応する
#49 [lerna-util-sequence] (Cassandra) SequenceStore での処理が失敗した場合正常に採番できない場合がある · Issue #49 · lerna-stack/lerna-app-library

@tksugimoto tksugimoto closed this Jul 19, 2021
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.

2 participants