com.nhncorp.neptune.client
Class TabletLocationCache
java.lang.Object
com.nhncorp.neptune.client.TabletLocationCache
public class TabletLocationCache
- extends java.lang.Object
Cache는 다음과 같은 레코드 구조를 가진다.
cahce가 아무것도 없는 상태에서 rk10에 대해 lookup 요청을 하면
cache에 없기 때문에 ROOT, META 정보를 이용하여 Tablet 정보를 가져온다.
가져온 Tablet 정보가 T1에 max rk가 rk20인 경우 cache에는 다음 두개의 데이터가 입력된다.
rk10 - T1
rk20 - T1
이렇게 계속 진행된 경우
rk01 - T0
rk05 - T0
rk10 - T1
rk20 - T1
이 상태에서 rk15에 대한 요청이 오면 headSet, tailtSet한 다음 두개의 Tablet이 동일한 경우 cache hit로 처리한다.
rk07에 대한 요청이 온 경우 head, tail의 값이 T0, T1이기 때문에 cache miss로 처리한다.
ROOT, META preLoad 하는 경우 두개의 레코드를 입력하는데 start rk 값은 이전 tablet의 end rk에 1byte 추가한
값을 이용한다.
- Author:
- nhn
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getInstance
public static TabletLocationCache getInstance(NConfiguration conf)
throws java.io.IOException
- Throws:
java.io.IOException
getTableInfos
public java.util.Map<java.lang.String,TableSchema> getTableInfos()
clearAllCache
public void clearAllCache()
clearTabletCache
public void clearTabletCache(java.lang.String tableName,
Row.Key rowKey,
TabletInfo tabletInfo)
addCache
public void addCache(java.util.TreeMap<Row.Key,TabletInfo> cache,
Row.Key lookupRowKey,
TabletInfo tabletInfo,
Row.Key cacheEndRowKey)