Package com.illumon.iris.logfilemanager
Class BinaryLogFileManager
java.lang.Object
com.illumon.iris.logfilemanager.BinaryLogFileManager
- Direct Known Subclasses:
DateBinaryLogFileManager,StandardBinaryLogFileManager
Abstract class providing base logic and required methods to be implemented for classes which determine column partition information for binary log files.
Any implementation must include a constructor which takes the same parameters as
BinaryLogFileManager(Logger, DataRoutingService, LogtailerConfiguration.ConfigurationEntry, LogtailerMain.LogtailerRunDetails, LogtailerDestinationThrottles).
That constructor should call this constructor with super(...).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classContainer for status for each handledTableLocationIdentifier. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected File[]findAndSetMatchingFiles(BinaryLogFileManager.TableLocationIdentifierStatus tableLocationIdentifierStatus) Regenerate and return the matching-files-array for the specified TableLocationIdentifierStatus by scanning the filesystem and replacing the list.Map<TableIdentifier,Map<TableLocationIdentifier, BinaryLogFileManager.TableLocationIdentifierStatus>> This is for testing only.booleanhandleFile(Path newFilePath, boolean isStartup) Given a new file, see if it belongs to this BinaryLogFileManager, and if so, handle it.voidHandle a routing configuration change by updating destinations for affected TableIdentifiers.voidPrevent any new destination threads from being created, and request shutdown on all the existing threads.
-
Field Details
-
logDetails
-
-
Method Details
-
findAndSetMatchingFiles
protected File[] findAndSetMatchingFiles(BinaryLogFileManager.TableLocationIdentifierStatus tableLocationIdentifierStatus) Regenerate and return the matching-files-array for the specified TableLocationIdentifierStatus by scanning the filesystem and replacing the list. The scan and the replacement are performed while holdingBinaryLogFileManager.TableLocationIdentifierStatus.matchingFilesLockso that they cannot interleave with an incremental append inhandleFile(java.nio.file.Path, boolean): the scan observes the filesystem and publishes its result atomically with respect to that append, so whichever runs second sees a consistent list. The lock is per-status, so this never blocks scans or appends for a different file set.- Parameters:
tableLocationIdentifierStatus- the tableLocationIdentifierStatus for the event that triggered this call- Returns:
- the current array of matching files for this TableLocationIdentifierStatus
-
getTableLocationIdentifierStatusMap
@VisibleForTesting public Map<TableIdentifier,Map<TableLocationIdentifier, getTableLocationIdentifierStatusMap()BinaryLogFileManager.TableLocationIdentifierStatus>> This is for testing only.- Returns:
- the TableLocationIdentifier status map
-
handleFile
Given a new file, see if it belongs to this BinaryLogFileManager, and if so, handle it. This determination is based on the parsedTableLocationIdentifierfor the file.- Parameters:
newFilePath- the new file's fullPathisStartup- if true, this is a file found during startup- Returns:
- true if the file was consumed by this BinaryLogFileManager
-
requestShutdown
public void requestShutdown()Prevent any new destination threads from being created, and request shutdown on all the existing threads. -
handleRoutingConfigChange
public void handleRoutingConfigChange()Handle a routing configuration change by updating destinations for affected TableIdentifiers. This method detects which TableIdentifiers have changed destinations and updates only those, without restarting the entire BinaryLogFileManager.The statusMap updates are performed under synchronization, but the filesystem rescan is done outside the lock to avoid blocking directory watcher threads during potentially lengthy I/O.
-