title: yarn.scheduler.minimum-allocation-mb and yarn.scheduler.minimum-allocation-vcores in CapacityScheduler
body: <p>There is one thing about Hadoop's Capacity Scheduler, which confuses me.</p>
  
  <p>From Hadoop source code, I found out that <code>yarn.scheduler.minimum-allocation-mb</code> and <code>yarn.scheduler.minimum-allocation-vcores</code> configurations cannot be 0 for   <code>CapacityScheduler</code> to work.</p>
  
  <pre><code>private void validateConf(Configuration conf) {
  // validate scheduler memory allocation setting
  int minMem = conf.getInt(
    YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB,
    YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB);
  int maxMem = conf.getInt(
    YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB,
    YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB);
  
  if (minMem &lt;= 0 || minMem &gt; maxMem) {
    throw new YarnRuntimeException("Invalid resource scheduler memory"
      + " allocation configuration"
      + ", " + YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB
      + "=" + minMem
      + ", " + YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB
      + "=" + maxMem + ", min and max should be greater than 0"
      + ", max should be no smaller than min.");
  }
  
  // validate scheduler vcores allocation setting
  int minVcores = conf.getInt(
    YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES,
    YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES);
  int maxVcores = conf.getInt(
    YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES,
    YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES);
  
  if (minVcores &lt;= 0 || minVcores &gt; maxVcores) {
    throw new YarnRuntimeException("Invalid resource scheduler vcores"
      + " allocation configuration"
      + ", " + YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES
      + "=" + minVcores
      + ", " + YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES
      + "=" + maxVcores + ", min and max should be greater than 0"
      + ", max should be no smaller than min.");
  }
  </code></pre>
  
  <p>But in <code>FairScheduler</code> they can be 0.</p>
  
  <pre><code>private void validateConf(Configuration conf) {
  // validate scheduler memory allocation setting
  int minMem = conf.getInt(
    YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB,
    YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB);
  int maxMem = conf.getInt(
    YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB,
    YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB);
  
  if (minMem &lt; 0 || minMem &gt; maxMem) {
    throw new YarnRuntimeException("Invalid resource scheduler memory"
      + " allocation configuration"
      + ", " + YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB
      + "=" + minMem
      + ", " + YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB
      + "=" + maxMem + ", min should equal greater than 0"
      + ", max should be no smaller than min.");
  }
  
  // validate scheduler vcores allocation setting
  int minVcores = conf.getInt(
    YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES,
    YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES);
  int maxVcores = conf.getInt(
    YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES,
    YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES);
  
  if (minVcores &lt; 0 || minVcores &gt; maxVcores) {
    throw new YarnRuntimeException("Invalid resource scheduler vcores"
      + " allocation configuration"
      + ", " + YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES
      + "=" + minVcores
      + ", " + YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES
      + "=" + maxVcores + ", min should equal greater than 0"
      + ", max should be no smaller than min.");
  }
  </code></pre>