fix(turn): roll back checkpoint with world state

This commit is contained in:
2026-07-31 16:11:56 +00:00
parent b193b2a0f6
commit 885018c7fd
4 changed files with 58 additions and 9 deletions
+5 -2
View File
@@ -38,7 +38,8 @@ artifact를 만들며 `Pm2ProcessManager`가 profile process를 조정합니다.
`GatewayRuntimeAction`으로 접수합니다. Profile별 `REQUESTED`/`PARTIAL`
DB partial unique index로 한 건만 허용합니다. Turn daemon은 자신의 lease를
확인한 뒤 action ID로 결정적인 `InputEvent`를 만들고, world·전 장수·OPEN
경매·checkpoint를 같은 PostgreSQL transaction에서 이동합니다. Commit 뒤
경매 같은 PostgreSQL transaction에서, checkpoint는 이를 감싼 동일
`EngineStateManager` snapshot 경계에서 이동합니다. Commit 뒤
경매 timer와 활성 토너먼트 시각을 Redis에 idempotent하게 투영합니다.
Redis 단계가 실패하면 action은 `PARTIAL`과 backoff 상태로 남고 DB 시간은
다시 이동하지 않습니다.
@@ -89,13 +90,15 @@ lease/fencing 확인
-> EngineStateManager transaction
-> world/general/nation/city/turn/log flush
-> input_event result/status 갱신
-> checkpoint 갱신
-> in-memory world checkpoint 갱신
-> commit
-> realtime 알림
```
Transaction 실패 시 in-memory snapshot을 복원하고 event는 재시도 가능한 실패
상태로 남깁니다. Lease 소유권을 잃은 daemon은 flush를 확정하지 않습니다.
Checkpoint의 단일 소유자는 `InMemoryTurnWorld`이며 state store는 이를
위임 조회합니다. 별도 checkpoint 복사본이 snapshot보다 앞서 나가지 않습니다.
예약 턴은 revision/CAS와 lease를 사용합니다. API의 편집과 daemon의 실행이
경합해도 오래된 revision이 새 queue를 덮어쓰지 않게 합니다.