com.nhncorp.neptune.tabletserver
Class DiskSSTable

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

public class DiskSSTable
extends java.lang.Object
implements DiskSSTableIF


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
DiskSSTable()
           
 
Method Summary
 void addMergedFiles(java.util.Map<java.lang.String,java.util.List<TabletMapFile>> targetMapFiles, java.util.Map<java.lang.String,TabletMapFile> mergedMapFiles)
           
 void addTabletMapFile(java.lang.String columnName, TabletMapFile mapFile)
           
 void cancelCompaction(java.lang.String fileId)
          minor Compaction 도중 오류가 발생했을 때 파일 내용을 모두 지우는 작업 수행
 void clearAllMemory()
           
 Row.Key findClosest(Row.Key rowKey, MemorySSTableIF memorySSTable, java.lang.String columnName)
           
 Row.Key findMidRowKeyForSplit()
           
 int[] getMapFileCount()
           
 java.util.SortedSet<MapFileIndexRecord> getMapFileIndex()
           
 long[] getMapFileIndexSize()
           
 long getMapFileMemorySize()
           
 java.util.Map<java.lang.String,java.util.List<TabletMapFile>> getMapFiles()
           
 int[] getMapFileSize()
           
 int getMaxMapFileCount()
           
 java.util.List<Searchable> getSearchers(Row.Key rowKey, java.lang.String columnName, Cell.Key columnKey)
           
 TabletInfo getTabletInfo()
           
 TabletServerIF getTabletServer()
           
 java.lang.String getTestHandlerKey()
           
 boolean hasValue(Row.Key rowKey, java.lang.String columnName)
           
 void init(TabletServerIF tabletServer, DiskSSTableIF proxyObject, NConfiguration conf, TabletInfo tabletInfo, int numOfVersion)
           
 boolean isEmpty()
           
 void load()
           
 void majorCompaction()
           
 java.util.Map<java.lang.String,TabletMapFile> merge(java.util.Map<java.lang.String,java.util.List<TabletMapFile>> targetMapFiles, java.lang.String fileId)
           
static TabletMapFile mergeColumnMapFiles(NConfiguration conf, NeptuneFileSystem resultFs, GPath resultPath, TabletInfo tabletInfo, java.lang.String fileId, java.lang.String columnName, java.util.List<TabletMapFile> mergeMapFiles, int numOfVersion)
           
 TabletMapFile mergeMapFiles(java.lang.String fileId, java.lang.String columnName, java.util.List<TabletMapFile> mergeMapFiles)
           
 void moveMajorTempToTablet(java.lang.String columnName, TabletMapFile tabletMapFile)
           
 void moveMergedFile(java.util.Map<java.lang.String,TabletMapFile> mergedMapFiles)
           
 void moveTempToTablet(boolean deleteParent)
           
 void printMapFileInfo()
           
 void removeTabletMapFile(java.lang.String columnName, TabletMapFile mapFile)
           
 java.util.Collection<ColumnValue> search(Row.Key rowKey, java.lang.String columnName)
           
 ColumnValue search(Row.Key rowKey, java.lang.String columnName, Cell.Key columnKey)
           
 java.util.Collection<ColumnValue[]> search(Row.Key rowKey, java.lang.String columnName, RowFilter scanFilter)
           
 ValueCollection searchAllVersion(Row.Key rowKey, java.lang.String columnName, Cell.Key columnKey)
           
 DiskSSTableIF[] split(Row.Key midRowKey, TabletInfo[] createdTablets)
          Tablet의 크기가 정해진 크기보다 큰 경우 Tablet을 두개로 쪼갠다.
 void splitMapFile(Row.Key midRowKey, TabletInfo[] createdTablets, DiskSSTableIF[] createdDiskSSTables, java.lang.String columnName, TabletMapFile tabletMapFile, java.lang.String fileId)
           
 long sumMapFileSize()
           
 void truncateColumn(java.lang.String columnName)
           
 
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

DiskSSTable

public DiskSSTable()
Method Detail

init

public void init(TabletServerIF tabletServer,
                 DiskSSTableIF proxyObject,
                 NConfiguration conf,
                 TabletInfo tabletInfo,
                 int numOfVersion)
Specified by:
init in interface DiskSSTableIF

clearAllMemory

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

getTabletInfo

public TabletInfo getTabletInfo()

getMapFiles

public java.util.Map<java.lang.String,java.util.List<TabletMapFile>> getMapFiles()
Specified by:
getMapFiles in interface DiskSSTableIF

truncateColumn

public void truncateColumn(java.lang.String columnName)
                    throws java.io.IOException
Specified by:
truncateColumn in interface DiskSSTableIF
Throws:
java.io.IOException

getMapFileIndex

public java.util.SortedSet<MapFileIndexRecord> getMapFileIndex()
Specified by:
getMapFileIndex in interface DiskSSTableIF

addTabletMapFile

public void addTabletMapFile(java.lang.String columnName,
                             TabletMapFile mapFile)
                      throws java.io.IOException
Specified by:
addTabletMapFile in interface DiskSSTableIF
Throws:
java.io.IOException

removeTabletMapFile

public void removeTabletMapFile(java.lang.String columnName,
                                TabletMapFile mapFile)
                         throws java.io.IOException
Specified by:
removeTabletMapFile in interface DiskSSTableIF
Throws:
java.io.IOException

load

public void load()
          throws java.io.IOException
Specified by:
load in interface DiskSSTableIF
Throws:
java.io.IOException

search

public ColumnValue search(Row.Key rowKey,
                          java.lang.String columnName,
                          Cell.Key columnKey)
                   throws java.io.IOException
Throws:
java.io.IOException

searchAllVersion

public ValueCollection searchAllVersion(Row.Key rowKey,
                                        java.lang.String columnName,
                                        Cell.Key columnKey)
                                 throws java.io.IOException
Throws:
java.io.IOException

search

public java.util.Collection<ColumnValue> search(Row.Key rowKey,
                                                java.lang.String columnName)
                                         throws java.io.IOException
Throws:
java.io.IOException

search

public java.util.Collection<ColumnValue[]> search(Row.Key rowKey,
                                                  java.lang.String columnName,
                                                  RowFilter scanFilter)
                                           throws java.io.IOException
Throws:
java.io.IOException

cancelCompaction

public void cancelCompaction(java.lang.String fileId)
                      throws java.io.IOException
minor Compaction 도중 오류가 발생했을 때 파일 내용을 모두 지우는 작업 수행

Specified by:
cancelCompaction in interface DiskSSTableIF
Throws:
java.io.IOException

majorCompaction

public void majorCompaction()
                     throws java.io.IOException
Specified by:
majorCompaction in interface DiskSSTableIF
Throws:
java.io.IOException

addMergedFiles

public void addMergedFiles(java.util.Map<java.lang.String,java.util.List<TabletMapFile>> targetMapFiles,
                           java.util.Map<java.lang.String,TabletMapFile> mergedMapFiles)
                    throws java.io.IOException
Specified by:
addMergedFiles in interface DiskSSTableIF
Throws:
java.io.IOException

moveMergedFile

public void moveMergedFile(java.util.Map<java.lang.String,TabletMapFile> mergedMapFiles)
                    throws java.io.IOException
Specified by:
moveMergedFile in interface DiskSSTableIF
Throws:
java.io.IOException

merge

public java.util.Map<java.lang.String,TabletMapFile> merge(java.util.Map<java.lang.String,java.util.List<TabletMapFile>> targetMapFiles,
                                                           java.lang.String fileId)
                                                    throws java.io.IOException
Specified by:
merge in interface DiskSSTableIF
Throws:
java.io.IOException

mergeMapFiles

public TabletMapFile mergeMapFiles(java.lang.String fileId,
                                   java.lang.String columnName,
                                   java.util.List<TabletMapFile> mergeMapFiles)
                            throws java.io.IOException
Specified by:
mergeMapFiles in interface DiskSSTableIF
Throws:
java.io.IOException

mergeColumnMapFiles

public static TabletMapFile mergeColumnMapFiles(NConfiguration conf,
                                                NeptuneFileSystem resultFs,
                                                GPath resultPath,
                                                TabletInfo tabletInfo,
                                                java.lang.String fileId,
                                                java.lang.String columnName,
                                                java.util.List<TabletMapFile> mergeMapFiles,
                                                int numOfVersion)
                                         throws java.io.IOException
Throws:
java.io.IOException

moveMajorTempToTablet

public void moveMajorTempToTablet(java.lang.String columnName,
                                  TabletMapFile tabletMapFile)
                           throws java.io.IOException
Specified by:
moveMajorTempToTablet in interface DiskSSTableIF
Throws:
java.io.IOException

getMaxMapFileCount

public int getMaxMapFileCount()
Specified by:
getMaxMapFileCount in interface DiskSSTableIF

findClosest

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

hasValue

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

printMapFileInfo

public void printMapFileInfo()
                      throws java.io.IOException
Throws:
java.io.IOException

split

public DiskSSTableIF[] split(Row.Key midRowKey,
                             TabletInfo[] createdTablets)
                      throws java.io.IOException
Tablet의 크기가 정해진 크기보다 큰 경우 Tablet을 두개로 쪼갠다. Split은 Major Compaction을 통해 TabletMapFile을 하나라 만든 다음 처리한다. split 결과는 두개의 DiskSSTable이 반환된다.

Specified by:
split in interface DiskSSTableIF
Parameters:
createdTablets -
Returns:
Throws:
java.io.IOException

splitMapFile

public void splitMapFile(Row.Key midRowKey,
                         TabletInfo[] createdTablets,
                         DiskSSTableIF[] createdDiskSSTables,
                         java.lang.String columnName,
                         TabletMapFile tabletMapFile,
                         java.lang.String fileId)
                  throws java.io.IOException
Specified by:
splitMapFile in interface DiskSSTableIF
Throws:
java.io.IOException

findMidRowKeyForSplit

public Row.Key findMidRowKeyForSplit()
                              throws java.io.IOException
Specified by:
findMidRowKeyForSplit in interface DiskSSTableIF
Throws:
java.io.IOException

sumMapFileSize

public long sumMapFileSize()
                    throws java.io.IOException
Specified by:
sumMapFileSize in interface DiskSSTableIF
Throws:
java.io.IOException

moveTempToTablet

public void moveTempToTablet(boolean deleteParent)
                      throws java.io.IOException
Specified by:
moveTempToTablet in interface DiskSSTableIF
Throws:
java.io.IOException

isEmpty

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

getMapFileCount

public int[] getMapFileCount()
Specified by:
getMapFileCount in interface DiskSSTableIF

getMapFileSize

public int[] getMapFileSize()
                     throws java.io.IOException
Specified by:
getMapFileSize in interface DiskSSTableIF
Throws:
java.io.IOException

getMapFileIndexSize

public long[] getMapFileIndexSize()
                           throws java.io.IOException
Specified by:
getMapFileIndexSize in interface DiskSSTableIF
Throws:
java.io.IOException

getSearchers

public java.util.List<Searchable> getSearchers(Row.Key rowKey,
                                               java.lang.String columnName,
                                               Cell.Key columnKey)
                                        throws java.io.IOException
Specified by:
getSearchers in interface DiskSSTableIF
Throws:
java.io.IOException

getMapFileMemorySize

public long getMapFileMemorySize()
                          throws java.io.IOException
Specified by:
getMapFileMemorySize in interface DiskSSTableIF
Throws:
java.io.IOException

getTestHandlerKey

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

getTabletServer

public TabletServerIF getTabletServer()