com.nhncorp.neptune.tabletserver
Class MemorySSTable

java.lang.Object
  extended by com.nhncorp.neptune.tabletserver.MemorySSTable
All Implemented Interfaces:
ProxyObject, MemorySSTableIF

public class MemorySSTable
extends java.lang.Object
implements MemorySSTableIF


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
MemorySSTable()
           
 
Method Summary
 void cancelCompaction(java.lang.String fileId)
          Compaction 수행 중 오류가 발생했을 때 메모리를 원상복구 시킨다.
 void clearAllMemory()
           
 void clearChangeLogOf(java.lang.String tabletName)
           
 void clearCompactingColumnCollections()
           
 void commit(TxId txId, ChangeLog[] changeLogList, boolean saveLog)
           
 void endChangeLogMinorCompaction()
           
 Row.Key findClosest(Row.Key rowKey, java.lang.String columnName)
           
 Row.Key findMidRowKeyForSplit()
          Split 처리를 위해 가운데의 rowkey 값을 가져온다.
 ColumnValue[] getAllMemoryValues(java.lang.String columnName)
          ROOT, META 테이블 검증용으로 사용된다.
 java.util.SortedSet<Row.Key> getAllRowKeys()
          MemorySSTable에 있는 rowkey의 목록을 반환한다.
 ChangeLogFileSystemIF getChangeLogFileSystem()
           
 java.util.Map<java.lang.String,ColumnCollection> getColumnCollections()
           
 java.util.Map<java.lang.String,ColumnCollection> getCompactingColumnCollections()
           
 int[] getDataCount()
           
 Scanner getScanner(java.lang.String columnName, Row.Key startRowKey, Row.Key endRowKey, CellFilter columnFilter)
           
 Searchable getSearcher(Row.Key rowKey, java.lang.String columnName, Cell.Key columnKey)
           
 TabletServerIF getTabletServer()
           
 int getTabletSize()
           
 java.lang.String getTestHandlerKey()
           
 boolean hasValue(Row.Key rowKey, java.lang.String columnName)
           
 void init(TabletServerIF tabletServer, NConfiguration conf, TabletInfo tabletInfo, int numOfVersion)
           
 void initMemoryForCompaction()
          메모리에 있는 내용을 임시버퍼로 저장시킨 다음, 비어 있는 새로운 메모리를 구성한다.
 boolean isDeleted(Row.Key rowKey, java.lang.String columnName)
           
 boolean isEmpty()
           
 boolean loadFromChangeLog()
          false가 return되면 로딩 후 바로 minorcompaction을 수행해야 한다.
 void obtainWriteLock()
           
 void print()
           
 void releaseWriteLock()
           
 java.util.Map<java.lang.String,TabletMapFile> saveToDisk(TabletInfo tabletInfo, java.lang.String fileId)
          임시버퍼(compactingColumnCollections)에 저장된 데이터를 파일로 저장한다.
 java.util.Collection<ColumnValue> search(Row.Key rowKey, java.lang.String columnName)
          결과는 순서로 정렬되어 있지 않다.
 ColumnValue search(Row.Key rowKey, java.lang.String columnName, Cell.Key columnKey)
           
 void setCompacting(boolean compacting)
           
 java.util.Map<java.lang.String,TabletMapFile[]> splitAndSave(Row.Key midRowKey, TabletInfo[] splitedTabletInfos)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

MemorySSTable

public MemorySSTable()
Method Detail

init

public void init(TabletServerIF tabletServer,
                 NConfiguration conf,
                 TabletInfo tabletInfo,
                 int numOfVersion)
          throws java.io.IOException
Specified by:
init in interface MemorySSTableIF
Throws:
java.io.IOException

clearAllMemory

public void clearAllMemory()
Specified by:
clearAllMemory in interface MemorySSTableIF

findMidRowKeyForSplit

public Row.Key findMidRowKeyForSplit()
                              throws java.io.IOException
Description copied from interface: MemorySSTableIF
Split 처리를 위해 가운데의 rowkey 값을 가져온다.

Specified by:
findMidRowKeyForSplit in interface MemorySSTableIF
Throws:
java.io.IOException

getAllRowKeys

public java.util.SortedSet<Row.Key> getAllRowKeys()
Description copied from interface: MemorySSTableIF
MemorySSTable에 있는 rowkey의 목록을 반환한다.

Specified by:
getAllRowKeys in interface MemorySSTableIF
Returns:

print

public void print()
Specified by:
print in interface MemorySSTableIF

getTabletSize

public int getTabletSize()
Specified by:
getTabletSize in interface MemorySSTableIF

getDataCount

public int[] getDataCount()
Specified by:
getDataCount in interface MemorySSTableIF

getChangeLogFileSystem

public ChangeLogFileSystemIF getChangeLogFileSystem()
Specified by:
getChangeLogFileSystem in interface MemorySSTableIF

getColumnCollections

public java.util.Map<java.lang.String,ColumnCollection> getColumnCollections()
Specified by:
getColumnCollections in interface MemorySSTableIF

getCompactingColumnCollections

public java.util.Map<java.lang.String,ColumnCollection> getCompactingColumnCollections()
Specified by:
getCompactingColumnCollections in interface MemorySSTableIF

getAllMemoryValues

public ColumnValue[] getAllMemoryValues(java.lang.String columnName)
Description copied from interface: MemorySSTableIF
ROOT, META 테이블 검증용으로 사용된다. 해당 메소드가 호출되는 경우에는 Split 등의 작업이 lock이 걸리기 때문에 메모리의 값에 대한 변경이 거의 없다.

Specified by:
getAllMemoryValues in interface MemorySSTableIF
Returns:

commit

public void commit(TxId txId,
                   ChangeLog[] changeLogList,
                   boolean saveLog)
            throws java.io.IOException
Specified by:
commit in interface MemorySSTableIF
Throws:
java.io.IOException

clearChangeLogOf

public void clearChangeLogOf(java.lang.String tabletName)
Specified by:
clearChangeLogOf in interface MemorySSTableIF

endChangeLogMinorCompaction

public void endChangeLogMinorCompaction()
                                 throws java.io.IOException
Specified by:
endChangeLogMinorCompaction in interface MemorySSTableIF
Throws:
java.io.IOException

loadFromChangeLog

public boolean loadFromChangeLog()
                          throws java.io.IOException
false가 return되면 로딩 후 바로 minorcompaction을 수행해야 한다.

Specified by:
loadFromChangeLog in interface MemorySSTableIF
Throws:
java.io.IOException

search

public ColumnValue search(Row.Key rowKey,
                          java.lang.String columnName,
                          Cell.Key columnKey)

search

public java.util.Collection<ColumnValue> search(Row.Key rowKey,
                                                java.lang.String columnName)
                                         throws java.io.IOException
결과는 순서로 정렬되어 있지 않다. Tablet의 RecordSearcher에서 정렬한다.

Throws:
java.io.IOException

isDeleted

public boolean isDeleted(Row.Key rowKey,
                         java.lang.String columnName)
                  throws java.io.IOException
Specified by:
isDeleted in interface MemorySSTableIF
Throws:
java.io.IOException

findClosest

public Row.Key findClosest(Row.Key rowKey,
                           java.lang.String columnName)
Specified by:
findClosest in interface MemorySSTableIF

hasValue

public boolean hasValue(Row.Key rowKey,
                        java.lang.String columnName)
                 throws java.io.IOException
Specified by:
hasValue in interface MemorySSTableIF
Throws:
java.io.IOException

initMemoryForCompaction

public void initMemoryForCompaction()
                             throws java.io.IOException
메모리에 있는 내용을 임시버퍼로 저장시킨 다음, 비어 있는 새로운 메모리를 구성한다. 임시버퍼에 저장된 내용을 파일로 저장한다.

Specified by:
initMemoryForCompaction in interface MemorySSTableIF
Throws:
java.io.IOException

cancelCompaction

public void cancelCompaction(java.lang.String fileId)
Compaction 수행 중 오류가 발생했을 때 메모리를 원상복구 시킨다.

Specified by:
cancelCompaction in interface MemorySSTableIF

saveToDisk

public java.util.Map<java.lang.String,TabletMapFile> saveToDisk(TabletInfo tabletInfo,
                                                                java.lang.String fileId)
                                                         throws java.io.IOException
임시버퍼(compactingColumnCollections)에 저장된 데이터를 파일로 저장한다.

Specified by:
saveToDisk in interface MemorySSTableIF
Parameters:
tabletInfo -
Returns:
Throws:
java.io.IOException

obtainWriteLock

public void obtainWriteLock()
Specified by:
obtainWriteLock in interface MemorySSTableIF

releaseWriteLock

public void releaseWriteLock()
Specified by:
releaseWriteLock in interface MemorySSTableIF

clearCompactingColumnCollections

public void clearCompactingColumnCollections()
Specified by:
clearCompactingColumnCollections in interface MemorySSTableIF

getScanner

public Scanner getScanner(java.lang.String columnName,
                          Row.Key startRowKey,
                          Row.Key endRowKey,
                          CellFilter columnFilter)
Specified by:
getScanner in interface MemorySSTableIF

getSearcher

public Searchable getSearcher(Row.Key rowKey,
                              java.lang.String columnName,
                              Cell.Key columnKey)
                       throws java.io.IOException
Specified by:
getSearcher in interface MemorySSTableIF
Throws:
java.io.IOException

splitAndSave

public java.util.Map<java.lang.String,TabletMapFile[]> splitAndSave(Row.Key midRowKey,
                                                                    TabletInfo[] splitedTabletInfos)
                                                             throws java.io.IOException
Specified by:
splitAndSave in interface MemorySSTableIF
Throws:
java.io.IOException

setCompacting

public void setCompacting(boolean compacting)
Specified by:
setCompacting in interface MemorySSTableIF
Parameters:
compacting - the compacting to set

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface MemorySSTableIF

getTestHandlerKey

public java.lang.String getTestHandlerKey()
Specified by:
getTestHandlerKey in interface ProxyObject

getTabletServer

public TabletServerIF getTabletServer()