Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix : 시간표 프레임 삭제 동시성 #731

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

kwoo28
Copy link
Contributor

@kwoo28 kwoo28 commented Jul 26, 2024

🔥 연관 이슈

🚀 작업 내용

image
findFirstByUserIdAndSemesterIdAndIsMainFalseOrderByCreatedAtAsc()메서드에 베타락을 걸어도 여전히 위와같은 2개의 트랜잭션이 동시에 접근되는 상황에서 여전히 동시성 에러가 발생되고 있습니다. 이유는 사진과 같이 findById는 여전히 해당 레코드를 공유하여 접근하기 때문에 충돌이 발생합니다.

그래서 findById메서드 또한 베타락을 걸어서 다른 트랜잭션에서 findById 사용할때 해당 레코드에 동시에 접근하는 것을 막게 수정했습니다.

💬 리뷰 중점사항

@kwoo28 kwoo28 self-assigned this Jul 26, 2024
@github-actions github-actions bot added the 버그 정상적으로 동작하지 않는 문제상황입니다. label Jul 26, 2024
Copy link

Unit Test Results

  29 files    29 suites   2m 35s ⏱️
246 tests 245 ✔️ 1 💤 0
247 runs  246 ✔️ 1 💤 0

Results for commit 2b0cc7d.

Copy link
Contributor

@duehee duehee left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~

@@ -18,6 +18,11 @@ public interface TimetableFrameRepositoryV2 extends Repository<TimetableFrame, I

Optional<TimetableFrame> findById(Integer id);

@Lock(LockModeType.PESSIMISTIC_WRITE)
@Query("SELECT t FROM TimetableFrame t WHERE t.id = :id")
Optional<TimetableFrame> findByIdWithLock(@Param("id") Integer id);
Copy link
Contributor

Choose a reason for hiding this comment

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

A

findById 자체에 Lock을 거는 것을 생각했는데, 메소드를 따로 분리하셨네요!👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

findById는 delete뿐 아니라 여러 트랜잭션에서 사용되는거라 필요한 상황에서만 쓸 수 있게 분리시켰습니다ㅋㅋ

Copy link
Member

@Choi-JJunho Choi-JJunho left a comment

Choose a reason for hiding this comment

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

LGTM

@kwoo28 kwoo28 merged commit f9a72e8 into develop Jul 29, 2024
6 checks passed
@kwoo28 kwoo28 deleted the fix/730-delete-frame-concurrency branch July 29, 2024 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
버그 정상적으로 동작하지 않는 문제상황입니다.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

시간표 프레임 삭제 동시성
3 participants