-
Notifications
You must be signed in to change notification settings - Fork 49
FEAT: add support for shard key in ketama hashing #1025
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
base: develop
Are you sure you want to change the base?
Conversation
src/main/java/net/spy/memcached/ArcusReplKetamaNodeLocator.java
Outdated
Show resolved
Hide resolved
3c2d05c to
0b1d784
Compare
0b1d784 to
609d705
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
609d705 to
05d6ef7
Compare
05d6ef7 to
0930062
Compare
0930062 to
3e147e9
Compare
3e147e9 to
e4c2caf
Compare
|
https://github.com/jam2in/arcus-works/issues/790#issuecomment-3629954750 위에서 코멘트 주신대로 |
e4c2caf to
7aa0868
Compare
| ); | ||
|
|
||
| for (String key : keys) { | ||
| assertEquals("100", replLocator.getShardKey(key)); |
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.
직접 Locator 생성해서 테스트하는 케이스(unit test)는 ArcusKetamaNodeLocatorTest 로 옮기는 게 나아보입니다.
그러면 이 클래스에서는 client쪽에서 shard key가 담긴 키에 대한 요청을 서버에 보낼 때(integration test) 어떻게 처리하는지만 검증하면 됩니다.
| } | ||
|
|
||
| @Override | ||
| public boolean getUseShardKey() { |
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.
set/get 형태 말고 enableShardKey / isShardKeyEnabled 메서드명은 어떤가요?
7aa0868 to
67e1908
Compare
|
|
67e1908 to
24f0d77
Compare
|
리뷰 가능한 상태가 되면 요청 주세요. |
🔗 Related Issue
⌨️ What I did
원하는 key string을 하나의 노드에 저장할 수 있도록 그룹화하는 Shard Key 기능을 구현합니다.
shard 결정을 위해서는 key의 일부만을 사용하며, 해당 조건은 아래와 같습니다.
키에
{...}패턴이 포함될 경우, 전체 키 대신{와}사이의 문자열만을 해싱하여 저장할 노드를 결정합니다.{와 처음 등장하는}사이의 하나 이상의 문자열을 해싱이를 통해 동일한 Shard Key를 가진 키들은 항상 같은 노드에 배치됨을 보장하도록 합니다.
테스트코드는 새로운
ArcusShardKeyTest클래스를 추가했습니다.