Search in sources :

Example 1 with PartitionChangeException

use of org.apache.samza.coordinator.PartitionChangeException in project samza by apache.

the class ClusterBasedJobCoordinator method getPartitionCountMonitor.

private StreamPartitionCountMonitor getPartitionCountMonitor(Config config, SystemAdmins systemAdmins) {
    StreamMetadataCache streamMetadataCache = new StreamMetadataCache(systemAdmins, 0, SystemClock.instance());
    return new StreamPartitionCountMonitorFactory(streamMetadataCache, this.metrics).build(config, streamsChanged -> {
        // Fail the jobs with durable state store. Otherwise, application state.status remains UNDEFINED s.t. YARN job will be restarted
        if (hasDurableStores) {
            LOG.error("Input topic partition count changed in a job with durable state. Failing the job. Changed topics: {}", streamsChanged.toString());
            state.status = SamzaApplicationState.SamzaAppStatus.FAILED;
        }
        coordinatorException = new PartitionChangeException("Input topic partition count changes detected for topics: " + streamsChanged.toString());
    });
}
Also used : StreamMetadataCache(org.apache.samza.system.StreamMetadataCache) PartitionChangeException(org.apache.samza.coordinator.PartitionChangeException) StreamPartitionCountMonitorFactory(org.apache.samza.coordinator.StreamPartitionCountMonitorFactory)

Aggregations

PartitionChangeException (org.apache.samza.coordinator.PartitionChangeException)1 StreamPartitionCountMonitorFactory (org.apache.samza.coordinator.StreamPartitionCountMonitorFactory)1 StreamMetadataCache (org.apache.samza.system.StreamMetadataCache)1