Closed
Conversation
# Conflicts: # apps/commerce-api/src/test/java/com/loopers/domain/point/PointServiceIntegrationTest.java # apps/commerce-api/src/test/java/com/loopers/domain/user/UserUnitTest.java # apps/commerce-api/src/test/java/com/loopers/interfaces/api/PointV1E2ETest.java
포인트 사용 기능 추가
# Conflicts: # .codeguide/loopers-1-week.md # apps/commerce-api/src/main/java/com/loopers/CommerceApiApplication.java # apps/commerce-api/src/main/java/com/loopers/application/example/ExampleFacade.java # apps/commerce-api/src/main/java/com/loopers/application/example/ExampleInfo.java # apps/commerce-api/src/main/java/com/loopers/domain/example/ExampleModel.java # apps/commerce-api/src/main/java/com/loopers/domain/example/ExampleService.java # apps/commerce-api/src/main/java/com/loopers/infrastructure/example/ExampleJpaRepository.java # apps/commerce-api/src/main/java/com/loopers/infrastructure/example/ExampleRepositoryImpl.java # apps/commerce-api/src/main/java/com/loopers/interfaces/api/ApiControllerAdvice.java # apps/commerce-api/src/main/java/com/loopers/interfaces/api/ApiResponse.java # apps/commerce-api/src/main/java/com/loopers/interfaces/api/example/ExampleV1ApiSpec.java # apps/commerce-api/src/main/java/com/loopers/interfaces/api/example/ExampleV1Controller.java # apps/commerce-api/src/main/java/com/loopers/interfaces/api/example/ExampleV1Dto.java # apps/commerce-api/src/main/java/com/loopers/support/error/ErrorType.java # apps/commerce-api/src/test/java/com/loopers/domain/example/ExampleModelTest.java # apps/commerce-api/src/test/java/com/loopers/domain/example/ExampleServiceIntegrationTest.java # apps/commerce-api/src/test/java/com/loopers/interfaces/api/ExampleV1ApiE2ETest.java # apps/commerce-api/src/test/java/com/loopers/support/error/CoreExceptionTest.java
1주차 작업물 병합
[volume-1] 사용자, 포인트 도메인 기능 구현
리뷰 기반 사용자, 포인트 도메인 기능 개선
리뷰 기반 사용자, 포인트 로직 및 이슈 개선
- ProductLikeStatsSyncScheduler에서 동기화 실패율 경고 로직 추가 - LikeIntegrationTest에서 MV 테이블 실시간 업데이트 검증 로직 추가 - LikeFacade에서 불필요한 RedisLockService 의존성 제거
상품, 브랜드, 좋아요 정보를 통합하여 조회 성능을 최적화하기 위한 Materialized View 엔티티를 추가
- JPA 및 QueryDSL을 활용한 상품 MV 데이터 접근 계층 추가 - 상품 ID, 브랜드 ID, 상품명으로 MV를 조회하는 메서드 구현 - MV 엔티티의 저장 및 삭제 기능 추가
- 배치 업데이트 결과를 담는 BatchUpdateResult DTO 구현 - 상품 Materialized View를 조회하고 동기화하는 ProductMVService 추가 - 상품, 브랜드, 좋아요 정보를 통합하여 MV를 생성 및 업데이트하는 로직 구현
- 상품 ID로 활성 상품 정보를 조회하는 메서드 추가 - 삭제되지 않은 상품만 반환하도록 구현
- ProductMaterializedViewEntity를 사용하여 상품 상세 정보를 조회하는 메서드 추가 - 기존 ProductEntity 기반 메서드는 deprecated 처리 - MV 테이블을 활용한 조회로 성능 개선 및 조인 제거
상품 검증 로직에서 비활성 상품을 조회하는 부분을 활성 상품만 조회하도록 수정하여 정확한 재고 관리를 위한 개선 작업 수행
- ProductLikeStatsService 의존성 제거 - 좋아요 등록 및 취소 시 통계 업데이트 로직 삭제 - ProductFacade에서 좋아요 수 조회 로직을 LikeService로 이동
- 특정 상품 및 브랜드의 캐시를 무효화하는 메서드 추가 - MV 동기화 후 변경된 상품과 영향받은 브랜드의 캐시를 선택적으로 무효화 - ProductMVBatchScheduler 클래스 추가로 주기적인 MV 동기화 및 캐시 갱신 기능 구현
- 변경된 상품 ID 목록과 영향받은 브랜드 ID 목록을 추가하여 배치 업데이트 결과를 보다 명확하게 전달 - 성공 및 실패 결과 생성 메서드에서 해당 정보를 처리하도록 수정
- Hot/Warm/Cold 데이터 캐싱 전략 검증을 위한 통합 테스트 구현 - 각 캐싱 전략에 대한 테스트 케이스 추가 - 캐시 무효화 및 캐시 히트/미스 시나리오 포함
- 캐시 키 생성기 주석을 간결하게 수정 - 캐시 전략 설명을 명확하게 업데이트 - 배치 갱신 스케줄러 및 캐시 서비스 관련 주석 정리
- BatchUpdateResult, ProductDetailInfo, ProductInfo의 주석을 간소화하여 가독성을 높임 - ProductCacheService에서 레거시 TTL 상수 제거 - ProductCacheStrategyIntegrationTest의 테스트 설명 수정
- 불필요한 주석 제거 및 문서 간소화 - 실행 방법 설명을 간결하게 수정
- Hot 캐시의 TTL을 30분으로 조정하여 데이터 갱신 주기를 단축 - 관련 주석 및 문서 업데이트 - MV 테이블 동기화 및 캐시 갱신 로직 개선
- 브랜드 데이터 생성 로직 추가 및 배치 저장 구현 - 상품 데이터 생성 시 브랜드와의 연관성 강화 - 코드 가독성 향상을 위한 주석 및 메서드 정리
- 브랜드 데이터 생성 로직 추가 및 배치 저장 구현 - 상품 데이터 생성 시 브랜드와의 연관성 강화 - 코드 가독성 향상을 위한 주석 및 메서드 정리
- Product, Brand, Like를 단일 쿼리로 조인하여 변경된 데이터만 조회하는 로직 추가 - MV 동기화 시 불필요한 개별 쿼리 제거 및 변경 감지 방식 개선 - ProductMVSyncDto 도입으로 배치 동기화 효율화 - 상품/브랜드/좋아요 변경 시 MV 테이블에 반영되는 동기화 로직 최적화 - 대용량 상품 데이터 생성 규칙 및 브랜드명 유니크 처리 강화
- 코드 내 불필요한 설명 및 중복 로직 제거로 가독성 향상
- 캐시 전략에 따라 MV 엔티티 조회 로직 통합 - MV에 없는 상품 폴백 조회 및 DTO 변환 로직 분리 - 상품 상세 조회 시 캐시, MV, 폴백 순서로 조회 후 좋아요 상태 반영 - ProductService에 MV 조회 및 누락 상품 ID 탐지 기능 추가 - 불필요한 @deprecated 제거 및 주석 정비
- ProductFacade에서 MV 폴백 조회 및 예외 처리 방식 단순화 - ProductService, ProductMVService의 MV 조회 메서드 명확화 및 불필요한 메서드 제거 - Javadoc 주석 간소화로 가독성 향상
- 상품 상세 조회 시 사용자 좋아요 상태 동기화 방식 개선 - 불필요한 폴백 및 좋아요 상태 적용 메서드 제거 - MV 삭제 시 동기화 로직 단순화 - 레거시 생성자 및 불필요한 코드 정리
- MV 엔티티 캐싱 및 조회 로직을 ProductMVService로 이동 - ProductService에서 관련 코드 및 의존성 제거 - ProductFacade에서 MV 조회 시 ProductMVService 사용하도록 변경
- ProductSearchFilter 기반 페이징 조회 기능 추가 - MV 조회, 캐싱, 배치 동기화 로직에 통합 검색 필터 적용 - 불필요한 개별 조회 메서드 및 중복 로직 제거 - MV 변경 비교 메서드 위치 및 호출 방식 개선
|
Important Review skippedMore than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review. 46 files out of 169 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits. You can disable this status message by setting the ✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
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.
📌 Summary
💬 Review Points
좋아요 수 관리:
ProductEntity의 likeCount를 제거하고, **Materialized View(MV)**에서 집계·정렬을 담당하도록 변경했습니다. 실시간 정합성 대신 배치 기반(2분 주기) 일관성을 택했습니다. 대안으로는 DB 트리거, 이벤트 스트림(Kafka) 기반 실시간 집계도 있겠지만, 저는 운영 단순성과 조회 성능 균형을 위해 배치를 선택했습니다.
MV 동기화 범위:
lastBatchTime 이후 변경분만 동기화하는 증분 배치를 구현했습니다(ProductMVSyncDto). 전량 스캔/재작성도 가능하지만, 저는 변경점 기반으로 저장소·락 비용을 줄이는 쪽을 택했습니다.
캐싱 전략:
목록은 Hot/Warm/Cold로 나눠 TTL/갱신 방식을 차등 적용했습니다(예: 인기순 1페이지 HOT, 2–3페이지 WARM, 그 외 COLD 미사용). 전면 Cache-Aside 하나로 단순화하거나, 모든 구간을 배치 프리컴퓨트로 일원화하는 방법도 있지만, 저는 트래픽 특성에 맞춘 단계적 캐싱을 선택했습니다.
캐시 키·무효화:
ID 리스트만 캐싱하고, MV 배치 후 변경 상품/브랜드만 선택적 무효화합니다. 운영 환경에서 Redis KEYS 패턴의 비용 이슈가 있어 SSCAN/키 인덱스 테이블 같은 대안도 고려 여지가 있지만, 지금은 영역·패턴 기준 삭제로 단순성을 유지했습니다.
정렬 기준 일원화:
좋아요 정렬은 MV의 like_count를 기준으로 통일했고, 원본 Product 쿼리에서는 제거했습니다. 조인 없이 일관된 성능을 얻기 위함입니다. 대안은 원본 테이블 + 집계 테이블 조인 정렬이지만, 저는 읽기 경로 단순화를 우선했습니다.
사용자 좋아요 동기화:
상세 캐시가 히트될 때 isLiked만 동기화하여 사용자 경험을 보장합니다. 캐시 본문을 매 요청 재생성하는 방법도 있으나, 저는 캐시 본문 유지 + 최소 필드 동기화로 응답/캐시 효율을 선택했습니다.
✅ Checklist
📎 References