Repository navigation
Fix / 문의번호 첫 날짜 경합 수정 및 락 대조 실험 - #140
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
첫 문의가 동시에 들어오면 날짜 순번 행 INSERT가 충돌해 정상 요청이 실패합니다. 날짜 행을
INSERT ... ON CONFLICT DO NOTHING으로 초기화한 뒤 기존 비관적 락으로 증가시키도록 변경했습니다. 문의 저장과 순번 변경은 같은 트랜잭션에 남겨 저장 실패 시 함께 롤백합니다.기존 행에 대한 락의 효과도 PostgreSQL 잠금 대기 관측과 락 제거 대조군으로 검증했습니다. Clock은 테스트에서만 날짜를 제어하며 운영은 기존 서버 기본 시간대 정책을 유지합니다.
Related Issue
PR Checklist
pg_blocking_pids로 기존 행의 두 번째 트랜잭션 대기와 해제 검증./gradlew clean build --no-daemon: 기본 테스트 13개, 실패·오류·스킵 0Additional Information
원본의 실패는 첫 행 생성 경합에서 발생했습니다. 모든 실험에서 DB 제약으로 저장된 번호 중복은 없었으나, 락 제거군은 정상 요청이 다수 실패했습니다. 회귀 테스트는 원본 12개 중 3개, 락 제거군 8개가 의도대로 실패하고 수정본은 모두 통과했습니다.
동시 작업 1/8/32/100, 날짜 행 없음/기존 40, 각 3회, 연결 풀 16 조건입니다. 실제 서비스/DB의 closed-loop 로컬 측정이며 HTTP·인증 구간이나 운영 최대 처리량 측정이 아닙니다. 수정본도 높은 동시성에서 잠금·풀 대기가 남고 일부 조건에서 추가 INSERT 비용이 보입니다. 속도 개선율을 주장하지 않습니다. 상세 반복값과 측정 한계는 보고서에 있습니다.
docs/inquiry-concurrency.mddocs/inquiry-experiment-results.mddocs/evidence/inquiry-20261014/python3 scripts/inquiry-experiment.py --output /absolute/new-directory스키마 변경 없음. 실험용 코드·락 제거 변형은 운영 빌드에 반영되지 않습니다. 실험은 기본 CI에서 제외하고 회귀 테스트만 자동 실행합니다. 병합·배포는 수행하지 않았습니다. 별도 자동 리뷰는 모델 용량 오류로 실행되지 않아 작성자가 변경·증거를 직접 점검했으며 사람의 PR 리뷰가 필요합니다.
GitHub CI 확인
Test workflow 성공(1분 27초). CodeRabbit 체크는 리뷰 생략 상태이므로 코드 리뷰 통과로 해석하지 않습니다.