Skip to content

Conversation

@caniro
Copy link
Contributor

@caniro caniro commented Jun 11, 2025

✨ 작업내용


🐞 이슈사항

이슈 번호 제목 상태
#149 [BE] 동시성 이슈 해결 ✅ 해결

⚠️ 특별사항

  • Read Committed, 비관적 락 사용해서 조치 완료했습니다.
  • 개인적인 견해로는 저희 비즈니스 로직 상 Read Committed로 인해 정합성 관련 발생할 이슈는 없을 것 같은데, 데이터 정합성 테스트는 추후 작성하겠습니다.
  • DB 인덱스 추가를 통해 동일 테이블 조회 시에도 데드락을 방지해야 합니다. (main 브랜치 병합 시 적용 必)
    CREATE INDEX idx_wallet_account_id_ticker ON wallet (account_id, ticker);
    CREATE INDEX idx_account_user_id ON account (user_id);
  • 다른 의견 있으시면 코멘트 부탁드립니다.
  • @Junh-b concurrency 브랜치에 커밋하셨던 코드들 중 일부 cherry-pick 해왔으니 확인 부탁드립니다.
  • @109an94 현재 진행 중인 PR 먼저 dev에 병합해주시면 제가 여기 병합해서 올릴게요

caniro and others added 13 commits June 8, 2025 20:58
local용 gitignore추가
단일 종목에 대해 여러 주문들이 동시에 들어온다고 하더라도, 체결은 종목마다 단일 스레드에서 처리되도록 수정했습니다.
동시성 이슈를 비관적 락 + repeatable_read로 대응한 버전입니다.
주문이 user 패키지에 정의된 repository를 참조하도록 변경했습니다.
lock, timeout등의 공통로직들이 적용되어야 하기 때문에 통합시키는것이 좋다고 판단했습니다.
동시성 테스트를 추가하면서 테스트 내용을 더 잘 분석할 수 있도록 로그 설정과 base 테스트를 수정했습니다.
@caniro caniro requested review from 109an94, Junh-b and bongj9 June 11, 2025 12:50
Copy link
Contributor

@Junh-b Junh-b left a comment

Choose a reason for hiding this comment

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

수정내용 확인했습니다.
account, wallet 관련 로직도 더 깔끔해졌고, 동시성 이슈도 실마리가 보여서 이번 pr로 큰산 하나를 넘은 것 같네요

gitignore, build.gradle 등 수정 내역중 일부는 dev에 합쳐지지 않는 것이 좋을 것 같아 리뷰를 남겨드렸으니 확인 부탁드립니다.
나머지 작은 수정사항들은 제가 별도 브랜치에서 수정토록 하겠습니다.

Copy link
Contributor

@109an94 109an94 left a comment

Choose a reason for hiding this comment

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

티커별로 단일 쓰레드 처리하는 거 배워갑니다
그리고 dev로 병합했는데 아까 tradequeuemanager에 import 바꾼거 commit하면 안됐는데 해버려서.. 여기 충돌난거 같습니다 ㅜㅜ @caniro

@caniro
Copy link
Contributor Author

caniro commented Jun 12, 2025

티커별로 단일 쓰레드 처리하는 거 배워갑니다 그리고 dev로 병합했는데 아까 tradequeuemanager에 import 바꾼거 commit하면 안됐는데 해버려서.. 여기 충돌난거 같습니다 ㅜㅜ @caniro

TradeQueueManager를 아예 삭제해서 상관없습니다 ㅋㅋ 리뷰 감사합니다

Junh-b and others added 4 commits June 12, 2025 13:18
테스트 편의를 위해 잠시 추가했었던 설정 수정내용을 원래대로 복원했습니다.
각 영역에서 별도의 목적으로 사용중이던 Repository 클래스를 제거하고, 통일된 Repository를 사용하도록 변경했습니다.
# Conflicts:
#	src/main/java/com/cleanengine/coin/trade/application/TradeQueueManager.java
@caniro caniro requested a review from Junh-b June 12, 2025 07:07
@investfuture-sonarqube1
Copy link

Failed Quality Gate failed

  • 18 New Issues (is greater than 0)
  • 0.00% Coverage on New Code (is less than 80.00%)

Project ID: CleanEngine_cleanengine-be_2b6f2f63-fa39-426c-b9c7-8aa127fd14d8

View in SonarQube

@caniro caniro merged commit 010c106 into dev Jun 12, 2025
1 check passed
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.

[BE] 동시성 이슈 해결 [BE] - DB 계좌 Record has changed since last read 에러 발생

4 participants