public class TierMetadataValidator
extends java.lang.Object
implements java.lang.AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
TierMetadataValidator.OffsetValidationResult |
Modifier and Type | Field and Description |
---|---|
java.lang.String |
metadataStatesDir |
java.util.Properties |
props |
java.lang.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(java.nio.file.Path actual,
java.nio.file.Path expected)
Compares the 'actual' state file with 'expected' state file.
|
static boolean |
isValidStates(java.util.Iterator<TierObjectMetadata> eIterator,
java.util.Iterator<TierObjectMetadata> aIterator,
long firstValidOffset,
java.util.Optional<TierObjectStore> objectStoreOpt,
boolean verifyOffsetScan,
CancellationContext cancellationContext,
java.util.function.Function<org.apache.kafka.common.TopicPartition,java.lang.Long> startOffsetProducer) |
static void |
main(java.lang.String[] args) |
void |
run() |
boolean |
validateStates(java.nio.file.Path expected,
java.nio.file.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,
java.util.function.Function<org.apache.kafka.common.TopicPartition,java.lang.Long> startOffsetProducer)
This method is a wrapper around the logic of verifying the segment files on S3 backend.
|
public final java.lang.String metadataStatesDir
public final java.lang.String workDir
public java.util.Properties props
public void run() throws java.io.IOException
java.io.IOException
public boolean validateStates(java.nio.file.Path expected, java.nio.file.Path actual, org.apache.kafka.common.TopicPartition id, long startOffset) throws java.io.IOException
java.io.IOException
public boolean comparesStates(java.nio.file.Path actual, java.nio.file.Path expected) throws java.io.IOException
java.io.IOException
public static TierMetadataValidator.OffsetValidationResult verifyObjectInBackend(TierObjectMetadata objectMetadata, long firstValidOffset, TierObjectStore objStore, boolean offsetScan, CancellationContext cancellationContext, java.util.function.Function<org.apache.kafka.common.TopicPartition,java.lang.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(java.util.Iterator<TierObjectMetadata> eIterator, java.util.Iterator<TierObjectMetadata> aIterator, long firstValidOffset, java.util.Optional<TierObjectStore> objectStoreOpt, boolean verifyOffsetScan, CancellationContext cancellationContext, java.util.function.Function<org.apache.kafka.common.TopicPartition,java.lang.Long> startOffsetProducer)
public void close()
close
in interface java.lang.AutoCloseable
public static void main(java.lang.String[] args)