Class CoordinatedImportCoordinator
- java.lang.Object
-
- org.apache.cassandra.spark.bulkwriter.cloudstorage.coordinated.CoordinatedImportCoordinator
-
- All Implemented Interfaces:
ImportCoordinator,CoordinationSignalListener
public class CoordinatedImportCoordinator extends java.lang.Object implements ImportCoordinator, CoordinationSignalListener
Import coordinator that implements the two phase import for coordinated write. 1. It waits for the stageReady signal from StorageTransportExtension and update the restore job status on all clusters to STAGE_READY 2. It, then, polls the stage progress of each cluster and notifies StorageTransportExtension on completion 3. It waits for the applyReady signal from StorageTransportExtension and update the restore job status on all clusters to APPLY_READY 4. It polls the apply/import progress of each cluster 5. Finally, the two phase import completes. The procedure is programed inawaitInternal()
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawait()Wait indefinitely for the import operation to completeorg.apache.cassandra.spark.exception.ImportFailedExceptionfailure()Check whether the import operation has failed.static CoordinatedImportCoordinatorof(long startTimeNanos, JobInfo job, CoordinatedCloudStorageDataTransferApi dataTransferApi, StorageTransportExtension extension)voidonImportReady(java.lang.String jobId)The method is called when the write coordinator, i.e.voidonStageReady(java.lang.String jobId)The method is called when the write coordinator, i.e.booleansucceeded()Check whether the import operation has succeeded.
-
-
-
Method Detail
-
of
public static CoordinatedImportCoordinator of(long startTimeNanos, JobInfo job, CoordinatedCloudStorageDataTransferApi dataTransferApi, StorageTransportExtension extension)
-
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.ImportFailedExceptionDescription copied from interface:ImportCoordinatorWait indefinitely for the import operation to complete- Specified by:
awaitin interfaceImportCoordinator- Throws:
org.apache.cassandra.spark.exception.ImportFailedException- import failure if failed
-
onStageReady
public void onStageReady(java.lang.String jobId)
Description copied from interface:CoordinationSignalListenerThe method is called when the write coordinator, i.e. implementation ofCoordinatedTransportExtension, decides that it is ready to stage SSTable bundles on all participating clusters.- Specified by:
onStageReadyin interfaceCoordinationSignalListener- Parameters:
jobId- the unique identifier for the job
-
onImportReady
public void onImportReady(java.lang.String jobId)
Description copied from interface:CoordinationSignalListenerThe method is called when the write coordinator, i.e. implementation ofCoordinatedTransportExtension, decides that it is ready to apply/import SSTables on all participating clusters.- Specified by:
onImportReadyin interfaceCoordinationSignalListener- Parameters:
jobId- the unique identifier for the job
-
-