public class TierMetadataValidator extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
TierMetadataValidator.OffsetValidationResult |
Modifier and Type | Field and Description |
---|---|
String |
metadataStatesDir |
Properties |
props |
String |
workDir |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method will be primarily used to clean up resources including various backends
|
boolean |
comparesStates(Path actual,
Path expected)
Compares the 'actual' state file with 'expected' state file.
|
static boolean |
isValidStates(Iterator<TierObjectMetadata> eIterator,
Iterator<TierObjectMetadata> aIterator,
long firstValidOffset,
Optional<TierObjectStore> objectStoreOpt,
boolean verifyOffsetScan,
CancellationContext cancellationContext,
Function<org.apache.kafka.common.TopicPartition,Long> startOffsetProducer,
boolean isFtpsCleanupEnabled) |
static void |
main(String[] args) |
void |
run() |
boolean |
validateStates(Path expected,
Path actual,
org.apache.kafka.common.TopicPartition id,
long startOffset)
For the given 'expected' and 'actual' metadata states path, the method will validate if they
are same or not.
|
static TierMetadataValidator.OffsetValidationResult |
verifyObjectInBackend(TierObjectMetadata objectMetadata,
long firstValidOffset,
TierObjectStore objStore,
boolean offsetScan,
CancellationContext cancellationContext,
Function<org.apache.kafka.common.TopicPartition,Long> startOffsetProducer)
This method is a wrapper around the logic of verifying the segment files on S3 backend.
|
public final String metadataStatesDir
public final String workDir
public Properties props
public void run() throws IOException
IOException
public boolean validateStates(Path expected, Path actual, org.apache.kafka.common.TopicPartition id, long startOffset) throws IOException
IOException
public boolean comparesStates(Path actual, Path expected) throws IOException
IOException
public static TierMetadataValidator.OffsetValidationResult verifyObjectInBackend(TierObjectMetadata objectMetadata, long firstValidOffset, TierObjectStore objStore, boolean offsetScan, CancellationContext cancellationContext, Function<org.apache.kafka.common.TopicPartition,Long> startOffsetProducer)
objectMetadata
- the tier object metadata used to fetch the object from the tier storagefirstValidOffset
- the first valid offset on the tier topic partitionobjStore
- the object store instanceoffsetScan
- boolean flag indicating whether to perform the offset scan on the segment filestartOffsetProducer
- a producer function that will be called to fetch the refreshed firstValidOffsetpublic static boolean isValidStates(Iterator<TierObjectMetadata> eIterator, Iterator<TierObjectMetadata> aIterator, long firstValidOffset, Optional<TierObjectStore> objectStoreOpt, boolean verifyOffsetScan, CancellationContext cancellationContext, Function<org.apache.kafka.common.TopicPartition,Long> startOffsetProducer, boolean isFtpsCleanupEnabled)
public void close()
close
in interface AutoCloseable
public static void main(String[] args)