Class LogtailerDestinationManager
java.lang.Object
com.illumon.iris.db.tables.dataimport.logtailer.LogtailerDestinationManager
A LogtailerDestinationManager instance sends data for a fully-defined set of logs to a specific destination. If multiple
destinations are required, each one requires a LogtailerDestinationManager instance. A fully-defined set of logs includes
the following:
- namespace/table
- internal partition
- column partition
- log path prefix (i.e. the full path and filename prefix for this LogtailerDestinationManager)
- destination details
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLogtailerDestinationManager(com.fishlib.io.logger.Logger log, Comparator<File> fileComparator, DataRoutingService.DeferredEndpoint remoteAddress, FullTableLocationKey table, Long idleTimeMillis, Long idlePauseTimeMillis, String pathPrefix, TokenBucketThrottle tableThrottle, TokenBucketThrottle destinationThrottle, boolean sendDoneMessage, boolean logDetailedFileInfo, boolean logBytesSent, int retryCount, long retryPauseMillis, long pollPauseMillis, long terminationWaitTimeMillis, File[] matchingFiles, String destination, DataImportFormat streamFormat, Map<String, String> metadata, TableLocationIdentifier tableLocationIdentifier, LogtailerDestinationManager.FinishedFileConsumer finishedFileConsumer) Construct a manager to tail a log stream to one destination. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidClose the SocketChannel, if it is not null.protected StringvoidRequest that the LogtailerDestinationManager thread terminatevoidRun this LogtailerDestinationManager.voidsetMatchingFiles(File[] matchingFiles) voidstartIfNeeded(File newFile, Runnable fileFinderMethod, Runnable completedMethod, Runnable startedMethod, String tableIdentifierDetails) Start a new destination thread if needed.
-
Field Details
-
remoteEndpoint
-
-
Constructor Details
-
LogtailerDestinationManager
public LogtailerDestinationManager(@NotNull com.fishlib.io.logger.Logger log, @NotNull Comparator<File> fileComparator, @NotNull DataRoutingService.DeferredEndpoint remoteAddress, @NotNull FullTableLocationKey table, @NotNull Long idleTimeMillis, @NotNull Long idlePauseTimeMillis, @NotNull String pathPrefix, @Nullable TokenBucketThrottle tableThrottle, @Nullable TokenBucketThrottle destinationThrottle, boolean sendDoneMessage, boolean logDetailedFileInfo, boolean logBytesSent, int retryCount, long retryPauseMillis, long pollPauseMillis, long terminationWaitTimeMillis, @NotNull File[] matchingFiles, @NotNull String destination, @NotNull DataImportFormat streamFormat, @NotNull Map<String, String> metadata, @NotNull TableLocationIdentifier tableLocationIdentifier, @NotNull LogtailerDestinationManager.FinishedFileConsumer finishedFileConsumer) Construct a manager to tail a log stream to one destination.- Parameters:
log- the log to which errors will be sentfileComparator- a valid file comparator for the binary log files, returns a result based on their inherent orderingremoteAddress- the address of the remote DataImportServer for this LogtailerDestinationManagertable- the table for which this LogtailerDestinationManager will send dataidleTimeMillis- if the thread doesn't send data in this amount of time, it should terminateidlePauseTimeMillis- if the thread doesn't send data in this amount of time, it should temporarily close the connectionpathPrefix- the fully-qualified path this LogtailerDestinationManager will use for file searches, the search will look for any files beginning with this valuetableThrottle- if provided, a throttle to be applied at the table leveldestinationThrottle- if provided, a throttle to be applied at the destination levelsendDoneMessage- specifies whether to send the done message to the DIS when the thread completeslogDetailedFileInfo- - if true, detailed information on file reads is loggedlogBytesSent- - if true, log events detailing the number of bytes sent are generated every time data is sent to a DISretryCount- number of retries for remote destinationretryPauseMillis- pause in millis between connection retries (the pause will be longer if too many errors occur, as insleepWithBackoff(String, long, BooleanSupplier)pollPauseMillis- pause in millis between file pollingterminationWaitTimeMillis- the max time to wait while shutting down destination managers. This governs sleep and wait cycles.matchingFiles- the current array of files for this instancedestination- the destination name, used for loggingstreamFormat- the DataImportFormat of the current streammetadata- Any metadata provided by the sourcetableLocationIdentifier- the table location identifier, used for logging and determination of endpoints during cleanupfinishedFileConsumer- Consumer that is called when a binlog file has been processed
-
-
Method Details
-
setMatchingFiles
-
run
Run this LogtailerDestinationManager. If exceptions occur, keep trying until the termination time has passed.- Parameters:
fileFinderMethod- a method to be called to update the file list in the event that files seem to disappearcompletedMethod- a method to be called when this thread completes, it must return true if it's okay to terminate and call setCompleted()tableIdentifierDetails- the details for this table identifier, used when logging
-
startIfNeeded
public void startIfNeeded(@NotNull File newFile, Runnable fileFinderMethod, Runnable completedMethod, Runnable startedMethod, String tableIdentifierDetails) Start a new destination thread if needed.- Parameters:
newFile- the new file that triggered this start requestfileFinderMethod- a method to be called to update the file list in the event that files seem to disappearcompletedMethod- a method to be called when this thread completes, it must return true if it's okay to terminate and call setCompleted()startedMethod- a method to be called if the thread startstableIdentifierDetails- the details for this table identifier, used when logging
-
requestShutdown
public void requestShutdown()Request that the LogtailerDestinationManager thread terminate -
closeSocketChannel
Close the SocketChannel, if it is not null.- Throws:
IOException- maybe thrown by socketChannel.close()
-
getRemoteEndpointName
-