-
Notifications
You must be signed in to change notification settings - Fork 3
[Feature] 화이트보드 오브젝트의 실시간 데이터 일관성을 보장하기 위한 레지스터 구현 #151
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
Conversation
구현하면서 고민한 부분들커밋 내용과 함께 그 외에 여러번 지운 커밋들이 갖고 있는 고민과 플로우에 대해서 적어보았습니다.
자세한 내용은 딴의 일일 개발회고에 있으니 궁금하면 간단하게 읽어보시길! |
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.
정말 고생하셨습니다!!!!
몇 가지 궁금한 점이 있는데요, WhiteboardObjectRegisters의 동작 방식이 기존의 WhiteboardObjectSet과 유사하다고 느꼈습니다. 이제 저희 Airplain이 겪고 있던 동시성 문제를 해결할 수 있었다고 하셨는데, WhiteboardObjectSet이 WhiteboardObjectRegisters로 대체되는 것일까요? (물론 이 부분은 아직 WhiteboardObjectRegisters를 실제 코드에서 사용하는 부분이 없어 헷갈리는 것 같긴 합니다)
LWWRegister 자체를 struct로 설계한 부분은 정말 좋다고 생각합니다. 혹시 이 부분은 데이터의 불변성을 고려하신 것인지 궁금합니다. (동시성 문제를 줄이고 안정성을 높이기 위한!!) 만약 불변성을 염두에 두셨다면, struct 내부에 있는 레퍼런스 타입(whiteboardObject)의 내부 상태 변화에 대해서도 고려하신건지 궁급합니다!
| } | ||
|
|
||
| public static func < (lhs: Timestamp, rhs: Timestamp) -> Bool { | ||
| if lhs.updatedAt == rhs.updatedAt { return lhs.updatedBy < rhs.updatedBy } |
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.
오 요 부분 덕분에 updatedAt이 같더라도, 우선 순위가 생기겠군요 죠습니다 🦈
WhiteboardObjectRegisters가 기존의 WhiteboardObjectSet을 대체하는 것인지?맞습니다. 크게 변한 부분은 없이 LWWRegisterSet을 갖고 수정하도록 했습니다. struct로 구현 했지만 내부 프로퍼티인 WhiteboardObject에 대한 상태 변화제 일일 개발회고 가장 아래쪽 제목을 보면 어떻게 데이터 불변성과 함께 동시성 문제를 고려했는지 확인하실 수 있습니다.
|
답변 감사합니다! 다만 조금 더 자세히 예를 들면 아래와 같은 상황이 있을 것 같습니다. |
이에 더해서 고려하고 계신 부분인 화이트보드오브젝트가 레퍼런스 타입이라 동시 접근이 가능할 수도 있다 라는 경우를 생각해 봤을 때는,
이부분에 대해서 이 후 리팩토링과 LWW 적용 단계에서 더 수정할 계획이긴합니다! |
|
@taipaise |
choijungp
left a comment
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.
아직 .... 액터에 대한 공부가 많이 필요하지만 ....
덕분에 LWW 알고리즘에 대해서 알 수 있었슴니다 !!! !!
굿쟙 C팀 !!!!!!!! 어푸 어푸 고생하셨습니다 !! 👍🏻
taipaise
left a comment
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.
고생하셨습니다!!!!! 피드백 감사합니다 :) 리팩까지 파이팅!!
🌁 Background
화이트보드 오브젝트의 실시간 데이터 일관성을 보장하기 위해 레지스터를 구현 했습니다.
👩💻 Contents
화이트보드 오브젝트의 실시간 데이터 일관성을 보장하기 위해서 CRDT의 LWW 알고리즘을 사용했습니다.
해당 알고리즘을 적용한 Register를 구현하여 화이트보드 오브젝트의 데이터가 시간상 이후에 들어온 데이터로 일관성을 갖게 했습니다.
노션페이지: 실시간 데이터 일관성 보장하기
✅ Testing
LWWRegister
timestamp가 같을 때
새로 들어온 timestamp가 작을때
새로 들어온 updatedAt이 더 빠를 때
updatedAt은 같지만 UUID가 작을때
새로 들어온 timestamp가 클 때
새로 들어온 updatedAt이 더 느릴 때
updatedAt은 같지만 UUID가 클 때
📝 Review Note
📣 Related Issue