Skip to content

[Fix] 컬렉션 권한 캐시 N+1 제거 및 @Modifying 안전성 보완 - #20

Merged
kangcheolung merged 5 commits into
developfrom
feature/18
Jul 15, 2026
Merged

[Fix] 컬렉션 권한 캐시 N+1 제거 및 @Modifying 안전성 보완#20
kangcheolung merged 5 commits into
developfrom
feature/18

Conversation

@kangcheolung

Copy link
Copy Markdown
Member

🔍 작업 내용

CodeRabbit 리뷰 반영 — 이전 PR(#19) 머지 이후 추가된 성능 개선

✨ 상세 설명

  • revoke: 문서 N개 루프 → bulkRevokeBySource 단일 UPDATE (201번 → 1번)
  • grant: 개별 upsert 루프 → bulkUpdateBySource + saveAll 배치 (201번 → 3번)

@Modifying 안전성

  • clearAutomatically = true 추가 — 벌크 UPDATE 후 1차 캐시와 DB 불일치 방지

💬 리뷰 요구사항

  • bulkGrantUserPermission 흐름 (UPDATE → 누락 ID 조회 → saveAll) 확인 부탁

kangcheolung and others added 5 commits July 15, 2026 20:04
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
컬렉션 권한 N+1 해결을 위한 @Modifying 벌크 UPDATE/SELECT 쿼리 추가
- bulkInvalidateBySource: sourceType+sourceId 기준 일괄 invalidate
- bulkUpdateBySource: sourceType+sourceId 기준 일괄 갱신
- findDocumentIdsByUserIdAndSourceTypeAndSourceId: 기캐시 문서 ID 조회

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
컬렉션 권한 N+1 해결을 위한 bulk grant/revoke 메서드 추가
- bulkGrantUserPermission: 일괄 UPDATE 후 누락분만 saveAll 배치 INSERT
- bulkRevokeBySource: 단일 @Modifying UPDATE로 전체 무효화

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
컬렉션 권한 부여/회수 시 루프 기반 캐시 처리를 벌크 메서드로 교체
- revokePermission: 문서 목록 조회 루프 → bulkRevokeBySource 단일 쿼리
- updateCacheForCollection: 개별 grantUserPermission → bulkGrantUserPermission

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
벌크 UPDATE 후 같은 트랜잭션에서 1차 캐시(영속성 컨텍스트)와
DB 값이 어긋나는 문제를 방지

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kangcheolung
kangcheolung merged commit cbae485 into develop Jul 15, 2026
1 check was pending
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kangcheolung, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 21 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f65fb9f-2685-4554-867f-c82b77ad9a46

📥 Commits

Reviewing files that changed from the base of the PR and between 59ad5c9 and f5f9c29.

📒 Files selected for processing (4)
  • .claude/rules/deploy.md
  • src/main/java/com/opensource/docgrid/domain/permission/repository/UserDocumentAccessCacheRepository.java
  • src/main/java/com/opensource/docgrid/domain/permission/service/command/CollectionPermissionCommandService.java
  • src/main/java/com/opensource/docgrid/domain/permission/service/command/UserDocumentAccessCacheService.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/18

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant