아마존 Aurora DSQL로 만든 레스토랑 대기열 앱, 테이블이 두 번 예약되는 것을 방지하는 방법

발행: (2026년 6월 17일 PM 08:19 GMT+9)
2 분 소요
원문: Dev.to

출처: Dev.to

TableTurn을 H0: Hack the Zero Stack 해커톤을 위해 만들었습니다. 이는 아마존 오라클 Aurora DSQL와 Vercel 위에 구축된 레스토랑 대기열 및 테이블 관리 앱입니다. #H0Hackathon

await sql.begin(async (tx) => { SELECT id, status FROM tables WHERE id = ${table_id} FOR UPDATE; UPDATE tables SET status = ‘occupied’ WHERE id = ${table_id}; UPDATE parties SET status = ‘seated’, table_id = ${table_id} WHERE id = ${id}; })

이 코드를 직접 두 개의 curl 요청으로 같은 테이블을 대상으로 테스트했습니다. 첫 번째는 성공을 반환했고, 두 번째는 “Table just taken by another host.” 라는 오류를 반환했습니다. 이는 Aurora DSQL의 시리얼라이저블 이소레이션이 작동하고, 레이스 조건을 방지하는 애플리케이션 수준 검증이 아님을 의미합니다.

https://tableturn-steel.vercel.app GitHub: https://github.com/ekpenyongasuquo/tableturn

0 조회
Back to Blog

관련 글

더 보기 »

조합 합계 | 백트래킹

leetcode.com Given an array of distinct integers candidates and a target value target, return all unique combinations where the chosen numbers sum to the target...