@Test void testRoleConfigsWithAttachedVolumes200GB() { HostgroupView worker = hostGroupWithVolumeTemplates(3, getVolumeTemplates(200)); List<ApiClusterTemplateConfig> roleConfigs = subject.getRoleConfigs(ImpalaRoles.ROLE_IMPALAD, worker, preparatorWithHostGroups(worker)); assertEquals( List.of( config("scratch_dirs", "/hadoopfs/fs1/impala/scratch,/hadoopfs/fs2/impala/scratch,/hadoopfs/fs3/impala/scratch"), config("datacache_enabled", "true"), config("datacache_capacity", "46170898432"), config("datacache_dirs", "/hadoopfs/fs1/impala/datacache,/hadoopfs/fs2/impala/datacache,/hadoopfs/fs3/impala/datacache")), roleConfigs ); }
@Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case ImpalaRoles.ROLE_IMPALAD: Integer minAttachedVolumeSize = hostGroupView.getVolumeTemplates().stream() .mapToInt(volume -> volume.getVolumeSize()) .min() .orElse(0); List<ApiClusterTemplateConfig> configs = new ArrayList<>(); configs.add(config(IMPALA_SCRATCH_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/scratch"))); if (minAttachedVolumeSize > MIN_ATTACHED_VOLUME_SIZE_TO_ENABLE_CACHE_IN_GB && hostGroupView.getVolumeCount() > 0) { long dataCacheCapacityInBytes = VolumeUtils .convertGBToBytes(Math.min(minAttachedVolumeSize / 2, MAX_IMPALA_DATA_CACHE_SIZE_IN_GB / hostGroupView.getVolumeCount())); configs.add(config(IMPALA_DATACACHE_ENABLED_PARAM, "true")); configs.add(config(IMPALA_DATACACHE_CAPACITY_PARAM, Long.toString(dataCacheCapacityInBytes))); configs.add(config(IMPALA_DATACACHE_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/datacache"))); } return configs; default: return List.of(); } }
ImpalaVolumeConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case ImpalaRoles.ROLE_IMPALAD: Integer minAttachedVolumeSize = hostGroupView.getVolumeTemplates().stream() .mapToInt(volume -> volume.getVolumeSize()) .min() .orElse(0); List<ApiClusterTemplateConfig> configs = new ArrayList<>(); configs.add(config(IMPALA_SCRATCH_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/scratch"))); if (minAttachedVolumeSize > MIN_ATTACHED_VOLUME_SIZE_TO_ENABLE_CACHE_IN_GB && hostGroupView.getVolumeCount() > 0) { long dataCacheCapacityInBytes = VolumeUtils .convertGBToBytes(Math.min(minAttachedVolumeSize / 2, MAX_IMPALA_DATA_CACHE_SIZE_IN_GB / hostGroupView.getVolumeCount())); configs.add(config(IMPALA_DATACACHE_ENABLED_PARAM, "true")); configs.add(config(IMPALA_DATACACHE_CAPACITY_PARAM, Long.toString(dataCacheCapacityInBytes))); configs.add(config(IMPALA_DATACACHE_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/datacache"))); } return configs; default: return List.of(); } } }
ImpalaVolumeConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case ImpalaRoles.ROLE_IMPALAD: Integer minAttachedVolumeSize = hostGroupView.getVolumeTemplates().stream() .mapToInt(volume -> volume.getVolumeSize()) .min() .orElse(0); List<ApiClusterTemplateConfig> configs = new ArrayList<>(); configs.add(config(IMPALA_SCRATCH_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/scratch"))); if (minAttachedVolumeSize > MIN_ATTACHED_VOLUME_SIZE_TO_ENABLE_CACHE_IN_GB && hostGroupView.getVolumeCount() > 0) { long dataCacheCapacityInBytes = VolumeUtils .convertGBToBytes(Math.min(minAttachedVolumeSize / 2, MAX_IMPALA_DATA_CACHE_SIZE_IN_GB / hostGroupView.getVolumeCount())); configs.add(config(IMPALA_DATACACHE_ENABLED_PARAM, "true")); configs.add(config(IMPALA_DATACACHE_CAPACITY_PARAM, Long.toString(dataCacheCapacityInBytes))); configs.add(config(IMPALA_DATACACHE_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/datacache"))); } return configs; default: return List.of(); } }  }
ImpalaVolumeConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case ImpalaRoles.ROLE_IMPALAD: Integer minAttachedVolumeSize = hostGroupView.getVolumeTemplates().stream() .mapToInt(volume -> volume.getVolumeSize()) .min() .orElse(0); List<ApiClusterTemplateConfig> configs = new ArrayList<>(); configs.add(config(IMPALA_SCRATCH_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/scratch"))); if (minAttachedVolumeSize > MIN_ATTACHED_VOLUME_SIZE_TO_ENABLE_CACHE_IN_GB && hostGroupView.getVolumeCount() > 0) { long dataCacheCapacityInBytes = VolumeUtils .convertGBToBytes(Math.min(minAttachedVolumeSize / 2, MAX_IMPALA_DATA_CACHE_SIZE_IN_GB / hostGroupView.getVolumeCount())); configs.add(config(IMPALA_DATACACHE_ENABLED_PARAM, "true")); configs.add(config(IMPALA_DATACACHE_CAPACITY_PARAM, Long.toString(dataCacheCapacityInBytes))); configs.add(config(IMPALA_DATACACHE_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/datacache"))); } return configs; default: return List.of(); } }  @Override List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source); @Override String getServiceType(); @Override Set<String> getRoleTypes(); @Override boolean sharedRoleType(String roleType); }
ImpalaVolumeConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case ImpalaRoles.ROLE_IMPALAD: Integer minAttachedVolumeSize = hostGroupView.getVolumeTemplates().stream() .mapToInt(volume -> volume.getVolumeSize()) .min() .orElse(0); List<ApiClusterTemplateConfig> configs = new ArrayList<>(); configs.add(config(IMPALA_SCRATCH_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/scratch"))); if (minAttachedVolumeSize > MIN_ATTACHED_VOLUME_SIZE_TO_ENABLE_CACHE_IN_GB && hostGroupView.getVolumeCount() > 0) { long dataCacheCapacityInBytes = VolumeUtils .convertGBToBytes(Math.min(minAttachedVolumeSize / 2, MAX_IMPALA_DATA_CACHE_SIZE_IN_GB / hostGroupView.getVolumeCount())); configs.add(config(IMPALA_DATACACHE_ENABLED_PARAM, "true")); configs.add(config(IMPALA_DATACACHE_CAPACITY_PARAM, Long.toString(dataCacheCapacityInBytes))); configs.add(config(IMPALA_DATACACHE_DIRS_PARAM, buildVolumePathStringZeroVolumeHandled(hostGroupView.getVolumeCount(), "impala/datacache"))); } return configs; default: return List.of(); } }  @Override List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source); @Override String getServiceType(); @Override Set<String> getRoleTypes(); @Override boolean sharedRoleType(String roleType);  }