public class JobQueue extends BaseTable
Field | Type | Description |
---|---|---|
id | BIGINT | Primary Key |
jobid | BIGINT | Reference:jobs.id |
dochash | VARCHAR(40) | |
docid | LONGTEXT | |
checktime | BIGINT | |
failtime | BIGINT | |
failcount | BIGINT | |
status | CHAR(1) | |
isseed | CHAR(1) | |
docpriority | FLOAT | |
checkaction | CHAR(1) | |
processid | VARCHAR(16) | |
seedingprocessid | VARCHAR(16) | |
needpriority | CHAR(1) | |
needpriorityprocessid | VARCHAR(16) |
Modifier and Type | Class and Description |
---|---|
protected static class |
JobQueue.DuplicateFinder |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
_rcsid |
static int |
ACTION_REMOVE |
static int |
ACTION_RESCAN |
protected static java.util.Map<java.lang.String,java.lang.Integer> |
actionMap |
static java.lang.String |
checkActionField |
static java.lang.String |
checkTimeField |
static java.lang.String |
docHashField |
static java.lang.String |
docIDField |
static java.lang.String |
docPriorityField |
static java.lang.String |
failCountField |
static java.lang.String |
failTimeField |
protected java.lang.String |
getNextDocumentsIndexHint
Cached getNextDocuments order-by index hint
|
static java.lang.String |
idField |
static java.lang.String |
isSeedField |
static java.lang.String |
jobIDField |
static int |
NEEDPRIORITY_FALSE |
static int |
NEEDPRIORITY_INPROGRESS |
static int |
NEEDPRIORITY_TRUE |
static java.lang.String |
needPriorityField |
protected static java.util.Map<java.lang.String,java.lang.Integer> |
needPriorityMap |
static java.lang.String |
needPriorityProcessIDField |
static double |
noDocPriorityValue |
static java.lang.Double |
nullDocPriority |
protected PrereqEventManager |
prereqEventManager
Prerequisite event manager
|
static java.lang.String |
processIDField |
static java.lang.String |
seedingProcessIDField |
static int |
SEEDSTATUS_NEWSEED |
static int |
SEEDSTATUS_NOTSEED |
static int |
SEEDSTATUS_SEED |
protected static java.util.Map<java.lang.String,java.lang.Integer> |
seedstatusMap |
static int |
STATUS_ACTIVE |
static int |
STATUS_ACTIVENEEDRESCAN |
static int |
STATUS_ACTIVENEEDRESCANPURGATORY |
static int |
STATUS_ACTIVEPURGATORY |
static int |
STATUS_BEINGCLEANED |
static int |
STATUS_BEINGDELETED |
static int |
STATUS_COMPLETE |
static int |
STATUS_ELIGIBLEFORDELETE |
static int |
STATUS_HOPCOUNTREMOVED |
static int |
STATUS_PENDING |
static int |
STATUS_PENDINGPURGATORY |
static int |
STATUS_PURGATORY |
static int |
STATUS_UNCHANGED |
static java.lang.String |
statusField |
protected static java.util.Map<java.lang.String,java.lang.Integer> |
statusMap |
protected IThreadContext |
threadContext
Thread context
|
dbInterface, tableName
Constructor and Description |
---|
JobQueue(IThreadContext tc,
IDBInterface database)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
actionToString(int action)
Convert integer to action string
|
void |
addRemainingDocumentsInitial(java.lang.Long jobID,
java.lang.String[] docIDHashes,
java.lang.String processID)
Note the remaining documents that do NOT need to be queued.
|
boolean |
checkJobBusy(java.lang.Long jobID)
Check if there are any outstanding active documents for a job
|
void |
clearAllDocPriorities()
Clear all document priorities globally for all documents that
have priorities set, and signal that we need new priorities for all.
|
void |
clearFailTimes(java.lang.Long jobID)
Clear the failtimes for all documents associated with a job.
|
void |
deinstall()
Uninstall.
|
void |
deleteAllJobRecords(java.lang.Long jobID)
For a job deletion: Delete all records for a job.
|
void |
deleteIngestedDocumentIdentifiers(DocumentDescription[] identifiers)
Delete ingested document identifiers (as part of deleting the owning job).
|
void |
deleteRecord(java.lang.Long id)
Remove a record entirely.
|
void |
deleteRecordMultiple(java.lang.Long[] ids)
Remove multiple records entirely.
|
protected void |
doDeletes(java.util.ArrayList list)
Do a batch of deletes.
|
void |
doneDocumentsInitial(java.lang.Long jobID,
boolean isPartial)
Complete the initial set of documents.
|
java.lang.String[] |
getAllSeeds(java.lang.Long jobID)
Get all the current seeds.
|
java.lang.String |
getGetNextDocumentsIndexHint()
Get the 'getNextDocuments' index hint.
|
static java.lang.String |
getHashCode(java.lang.String documentIdentifier)
Get a hash value from a document id string.
|
void |
insertNewRecord(java.lang.Long jobID,
java.lang.String docIDHash,
java.lang.String docID,
IPriorityCalculator desiredDocPriority,
long desiredExecuteTime,
java.lang.String[] prereqEvents)
Insert a new record into the jobqueue table (as part of adding a child reference).
|
void |
insertNewRecordInitial(java.lang.Long jobID,
java.lang.String docHash,
java.lang.String docID,
IPriorityCalculator desiredDocPriority,
long desiredExecuteTime,
java.lang.String[] prereqEvents,
java.lang.String processID)
Insert a new record into the jobqueue table (as part of adding an initial reference).
|
void |
install(java.lang.String jobsTable,
java.lang.String jobsColumn)
Install or upgrade.
|
void |
markNeedPriorityInProgress(java.lang.Long rowID,
java.lang.String processID)
Prepare to calculate a document priority for a given row.
|
protected int |
maxClauseDoDeletes()
Calculate the number of deletes we can do at once.
|
protected int |
maxClauseProcessRemainingDocuments(java.lang.Long jobID)
Calculate max
|
protected int |
maxClauseUpdateRemainingDocuments()
Get the maximum count
|
static java.lang.String |
needPriorityToString(int value)
Convert boolean to need priority value.
|
void |
noDocPriorities(java.lang.Long jobID)
Clear all document priorities for a job that is going to sleep
|
void |
prepareDeleteScan(java.lang.Long jobID)
Prepare for a job delete pass.
|
void |
prepareFullScan(java.lang.Long jobID)
Prepare for a "full scan" job.
|
void |
prepareIncrementalScan(java.lang.Long jobID)
Prepare for an "incremental" job.
|
void |
preparePartialScan(java.lang.Long jobID)
Prepare for a "partial" job.
|
void |
prioritizeQueuedDocuments(java.lang.Long jobID)
Mark queued documents for prioritization
|
protected void |
processRemainingDocuments(java.util.Map idMap,
java.lang.Long jobID,
java.util.ArrayList list,
java.util.Map inSet)
Process the specified set of documents.
|
void |
queueAllExisting(java.lang.Long jobID)
For ADD_CHANGE_DELETE jobs where the specifications have been changed,
we must reconsider every existing document.
|
void |
reactivateHopcountRemovedRecords(java.lang.Long jobID)
Flip all records for a job that have status HOPCOUNTREMOVED back to PENDING.
|
void |
resetDocCleanupWorkerStatus(java.lang.String processID)
Reset doc cleaning worker status.
|
void |
resetDocDeleteWorkerStatus(java.lang.String processID)
Reset doc delete worker status.
|
void |
resetDocumentWorkerStatus(java.lang.String processID)
Reset as part of restoring document worker threads.
|
void |
resetPendingDocumentSchedules(java.lang.Long jobID)
Reset schedule for all PENDINGPURGATORY entries.
|
void |
restart()
Cleanup after all processIDs.
|
void |
restart(java.lang.String processID)
Restart.
|
void |
restartCluster()
Restart for entire cluster.
|
static java.lang.String |
seedstatusToString(int status)
Convert seedstatus value to a string.
|
void |
setCleaningStatus(java.lang.Long id,
java.lang.String processID)
Set the status of a document to "being cleaned".
|
void |
setDeletingStatus(java.lang.Long id,
java.lang.String processID)
Set the status of a document to "being deleted".
|
void |
setRequeuedStatus(java.lang.Long id,
java.lang.Long checkTime,
int action,
long failTime,
int failCount)
Set the status on a record, including check time and priority.
|
void |
setUncleaningStatus(java.lang.Long id,
long checkTime)
Set the status of a document to be "no longer cleaning"
|
void |
setUndeletingStatus(java.lang.Long id,
long checkTime)
Set the status of a document to be "no longer deleting"
|
static java.lang.String |
statusToString(int status)
Convert status to string.
|
static int |
stringToAction(java.lang.String value)
Convert action field value to integer.
|
static int |
stringToNeedPriority(java.lang.String value)
Convert need priority value to boolean.
|
static int |
stringToSeedstatus(java.lang.String x)
Convert seedstatus field value to a boolean.
|
static int |
stringToStatus(java.lang.String value)
Convert status field value to integer.
|
void |
unconditionallyAnalyzeTables()
Analyze job tables due to major event
|
void |
updateActiveRecord(java.lang.Long id,
int currentStatus,
java.lang.String processID)
Set the status to active on a record, leaving alone priority or check time.
|
void |
updateCompletedRecord(java.lang.Long recID,
int currentStatus)
Set the "completed" status for a record.
|
void |
updateExistingRecord(java.lang.Long recordID,
int currentStatus,
java.lang.Long checkTimeValue,
long desiredExecuteTime,
boolean otherChangesSeen,
IPriorityCalculator desiredPriority,
java.lang.String[] prereqEvents)
Update an existing record (as the result of a reference add).
|
void |
updateExistingRecordInitial(java.lang.Long recordID,
int currentStatus,
java.lang.Long checkTimeValue,
long desiredExecuteTime,
IPriorityCalculator desiredPriority,
java.lang.String[] prereqEvents,
java.lang.String processID)
Update an existing record (as the result of an initial add).
|
boolean |
updateOrHopcountRemoveRecord(java.lang.Long recID,
int currentStatus)
Either mark a record as hopcountremoved, or set status to "rescan", depending on the
record's state.
|
protected void |
updateRemainingDocuments(java.util.ArrayList list,
java.lang.String processID)
Update the specified set of documents to be "NEWSEED"
|
void |
writeDocPriority(java.lang.Long rowID,
IPriorityCalculator priority)
Write out a document priority
|
addTableIndex, analyzeTable, beginTransaction, buildConjunctionClause, constructCountClause, constructDistinctOnClause, constructDoubleCastClause, constructOffsetLimitClause, constructRegexpClause, constructSubstringClause, endTransaction, findConjunctionClauseMax, getDatabaseCacheKey, getDBInterface, getMaxInClause, getMaxOrClause, getSleepAmt, getTableIndexes, getTableName, getTableSchema, getTransactionID, getWindowedReportMaxRows, makeTableKey, noteModifications, performAddIndex, performAlter, performCommit, performCreate, performDelete, performDrop, performInsert, performModification, performQuery, performQuery, performRemoveIndex, performUpdate, prepareRowForSave, readRow, reindexTable, signalRollback, sleepFor
public static final java.lang.String _rcsid
public static final int SEEDSTATUS_NOTSEED
public static final int SEEDSTATUS_SEED
public static final int SEEDSTATUS_NEWSEED
public static final int STATUS_PENDING
public static final int STATUS_ACTIVE
public static final int STATUS_COMPLETE
public static final int STATUS_UNCHANGED
public static final int STATUS_PENDINGPURGATORY
public static final int STATUS_ACTIVEPURGATORY
public static final int STATUS_PURGATORY
public static final int STATUS_BEINGDELETED
public static final int STATUS_ACTIVENEEDRESCAN
public static final int STATUS_ACTIVENEEDRESCANPURGATORY
public static final int STATUS_BEINGCLEANED
public static final int STATUS_ELIGIBLEFORDELETE
public static final int STATUS_HOPCOUNTREMOVED
public static final int ACTION_RESCAN
public static final int ACTION_REMOVE
public static final int NEEDPRIORITY_FALSE
public static final int NEEDPRIORITY_INPROGRESS
public static final int NEEDPRIORITY_TRUE
public static final java.lang.String idField
public static final java.lang.String jobIDField
public static final java.lang.String docHashField
public static final java.lang.String docIDField
public static final java.lang.String checkTimeField
public static final java.lang.String statusField
public static final java.lang.String failTimeField
public static final java.lang.String failCountField
public static final java.lang.String isSeedField
public static final java.lang.String docPriorityField
public static final java.lang.String checkActionField
public static final java.lang.String processIDField
public static final java.lang.String seedingProcessIDField
public static final java.lang.String needPriorityField
public static final java.lang.String needPriorityProcessIDField
public static final double noDocPriorityValue
public static final java.lang.Double nullDocPriority
protected static final java.util.Map<java.lang.String,java.lang.Integer> statusMap
protected static final java.util.Map<java.lang.String,java.lang.Integer> seedstatusMap
protected static final java.util.Map<java.lang.String,java.lang.Integer> actionMap
protected static final java.util.Map<java.lang.String,java.lang.Integer> needPriorityMap
protected PrereqEventManager prereqEventManager
protected IThreadContext threadContext
protected java.lang.String getNextDocumentsIndexHint
public JobQueue(IThreadContext tc, IDBInterface database) throws ManifoldCFException
database
- is the database handle.ManifoldCFException
public void install(java.lang.String jobsTable, java.lang.String jobsColumn) throws ManifoldCFException
ManifoldCFException
public java.lang.String getGetNextDocumentsIndexHint() throws ManifoldCFException
ManifoldCFException
public void unconditionallyAnalyzeTables() throws ManifoldCFException
ManifoldCFException
public void deinstall() throws ManifoldCFException
ManifoldCFException
public void restart(java.lang.String processID) throws ManifoldCFException
processID
- is the processID to clean up after.ManifoldCFException
public void restart() throws ManifoldCFException
ManifoldCFException
public void restartCluster() throws ManifoldCFException
ManifoldCFException
public void reactivateHopcountRemovedRecords(java.lang.Long jobID) throws ManifoldCFException
ManifoldCFException
public void clearFailTimes(java.lang.Long jobID) throws ManifoldCFException
jobID
- is the job identifier.ManifoldCFException
public void resetDocumentWorkerStatus(java.lang.String processID) throws ManifoldCFException
processID
- is the current processID.ManifoldCFException
public void resetDocDeleteWorkerStatus(java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void resetDocCleanupWorkerStatus(java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void prepareDeleteScan(java.lang.Long jobID) throws ManifoldCFException
jobID
- is the job identifier.ManifoldCFException
public void prepareFullScan(java.lang.Long jobID) throws ManifoldCFException
jobID
- is the job identifier.ManifoldCFException
public void resetPendingDocumentSchedules(java.lang.Long jobID) throws ManifoldCFException
jobID
- is the job identifier.ManifoldCFException
public void queueAllExisting(java.lang.Long jobID) throws ManifoldCFException
jobID
- is the job identifier.ManifoldCFException
public void preparePartialScan(java.lang.Long jobID) throws ManifoldCFException
jobID
- is the job identifier.ManifoldCFException
public void prepareIncrementalScan(java.lang.Long jobID) throws ManifoldCFException
jobID
- is the job identifier.ManifoldCFException
public void deleteIngestedDocumentIdentifiers(DocumentDescription[] identifiers) throws ManifoldCFException
identifiers
- is the set of document identifiers.ManifoldCFException
public boolean checkJobBusy(java.lang.Long jobID) throws ManifoldCFException
ManifoldCFException
public void deleteAllJobRecords(java.lang.Long jobID) throws ManifoldCFException
jobID
- is the job identifier.ManifoldCFException
public void markNeedPriorityInProgress(java.lang.Long rowID, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void writeDocPriority(java.lang.Long rowID, IPriorityCalculator priority) throws ManifoldCFException
ManifoldCFException
public void prioritizeQueuedDocuments(java.lang.Long jobID) throws ManifoldCFException
ManifoldCFException
public void noDocPriorities(java.lang.Long jobID) throws ManifoldCFException
ManifoldCFException
public void clearAllDocPriorities() throws ManifoldCFException
ManifoldCFException
public void updateCompletedRecord(java.lang.Long recID, int currentStatus) throws ManifoldCFException
ManifoldCFException
public boolean updateOrHopcountRemoveRecord(java.lang.Long recID, int currentStatus) throws ManifoldCFException
ManifoldCFException
public void updateActiveRecord(java.lang.Long id, int currentStatus, java.lang.String processID) throws ManifoldCFException
id
- is the job queue id.currentStatus
- is the current statusManifoldCFException
public void setRequeuedStatus(java.lang.Long id, java.lang.Long checkTime, int action, long failTime, int failCount) throws ManifoldCFException
id
- is the job queue id.checkTime
- is the check time.ManifoldCFException
public void setDeletingStatus(java.lang.Long id, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void setUndeletingStatus(java.lang.Long id, long checkTime) throws ManifoldCFException
ManifoldCFException
public void setCleaningStatus(java.lang.Long id, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void setUncleaningStatus(java.lang.Long id, long checkTime) throws ManifoldCFException
ManifoldCFException
public void deleteRecordMultiple(java.lang.Long[] ids) throws ManifoldCFException
ids
- is the set of job queue id'sManifoldCFException
protected int maxClauseDoDeletes()
protected void doDeletes(java.util.ArrayList list) throws ManifoldCFException
ManifoldCFException
public void deleteRecord(java.lang.Long id) throws ManifoldCFException
id
- is the job queue id.ManifoldCFException
public void updateExistingRecordInitial(java.lang.Long recordID, int currentStatus, java.lang.Long checkTimeValue, long desiredExecuteTime, IPriorityCalculator desiredPriority, java.lang.String[] prereqEvents, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void insertNewRecordInitial(java.lang.Long jobID, java.lang.String docHash, java.lang.String docID, IPriorityCalculator desiredDocPriority, long desiredExecuteTime, java.lang.String[] prereqEvents, java.lang.String processID) throws ManifoldCFException
jobID
- is the job identifier.docHash
- is the hash of the local document identifier.docID
- is the local document identifier.ManifoldCFException
public void addRemainingDocumentsInitial(java.lang.Long jobID, java.lang.String[] docIDHashes, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
protected int maxClauseProcessRemainingDocuments(java.lang.Long jobID)
protected void processRemainingDocuments(java.util.Map idMap, java.lang.Long jobID, java.util.ArrayList list, java.util.Map inSet) throws ManifoldCFException
ManifoldCFException
protected int maxClauseUpdateRemainingDocuments()
protected void updateRemainingDocuments(java.util.ArrayList list, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void doneDocumentsInitial(java.lang.Long jobID, boolean isPartial) throws ManifoldCFException
jobID
- is the job identifier.isPartial
- is true of the passed list of seeds is not complete.ManifoldCFException
public java.lang.String[] getAllSeeds(java.lang.Long jobID) throws ManifoldCFException
jobID
- is the job identifier.ManifoldCFException
public void updateExistingRecord(java.lang.Long recordID, int currentStatus, java.lang.Long checkTimeValue, long desiredExecuteTime, boolean otherChangesSeen, IPriorityCalculator desiredPriority, java.lang.String[] prereqEvents) throws ManifoldCFException
ManifoldCFException
public void insertNewRecord(java.lang.Long jobID, java.lang.String docIDHash, java.lang.String docID, IPriorityCalculator desiredDocPriority, long desiredExecuteTime, java.lang.String[] prereqEvents) throws ManifoldCFException
ManifoldCFException
public static java.lang.String seedstatusToString(int status) throws ManifoldCFException
ManifoldCFException
public static int stringToSeedstatus(java.lang.String x) throws ManifoldCFException
ManifoldCFException
public static int stringToAction(java.lang.String value) throws ManifoldCFException
ManifoldCFException
public static java.lang.String actionToString(int action) throws ManifoldCFException
ManifoldCFException
public static int stringToNeedPriority(java.lang.String value) throws ManifoldCFException
ManifoldCFException
public static java.lang.String needPriorityToString(int value) throws ManifoldCFException
ManifoldCFException
public static int stringToStatus(java.lang.String value) throws ManifoldCFException
value
- is the string.ManifoldCFException
public static java.lang.String statusToString(int status) throws ManifoldCFException
status
- is the status value.ManifoldCFException
public static java.lang.String getHashCode(java.lang.String documentIdentifier) throws ManifoldCFException
documentIdentifier
- is the input document id string.ManifoldCFException