private ACTION getReplicationWorkflowAction(Cluster srcCluster, Cluster trgCluster, Path wfPath,
String wfName, Storage sourceStorage,
Storage targetStorage) throws FalconException {
ACTION replicationAction = new ACTION();
WORKFLOW replicationWF = new WORKFLOW();
replicationWF.setAppPath(getStoragePath(wfPath.toString()));
Map<String, String> props = createCoordDefaultConfiguration(trgCluster, wfPath, wfName);
props.put("srcClusterName", srcCluster.getName());
props.put("srcClusterColo", srcCluster.getColo());
if (props.get(MR_MAX_MAPS) == null) { // set default if user has not overridden
props.put(MR_MAX_MAPS, getDefaultMaxMaps());
}
if (props.get(MR_MAP_BANDWIDTH) == null) { // set default if user has not overridden
props.put(MR_MAP_BANDWIDTH, getDefaultMapBandwidth());
}
// the storage type is uniform across source and target feeds for replication
props.put("falconFeedStorageType", sourceStorage.getType().name());
String instancePaths = null;
if (sourceStorage.getType() == Storage.TYPE.FILESYSTEM) {
String pathsWithPartitions = getPathsWithPartitions(srcCluster, trgCluster, entity);
instancePaths = pathsWithPartitions;
propagateFileSystemCopyProperties(pathsWithPartitions, props);
} else if (sourceStorage.getType() == Storage.TYPE.TABLE) {
instancePaths = "${coord:dataIn('input')}";
final CatalogStorage sourceTableStorage = (CatalogStorage) sourceStorage;
propagateTableStorageProperties(srcCluster, sourceTableStorage, props, "falconSource");
final CatalogStorage targetTableStorage = (CatalogStorage) targetStorage;
propagateTableStorageProperties(trgCluster, targetTableStorage, props, "falconTarget");
propagateTableCopyProperties(srcCluster, sourceTableStorage,
trgCluster, targetTableStorage, props);
setupHiveConfiguration(srcCluster, trgCluster, wfPath);
}
propagateLateDataProperties(entity, instancePaths, sourceStorage.getType().name(), props);
propagateUserWorkflowProperties(props, "replication");
replicationWF.setConfiguration(getCoordConfig(props));
replicationAction.setWorkflow(replicationWF);
return replicationAction;
}