Package org.apache.solr.update
Class CommitTracker
java.lang.Object
org.apache.solr.update.CommitTracker
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionCommitTracker(String name, SolrCore core, int docsUpperBound, int timeUpperBound, long tLogFileSizeUpperBound, boolean openSearcher, boolean softCommit) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddedDocument(int commitWithin) Indicate that documents have been addedvoidaddedDocument(int commitWithin, LongSupplier currentTlogSize) Indicate that documents have been addedvoidvoidclose()voiddeletedDocument(int commitWithin) Indicate that documents have been deletedvoidInform tracker that a commit has occurredvoidInform tracker that a rollback has occurred, cancel any pending commitsintbooleanlongbooleanvoidrun()This is the worker part for the ScheduledFuture *voidscheduleCommitWithin(long commitMaxTime) schedule individual commitsvoidscheduleMaxSizeTriggeredCommitIfNeeded(LongSupplier 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) toString()
-
Field Details
-
DOC_COMMIT_DELAY_MS
public static final int DOC_COMMIT_DELAY_MS- See Also:
-
SIZE_COMMIT_DELAY_MS
public static final int SIZE_COMMIT_DELAY_MS- See Also:
-
-
Constructor Details
-
CommitTracker
-
-
Method Details
-
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
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
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() -
toString
-
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()
-