public class OptimisticConsistencyGuard extends FailSafeConsistencyGuard
FailSafeConsistencyGuard which was doing the following to delete data files.
Step1: wait for all files to appear with linear backoff.
Step2: issue deletes
Step3: wait for all files to disappear with linear backoff.
Step1 and Step2 is handled by FailSafeConsistencyGuard.
We are simplifying these steps with OptimisticConsistencyGuard.
Step1: Check if all files adhere to visibility event. If yes, proceed to Sptep 3.
Step2: If not, Sleep for a configured threshold and then proceed to next step.
Step3: issue deletes.
With this, if any files that was created, should be available within configured threshold(eventual consistency).
Delete() will return false if FileNotFound. So, both cases are taken care of this ConsistencyGuard.ConsistencyGuard.FileVisibilityconsistencyGuardConfig, fs| Constructor and Description |
|---|
OptimisticConsistencyGuard(org.apache.hadoop.fs.FileSystem fs,
ConsistencyGuardConfig consistencyGuardConfig) |
| Modifier and Type | Method and Description |
|---|---|
void |
waitTillAllFilesAppear(String dirPath,
List<String> files)
Wait till all passed files belonging to a directory shows up in the listing.
|
void |
waitTillAllFilesDisappear(String dirPath,
List<String> files)
Wait till all passed files belonging to a directory disappears from listing.
|
void |
waitTillFileAppears(org.apache.hadoop.fs.Path filePath)
Wait for file to be listable based on configurable timeout.
|
void |
waitTillFileDisappears(org.apache.hadoop.fs.Path filePath)
Wait for file to be listable based on configurable timeout.
|
checkFilesVisibility, checkFileVisibility, getFilesWithoutSchemeAndAuthority, waitForFilesVisibilityclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwaitTillpublic OptimisticConsistencyGuard(org.apache.hadoop.fs.FileSystem fs,
ConsistencyGuardConfig consistencyGuardConfig)
public void waitTillFileAppears(org.apache.hadoop.fs.Path filePath)
throws TimeoutException
ConsistencyGuardwaitTillFileAppears in interface ConsistencyGuardwaitTillFileAppears in class FailSafeConsistencyGuardTimeoutException - when retries exhaustedpublic void waitTillFileDisappears(org.apache.hadoop.fs.Path filePath)
throws TimeoutException
ConsistencyGuardwaitTillFileDisappears in interface ConsistencyGuardwaitTillFileDisappears in class FailSafeConsistencyGuardTimeoutException - when retries exhaustedpublic void waitTillAllFilesAppear(String dirPath, List<String> files) throws TimeoutException
ConsistencyGuardwaitTillAllFilesAppear in interface ConsistencyGuardwaitTillAllFilesAppear in class FailSafeConsistencyGuardTimeoutExceptionpublic void waitTillAllFilesDisappear(String dirPath, List<String> files) throws TimeoutException
ConsistencyGuardwaitTillAllFilesDisappear in interface ConsistencyGuardwaitTillAllFilesDisappear in class FailSafeConsistencyGuardTimeoutExceptionCopyright © 2022 The Apache Software Foundation. All rights reserved.