Package org.apache.solr.update
Class CommitTracker
- java.lang.Object
-
- org.apache.solr.update.CommitTracker
-
- All Implemented Interfaces:
Runnable
public final class CommitTracker extends Object implements Runnable
Helper class for tracking autoCommit state. Note: This is purely an implementation detail of autoCommit and will definitely change in the future, so the interface should not be relied-upon Note: all access must be synchronized. Public for tests.
-
-
Field Summary
Fields Modifier and Type Field Description static intDOC_COMMIT_DELAY_MSstatic intSIZE_COMMIT_DELAY_MS
-
Constructor Summary
Constructors Constructor Description CommitTracker(String name, SolrCore core, int docsUpperBound, int timeUpperBound, long tLogFileSizeUpperBound, boolean openSearcher, boolean softCommit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddedDocument(int commitWithin)Indicate that documents have been addedvoidaddedDocument(int commitWithin, long currentTlogSize)Indicate that documents have been addedvoidcancelPendingCommit()voidclose()voiddeletedDocument(int commitWithin)Indicate that documents have been deletedvoiddidCommit()Inform tracker that a commit has occurredvoiddidRollback()Inform tracker that a rollback has occurred, cancel any pending commitsintgetCommitCount()booleangetOpenSearcher()longgetTimeUpperBound()booleanhasPending()voidrun()This is the worker part for the ScheduledFuturevoidscheduleCommitWithin(long commitMaxTime)schedule individual commitsvoidscheduleMaxSizeTriggeredCommitIfNeeded(long currentTlogSize)If the given current tlog size is greater than the file size upper bound, then schedule a commitvoidsetOpenSearcher(boolean openSearcher)voidsetTimeUpperBound(long timeUpperBound)voidsetTLogFileSizeUpperBound(int sizeUpperBound)StringtoString()
-
-
-
Field Detail
-
DOC_COMMIT_DELAY_MS
public static final int DOC_COMMIT_DELAY_MS
- See Also:
- Constant Field Values
-
SIZE_COMMIT_DELAY_MS
public static final int SIZE_COMMIT_DELAY_MS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getOpenSearcher
public boolean getOpenSearcher()
-
close
public void close()
-
scheduleCommitWithin
public void scheduleCommitWithin(long commitMaxTime)
schedule individual commits
-
cancelPendingCommit
public void cancelPendingCommit()
-
addedDocument
public void addedDocument(int commitWithin)
Indicate that documents have been added- Parameters:
commitWithin- amount of time (in ms) within which a commit should be scheduled
-
addedDocument
public void addedDocument(int commitWithin, long currentTlogSize)Indicate that documents have been added- Parameters:
commitWithin- amount of time (in ms) within which a commit should be scheduledcurrentTlogSize- current tlog size (in bytes). Use -1 if we don't want to check for a max size triggered commit
-
deletedDocument
public void deletedDocument(int commitWithin)
Indicate that documents have been deleted
-
scheduleMaxSizeTriggeredCommitIfNeeded
public void scheduleMaxSizeTriggeredCommitIfNeeded(long currentTlogSize)
If the given current tlog size is greater than the file size upper bound, then schedule a commit- Parameters:
currentTlogSize- current tlog size (in bytes)
-
didCommit
public void didCommit()
Inform tracker that a commit has occurred
-
didRollback
public void didRollback()
Inform tracker that a rollback has occurred, cancel any pending commits
-
run
public void run()
This is the worker part for the ScheduledFuture
-
getCommitCount
public int getCommitCount()
-
getTimeUpperBound
public long getTimeUpperBound()
-
setTimeUpperBound
public void setTimeUpperBound(long timeUpperBound)
-
setTLogFileSizeUpperBound
public void setTLogFileSizeUpperBound(int sizeUpperBound)
-
setOpenSearcher
public void setOpenSearcher(boolean openSearcher)
-
hasPending
public boolean hasPending()
-
-