org.apache.solr.update
Class UpdateLog

java.lang.Object
  extended by org.apache.solr.update.UpdateLog
All Implemented Interfaces:
PluginInfoInitialized
Direct Known Subclasses:
HdfsUpdateLog

public class UpdateLog
extends Object
implements PluginInfoInitialized

WARNING: This API is experimental and might change in incompatible ways in the next release.

Nested Class Summary
 class UpdateLog.DBQ
           
static class UpdateLog.LogPtr
           
 class UpdateLog.RecentUpdates
           
static class UpdateLog.RecoveryInfo
           
static class UpdateLog.State
           
static class UpdateLog.SyncLevel
           
 
Field Summary
static int ADD
           
protected  boolean cancelApplyBufferUpdate
           
static int COMMIT
           
protected  String dataDir
           
 boolean debug
           
protected  UpdateLog.SyncLevel defaultSyncLevel
           
static int DELETE
           
static int DELETE_BY_QUERY
           
protected  LinkedList<UpdateLog.DBQ> deleteByQueries
           
static int FLAG_GAP
           
protected  Collection<String> globalStrings
           
protected  String lastDataDir
           
static org.slf4j.Logger log
           
static String LOG_FILENAME_PATTERN
           
protected  Deque<TransactionLog> logs
           
protected  Map<BytesRef,UpdateLog.LogPtr> map
           
protected  LinkedList<TransactionLog> newestLogsOnStartup
           
protected  int numDeletesByQueryToKeep
           
protected  int numDeletesToKeep
           
protected  int numOldRecords
           
 int numRecordsToKeep
           
protected  LinkedHashMap<BytesRef,UpdateLog.LogPtr> oldDeletes
           
static int OPERATION_MASK
           
protected  int operationFlags
           
protected  Map<BytesRef,UpdateLog.LogPtr> prevMap
           
protected  Map<BytesRef,UpdateLog.LogPtr> prevMap2
           
protected  TransactionLog prevMapLog
           
protected  TransactionLog prevMapLog2
           
protected  TransactionLog prevTlog
           
protected  UpdateLog.RecoveryInfo recoveryInfo
           
protected  UpdateLog.State state
           
static Runnable testing_logReplayFinishHook
           
static Runnable testing_logReplayHook
           
protected  TransactionLog tlog
           
static String TLOG_NAME
           
protected  File tlogDir
           
protected  String[] tlogFiles
           
 boolean trace
           
protected  VersionInfo versionInfo
           
 
Constructor Summary
UpdateLog()
           
 
Method Summary
 void add(AddUpdateCommand cmd)
           
 void add(AddUpdateCommand cmd, boolean clearCaches)
           
protected  void addOldLog(TransactionLog oldLog, boolean removeOld)
           
 Future<UpdateLog.RecoveryInfo> applyBufferedUpdates()
          Returns the Future to wait on, or null if no replay was needed
 void bufferUpdates()
           
 void cancelApplyBufferedUpdates()
           
 void clearLog(SolrCore core, PluginInfo ulogPluginInfo)
          Clears the logs on the file system.
 void close(boolean committed)
           
 void close(boolean committed, boolean deleteOnClose)
           
 void delete(DeleteUpdateCommand cmd)
           
 void deleteAll()
          currently for testing only
 void deleteByQuery(DeleteUpdateCommand cmd)
           
static void deleteFile(File file)
           
 boolean dropBufferedUpdates()
          Returns true if we were able to drop buffered updates and return to the ACTIVE state
protected  void ensureLog()
           
 void finish(UpdateLog.SyncLevel syncLevel)
           
 List<UpdateLog.DBQ> getDBQNewer(long version)
           
 org.apache.hadoop.fs.FileSystem getFs()
           
 long getLastLogId()
           
 String getLogDir()
           
 String[] getLogList(File directory)
           
 UpdateLog.RecentUpdates getRecentUpdates()
          The RecentUpdates object returned must be closed after use
 int getStartingOperation()
           
 List<Long> getStartingVersions()
           
 UpdateLog.State getState()
           
protected  String getTlogDir(SolrCore core, PluginInfo info)
           
 long getTotalLogsNumber()
           
 long getTotalLogsSize()
           
 VersionInfo getVersionInfo()
           
 boolean hasUncommittedChanges()
           
 void init(PluginInfo info)
           
 void init(UpdateHandler uhandler, SolrCore core)
           
 Object lookup(BytesRef indexedId)
           
 Long lookupVersion(BytesRef indexedId)
           
protected  void newMap()
           
 void postCommit(CommitUpdateCommand cmd)
           
 void postSoftCommit(CommitUpdateCommand cmd)
           
 void preCommit(CommitUpdateCommand cmd)
           
 void preSoftCommit(CommitUpdateCommand cmd)
           
 Future<UpdateLog.RecoveryInfo> recoverFromLog()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG_FILENAME_PATTERN

public static String LOG_FILENAME_PATTERN

TLOG_NAME

public static String TLOG_NAME

log

public static org.slf4j.Logger log

debug

public boolean debug

trace

public boolean trace

ADD

public static final int ADD
See Also:
Constant Field Values

DELETE

public static final int DELETE
See Also:
Constant Field Values

DELETE_BY_QUERY

public static final int DELETE_BY_QUERY
See Also:
Constant Field Values

COMMIT

public static final int COMMIT
See Also:
Constant Field Values

FLAG_GAP

public static final int FLAG_GAP
See Also:
Constant Field Values

OPERATION_MASK

public static final int OPERATION_MASK
See Also:
Constant Field Values

state

protected UpdateLog.State state

operationFlags

protected int operationFlags

tlog

protected TransactionLog tlog

prevTlog

protected TransactionLog prevTlog

logs

protected Deque<TransactionLog> logs

newestLogsOnStartup

protected LinkedList<TransactionLog> newestLogsOnStartup

numOldRecords

protected int numOldRecords

map

protected Map<BytesRef,UpdateLog.LogPtr> map

prevMap

protected Map<BytesRef,UpdateLog.LogPtr> prevMap

prevMap2

protected Map<BytesRef,UpdateLog.LogPtr> prevMap2

prevMapLog

protected TransactionLog prevMapLog

prevMapLog2

protected TransactionLog prevMapLog2

numDeletesToKeep

protected final int numDeletesToKeep
See Also:
Constant Field Values

numDeletesByQueryToKeep

protected final int numDeletesByQueryToKeep
See Also:
Constant Field Values

numRecordsToKeep

public final int numRecordsToKeep
See Also:
Constant Field Values

oldDeletes

protected LinkedHashMap<BytesRef,UpdateLog.LogPtr> oldDeletes

deleteByQueries

protected LinkedList<UpdateLog.DBQ> deleteByQueries

tlogFiles

protected String[] tlogFiles

tlogDir

protected File tlogDir

globalStrings

protected Collection<String> globalStrings

dataDir

protected String dataDir

lastDataDir

protected String lastDataDir

versionInfo

protected VersionInfo versionInfo

defaultSyncLevel

protected UpdateLog.SyncLevel defaultSyncLevel

cancelApplyBufferUpdate

protected volatile boolean cancelApplyBufferUpdate

testing_logReplayHook

public static Runnable testing_logReplayHook

testing_logReplayFinishHook

public static Runnable testing_logReplayFinishHook

recoveryInfo

protected UpdateLog.RecoveryInfo recoveryInfo
Constructor Detail

UpdateLog

public UpdateLog()
Method Detail

getFs

public org.apache.hadoop.fs.FileSystem getFs()

getTotalLogsSize

public long getTotalLogsSize()

getTotalLogsNumber

public long getTotalLogsNumber()

getVersionInfo

public VersionInfo getVersionInfo()

init

public void init(PluginInfo info)
Specified by:
init in interface PluginInfoInitialized

init

public void init(UpdateHandler uhandler,
                 SolrCore core)

getLogDir

public String getLogDir()

getStartingVersions

public List<Long> getStartingVersions()

getStartingOperation

public int getStartingOperation()

addOldLog

protected void addOldLog(TransactionLog oldLog,
                         boolean removeOld)

getLogList

public String[] getLogList(File directory)

getLastLogId

public long getLastLogId()

add

public void add(AddUpdateCommand cmd)

add

public void add(AddUpdateCommand cmd,
                boolean clearCaches)

delete

public void delete(DeleteUpdateCommand cmd)

deleteByQuery

public void deleteByQuery(DeleteUpdateCommand cmd)

deleteAll

public void deleteAll()
currently for testing only


getDBQNewer

public List<UpdateLog.DBQ> getDBQNewer(long version)

newMap

protected void newMap()

hasUncommittedChanges

public boolean hasUncommittedChanges()

preCommit

public void preCommit(CommitUpdateCommand cmd)

postCommit

public void postCommit(CommitUpdateCommand cmd)

preSoftCommit

public void preSoftCommit(CommitUpdateCommand cmd)

postSoftCommit

public void postSoftCommit(CommitUpdateCommand cmd)

lookup

public Object lookup(BytesRef indexedId)

lookupVersion

public Long lookupVersion(BytesRef indexedId)

finish

public void finish(UpdateLog.SyncLevel syncLevel)

recoverFromLog

public Future<UpdateLog.RecoveryInfo> recoverFromLog()

ensureLog

protected void ensureLog()

close

public void close(boolean committed)

close

public void close(boolean committed,
                  boolean deleteOnClose)

getRecentUpdates

public UpdateLog.RecentUpdates getRecentUpdates()
The RecentUpdates object returned must be closed after use


bufferUpdates

public void bufferUpdates()

dropBufferedUpdates

public boolean dropBufferedUpdates()
Returns true if we were able to drop buffered updates and return to the ACTIVE state


applyBufferedUpdates

public Future<UpdateLog.RecoveryInfo> applyBufferedUpdates()
Returns the Future to wait on, or null if no replay was needed


getState

public UpdateLog.State getState()

toString

public String toString()
Overrides:
toString in class Object

cancelApplyBufferedUpdates

public void cancelApplyBufferedUpdates()

deleteFile

public static void deleteFile(File file)

getTlogDir

protected String getTlogDir(SolrCore core,
                            PluginInfo info)

clearLog

public void clearLog(SolrCore core,
                     PluginInfo ulogPluginInfo)
Clears the logs on the file system. Only call before init.

Parameters:
core - the SolrCore
ulogPluginInfo - the init info for the UpdateHandler


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.