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 int
DOC_COMMIT_DELAY_MS
static int
SIZE_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 void
addedDocument(int commitWithin)
Indicate that documents have been addedvoid
addedDocument(int commitWithin, LongSupplier currentTlogSize)
Indicate that documents have been addedvoid
cancelPendingCommit()
void
close()
void
deletedDocument(int commitWithin)
Indicate that documents have been deletedvoid
didCommit()
Inform tracker that a commit has occurredvoid
didRollback()
Inform tracker that a rollback has occurred, cancel any pending commitsint
getCommitCount()
boolean
getOpenSearcher()
long
getTimeUpperBound()
boolean
hasPending()
void
run()
This is the worker part for the ScheduledFuture *void
scheduleCommitWithin(long commitMaxTime)
schedule individual commitsvoid
scheduleMaxSizeTriggeredCommitIfNeeded(LongSupplier currentTlogSize)
If the given current tlog size is greater than the file size upper bound, then schedule a commitvoid
setOpenSearcher(boolean openSearcher)
void
setTimeUpperBound(long timeUpperBound)
void
setTLogFileSizeUpperBound(int sizeUpperBound)
String
toString()
-
-
-
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, LongSupplier 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(LongSupplier 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()
-
-