-
Notifications
You must be signed in to change notification settings - Fork 3
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
[머지 금지!] 리뷰용입니다 #455
Open
0chil
wants to merge
7
commits into
backend
Choose a base branch
from
refactor/add-aggregate-for-review
base: backend
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[머지 금지!] 리뷰용입니다 #455
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4c84cb2
refactor: Member에서 MemberGenre 분리
thdwoqor ced8821
feat: 멤버 장르 Id를 UUID로 변경
thdwoqor 2a897a4
refactor: ddl-auto 옵션 변경
thdwoqor a15d679
feat: 예외 처리 및 주입받고있는 service를 repository로 변경
thdwoqor fca2310
remove: dislikeRooms 삭제
thdwoqor 8d8b396
refactor: 패키지 이동
thdwoqor 433fa53
test: 멤버 장르 가중치 테스트 작성
thdwoqor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
backend/src/main/java/com/digginroom/digginroom/controller/RoomController.java
This file contains 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
29 changes: 29 additions & 0 deletions
29
backend/src/main/java/com/digginroom/digginroom/domain/UUIDBaseEntity.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.digginroom.digginroom.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
import lombok.Getter; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
@Getter | ||
@MappedSuperclass | ||
@EntityListeners(AuditingEntityListener.class) | ||
public abstract class UUIDBaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.UUID) | ||
private UUID id; | ||
@CreatedDate | ||
@Column(updatable = false) | ||
private LocalDateTime createdAt; | ||
@LastModifiedDate | ||
private LocalDateTime updatedAt; | ||
} |
39 changes: 0 additions & 39 deletions
39
backend/src/main/java/com/digginroom/digginroom/domain/member/DislikeRooms.java
This file was deleted.
Oops, something went wrong.
This file contains 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
41 changes: 0 additions & 41 deletions
41
backend/src/main/java/com/digginroom/digginroom/domain/member/MemberGenres.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...om/digginroom/domain/member/Nickname.java → ...digginroom/domain/member/vo/Nickname.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...om/digginroom/domain/member/Password.java → ...digginroom/domain/member/vo/Password.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...om/digginroom/domain/member/Provider.java → ...digginroom/domain/member/vo/Provider.java
This file contains 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
This file contains 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
This file contains 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
16 changes: 8 additions & 8 deletions
16
...digginroom/domain/member/MemberGenre.java → ...nroom/membergenre/domain/MemberGenre.java
This file contains 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
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/com/digginroom/digginroom/membergenre/domain/MemberGenreEvent.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.digginroom.digginroom.membergenre.domain; | ||
|
||
import com.digginroom.digginroom.domain.Genre; | ||
import com.digginroom.digginroom.membergenre.domain.vo.WeightFactor; | ||
|
||
public interface MemberGenreEvent { | ||
|
||
Genre getGenre(); | ||
|
||
Long getMemberId(); | ||
|
||
WeightFactor getWeightFactor(); | ||
} |
11 changes: 11 additions & 0 deletions
11
...end/src/main/java/com/digginroom/digginroom/membergenre/domain/MemberGenreRepository.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.digginroom.digginroom.membergenre.domain; | ||
|
||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface MemberGenreRepository extends JpaRepository<MemberGenre, Long> { | ||
|
||
List<MemberGenre> findByMemberId(final Long memberId); | ||
|
||
boolean existsByMemberId(Long memberId); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id를 UUID로 하는 이유가 있을까요?
UUID를 기준으로 데이터를 저장하면 클러스터링 인덱스로 인한 장점을 모두 잃어버리는 것 같은데 이 부분을 변경하신 이유가 있으신지 궁금합니다. ㅎㅎ
제가 생각한 단점들은 다음과 같아요.
cf) 처음 UUID를 도입한 목적이 무엇이신가요? - 땡칠 질문
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 비슷한 다른 작업(페이징)을 하다가 이 질문에 대해 생각나서 결정에 도움이 될까 답을 달아봅니다~
기술적으로 사실입니다.
UUID를 도입하게 되어 지금의 정렬 기준을 createdAt + UUID로 대체하게 된다면?
createdAt 및 UUID로 세컨더리 인덱스를 만들고 유지하는 것은 sequential id에 비해 읽기 뿐 아니라 쓰기 성능도 후퇴하게 됩니다.
게다가 id 자체도 크기도 작고 연산도 단순한 숫자 id에 비해서 사전순으로 정렬하는데 더 많은 연산이 필요하므로
sequential id에 비해 몇 배 이상 느려질 가능성이 있습니다.
대신 UUID를 사용하면, 기존에 PK에 의미를 부여(생성 순서대로 정렬된다)하고 의존하던 것을 벗어날 수 있어서 확장성을 늘릴 수 있을 것이라는 생각이 들었습니다.
PK에 의미를 부여하고 의존하게 되면, PK가 관리(락)되는 범위(단일 DB 인스턴스)에서 벗어나기 어렵습니다.
이 경우 DB를 다중화한다면 별도의 동기화가 필요할 거라고 추측이 드네요.
하지만 UUID를 사용하면 DB 복제, 다중화가 용이해져서 인프라 차원에서 학습을 위한 다양한 경험을 할 수 있는 기반이 될 것이라고 생각합니다.
~를 블랙캣과 파워가 얘기하고 싶었던게 아닐까 라는 생각이 들었습니다 ㅋㅋㅋ