private void validatePlanNumberOfPartitions ( PartitionPlanDescriptor currentPlan ) { int numPreviousPartitions = getTopLevelStepInstance ( ) . getPartitionPlanSize ( ) ; int numCurrentPartitions = currentPlan . getNumPartitionsInPlan ( ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "For step: " + getStepName ( ) + ", previous num partitions = " + numPreviousPartitions + ", and current num partitions = " + numCurrentPartitions ) ; } if ( executionType == ExecutionType . RESTART_NORMAL ) { if ( numPreviousPartitions == EntityConstants . PARTITION_PLAN_SIZE_UNINITIALIZED ) { logger . fine ( "For step: " + getStepName ( ) + ", previous num partitions has not been initialized, so don't validate the current plan size against it" ) ; } else if ( numCurrentPartitions != numPreviousPartitions ) { throw new IllegalArgumentException ( "Partition not configured for override, and previous execution used " + numPreviousPartitions + " number of partitions, while current plan uses a different number: " + numCurrentPartitions ) ; } } if ( numCurrentPartitions < 1 ) { throw new IllegalArgumentException ( "Partition plan size is calculated as " + numCurrentPartitions + ", but at least one partition is needed." ) ; } }
Verify the number of partitions in the plan makes sense .