public class RemoteStorageScanner extends Object implements Runnable
RemoteStorageScanner is introduced to notify asynchronously for file reading on
remote storage. Asynchronous notifications will prevent RemoteTierConsumerAgent from
repeatedly attempting to read remote files and reduce CPU consumption.
It will be invoked by RemoteTierConsumerAgent to watch the required segments and scan
the existence status of the segments. If the segment file is found, it will notify the
availability of segment file.
| Constructor and Description |
|---|
RemoteStorageScanner(String baseRemoteStoragePath) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the executor.
|
void |
registerAvailabilityAndPriorityNotifier(AvailabilityNotifier retriever) |
void |
run()
Iterate the watched segment ids and check related file status.
|
void |
start()
Start the executor.
|
void |
watchSegment(TieredStoragePartitionId partitionId,
TieredStorageSubpartitionId subpartitionId,
int segmentId)
Watch the segment for a specific subpartition in the
RemoteStorageScanner. |
public RemoteStorageScanner(String baseRemoteStoragePath)
public void start()
public void watchSegment(TieredStoragePartitionId partitionId, TieredStorageSubpartitionId subpartitionId, int segmentId)
RemoteStorageScanner.
If a segment with a larger or equal id already exists, the current segment won't be watched.
If a segment with a smaller segment id is still being watched, the current segment will replace it because the smaller segment should have been consumed. This method ensures that only one segment file can be watched for each subpartition.
partitionId - is the id of partition.subpartitionId - is the id of subpartition.segmentId - is the id of segment.public void close()
public void run()
public void registerAvailabilityAndPriorityNotifier(AvailabilityNotifier retriever)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.