Search in sources :

Example 1 with ReplicationJob

use of org.apache.asterix.common.replication.ReplicationJob in project asterixdb by apache.

the class PersistentLocalResourceRepository method createReplicationJob.

private void createReplicationJob(ReplicationOperation operation, FileReference fileRef) throws HyracksDataException {
    /**
         * Durable resources path format:
         * /partition/dataverse/idx/fileName
         * Temporary resources path format:
         * /partition/TEMP_DATASETS_STORAGE_FOLDER/dataverse/idx/fileName
         */
    String[] fileNameTokens = fileRef.getAbsolutePath().split(File.separator);
    String partitionDir = fileNameTokens[fileNameTokens.length - 4];
    //exclude temporary datasets resources
    if (!partitionDir.equals(StoragePathUtil.TEMP_DATASETS_STORAGE_FOLDER)) {
        filesToBeReplicated.clear();
        filesToBeReplicated.add(fileRef.getAbsolutePath());
        ReplicationJob job = new ReplicationJob(ReplicationJobType.METADATA, operation, ReplicationExecutionType.SYNC, filesToBeReplicated);
        try {
            replicationManager.submitJob(job);
        } catch (IOException e) {
            throw new HyracksDataException(e);
        }
    }
}
Also used : ReplicationJob(org.apache.asterix.common.replication.ReplicationJob) IOException(java.io.IOException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Aggregations

IOException (java.io.IOException)1 ReplicationJob (org.apache.asterix.common.replication.ReplicationJob)1 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)1