Class ImportCompletionCoordinator
- java.lang.Object
-
- org.apache.cassandra.spark.bulkwriter.cloudstorage.ImportCompletionCoordinator
-
- All Implemented Interfaces:
ImportCoordinator
public final class ImportCompletionCoordinator extends java.lang.Object implements ImportCoordinator
Import coordinator that wait for import of all slices to complete. 1. It queries all relevant sidecar instance to learned whether slices are imported or not 2. It aggregates the results locally to determine whether consistency level has been satisfied or not. The procedure is programed inawait()
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawait()Block for the imports to complete by invoking the CreateRestoreJobSlice call to the server.org.apache.cassandra.spark.exception.ImportFailedExceptionfailure()Check whether the import operation has failed.static ImportCompletionCoordinatorof(long startTimeNanos, BulkWriterContext writerContext, CloudStorageDataTransferApi dataTransferApi, BulkWriteValidator writeValidator, java.util.List<CloudStorageStreamResult> resultsAsCloudStorageStreamResults, StorageTransportExtension extension, java.util.function.Consumer<CancelJobEvent> onCancelJob)booleansucceeded()Check whether the import operation has succeeded.
-
-
-
Method Detail
-
of
public static ImportCompletionCoordinator of(long startTimeNanos, BulkWriterContext writerContext, CloudStorageDataTransferApi dataTransferApi, BulkWriteValidator writeValidator, java.util.List<CloudStorageStreamResult> resultsAsCloudStorageStreamResults, StorageTransportExtension extension, java.util.function.Consumer<CancelJobEvent> onCancelJob)
-
succeeded
public boolean succeeded()
Description copied from interface:ImportCoordinatorCheck whether the import operation has succeeded. The method does not block.- Specified by:
succeededin interfaceImportCoordinator- Returns:
- true if import has succeeded. When import is pending or failed, it returns false
-
failure
public org.apache.cassandra.spark.exception.ImportFailedException failure()
Description copied from interface:ImportCoordinatorCheck whether the import operation has failed. The method does not block.- Specified by:
failurein interfaceImportCoordinator- Returns:
- ImportFailedException if import has failed; null otherwise
-
await
public void await() throws org.apache.cassandra.spark.exception.ImportFailedExceptionBlock for the imports to complete by invoking the CreateRestoreJobSlice call to the server. The method passes when the successful import can satisfy the configured consistency level; otherwise, the method fails. The wait is indefinite until one of the following conditions is met, 1) _all_ slices have been checked, or 2) the spark job reaches to its completion timeout 3) At least one slice fails CL validation, as the job will eventually fail in this case. this means that some slices may never be processed by this loopWhen there is a slice failed on CL validation and there are remaining slices to check, the wait continues.
- Specified by:
awaitin interfaceImportCoordinator- Throws:
org.apache.cassandra.spark.exception.ImportFailedException- import failure if failed
-
-