Skip to content

[NOOK-189] 사용자 저장 게시물별 장소 연결 분리 - #122

Merged
dh1010a merged 1 commit into
mainfrom
codex/NOOK-189
Aug 16, 2026
Merged

[NOOK-189] 사용자 저장 게시물별 장소 연결 분리#122
dh1010a merged 1 commit into
mainfrom
codex/NOOK-189

Conversation

@dh1010a

@dh1010a dh1010a commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

목적

동일 Instagram URL의 파싱 원본은 재사용하되, 사용자가 저장한 게시물의 장소 추가·삭제가 다른 사용자에게 영향을 주지 않도록 장소 연결의 소유 경계를 사용자 저장 게시물로 분리합니다.

범위

  • user_saved_post_places 테이블과 기존 관계 backfill DDL 추가
  • 신규 저장 및 공용 장소 파싱 완료 시 사용자 저장 게시물별 장소 관계 복사
  • 게시물·그룹·지도·장소 조회를 사용자별 장소 관계 기준으로 전환
  • 수동 장소 추가를 사용자 저장 게시물에만 반영
  • DELETE /api/v1/posts/{postId}/places/{placeId} 장소 연결 삭제 API 추가
  • 사용자 간 장소 관계 격리 및 마이그레이션 메타데이터 테스트 추가

제외 범위

  • Instagram 원본 콘텐츠·미디어·해시태그의 사용자별 물리 복제
  • 공용 장소 데이터 삭제 또는 사용자별 장소 복제
  • 동일 사용자의 동일 Instagram URL 중복 저장

검증

  • ./gradlew --no-daemon check
  • 개발 DB user_saved_post_places 생성 및 기존 552개 관계 backfill 확인
  • 예상 552건 / 저장 552건 / 누락 0건

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a0ce005be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +31 to +32
FROM user_saved_posts saved_post
INNER JOIN post_places post_place ON post_place.post_id = saved_post.post_id;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Repeat the backfill after legacy writers stop

During a rolling deployment, this one-time INSERT ... SELECT can finish while old-version instances continue creating user_saved_posts or post_places; those instances never write user_saved_post_places, and the new code has no reconciliation path for an already-created saved post, so affected users permanently see missing places after the rollout. Either dual-write during the transition or run an idempotent catch-up backfill after every legacy instance has stopped.

AGENTS.md reference: AGENTS.md:L40-L41

Useful? React with 👍 / 👎.

Comment on lines +122 to +124
userSavedPostLockRepository.findAllByPostIdForUpdate(postId).forEach { savedPost ->
val savedPostId = requireNotNull(savedPost.id)
userSavedPostPlaceRepository.insertAllFromPost(savedPostId, postId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Serialize parsing completion with concurrent saves

When a new user saves this source while completion is in progress, the save transaction can hold its new user_saved_posts row while insertAllFromPost waits on the uncommitted post_places writes, and this FOR UPDATE query then waits on that saved-post row, forming a MySQL lock cycle. One transaction is aborted, potentially returning a 500 from the save path or delaying parsing until timeout because no deadlock retry exists; acquire the same source-post lock/order used by PostPersistenceAdapter or add an explicit retry/reconciliation strategy.

AGENTS.md reference: AGENTS.md:L52-L54

Useful? React with 👍 / 👎.

@dh1010a
dh1010a merged commit 488733c into main Aug 16, 2026
2 checks passed
@dh1010a
dh1010a deleted the codex/NOOK-189 branch August 16, 2026 08:31
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