Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ public final class OzoneConfigKeys {
public static final String OZONE_BLOCK_DELETING_SERVICE_TIMEOUT_DEFAULT
= "300s"; // 300s for default

public static final String OZONE_BLOCK_DELETING_SERVICE_WORKERS =
"ozone.block.deleting.service.workers";
public static final int OZONE_BLOCK_DELETING_SERVICE_WORKERS_DEFAULT
= 10;

public static final String OZONE_KEY_PREALLOCATION_BLOCKS_MAX =
"ozone.key.preallocation.max.blocks";
public static final int OZONE_KEY_PREALLOCATION_BLOCKS_MAX_DEFAULT
Expand Down
8 changes: 8 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,14 @@
assumed.
</description>
</property>
<property>
<name>ozone.block.deleting.service.workers</name>
<value>10</value>
<tag>OZONE, PERFORMANCE, SCM</tag>
<description>Number of workers executed of block deletion service. This
configuration should be set to greater than 0.
</description>
</property>
<property>
<name>ozone.UnsafeByteOperations.enabled</name>
<value>true</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@ public class BlockDeletingService extends BackgroundService {

// Task priority is useful when a to-delete block has weight.
private static final int TASK_PRIORITY_DEFAULT = 1;
// Core pool size for container tasks
private static final int BLOCK_DELETING_SERVICE_CORE_POOL_SIZE = 10;

public BlockDeletingService(OzoneContainer ozoneContainer,
long serviceInterval, long serviceTimeout, TimeUnit timeUnit,
ConfigurationSource conf) {
long serviceInterval, long serviceTimeout,
TimeUnit timeUnit, int workerSize,
ConfigurationSource conf) {
super("BlockDeletingService", serviceInterval, timeUnit,
BLOCK_DELETING_SERVICE_CORE_POOL_SIZE, serviceTimeout);
workerSize, serviceTimeout);
this.ozoneContainer = ozoneContainer;
try {
containerDeletionPolicy = conf.getClass(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
import com.google.common.collect.Maps;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_TIMEOUT;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_TIMEOUT_DEFAULT;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_WORKERS;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_WORKERS_DEFAULT;
import static org.apache.hadoop.ozone.container.ozoneimpl.ContainerScrubberConfiguration.VOLUME_BYTES_PER_SECOND_KEY;

import org.apache.hadoop.util.Timer;
Expand Down Expand Up @@ -184,9 +186,13 @@ public OzoneContainer(
.getTimeDuration(OZONE_BLOCK_DELETING_SERVICE_TIMEOUT,
OZONE_BLOCK_DELETING_SERVICE_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);

int serviceWorkerSize = config
.getInt(OZONE_BLOCK_DELETING_SERVICE_WORKERS,
OZONE_BLOCK_DELETING_SERVICE_WORKERS_DEFAULT);
blockDeletingService =
new BlockDeletingService(this, svcInterval.toMillis(), serviceTimeout,
TimeUnit.MILLISECONDS, config);
TimeUnit.MILLISECONDS, serviceWorkerSize, config);

if (certClient != null && secConf.isGrpcTlsEnabled()) {
List<X509Certificate> x509Certificates =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public void testBlockDeletionTimeout() throws Exception {
mockDependencies(containerSet, keyValueHandler);
BlockDeletingService svc = new BlockDeletingService(ozoneContainer,
TimeUnit.MILLISECONDS.toNanos(1000), timeout, TimeUnit.NANOSECONDS,
conf);
10, conf);
svc.start();

LogCapturer log = LogCapturer.captureLogs(BackgroundService.LOG);
Expand All @@ -552,7 +552,7 @@ public void testBlockDeletionTimeout() throws Exception {
timeout = 0;
svc = new BlockDeletingService(ozoneContainer,
TimeUnit.MILLISECONDS.toNanos(1000), timeout, TimeUnit.MILLISECONDS,
conf);
10, conf);
svc.start();

// get container meta data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private BlockDeletingService getBlockDeletingService() {
Mockito.when(ozoneContainer.getWriteChannel()).thenReturn(null);
blockDeletingService = new BlockDeletingService(ozoneContainer,
SERVICE_INTERVAL_IN_MILLISECONDS, SERVICE_TIMEOUT_IN_MILLISECONDS,
TimeUnit.MILLISECONDS, conf);
TimeUnit.MILLISECONDS, 10, conf);
return blockDeletingService;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class BlockDeletingServiceTestImpl
public BlockDeletingServiceTestImpl(OzoneContainer container,
int serviceInterval, ConfigurationSource conf) {
super(container, serviceInterval, SERVICE_TIMEOUT_IN_MILLISECONDS,
TimeUnit.MILLISECONDS, conf);
TimeUnit.MILLISECONDS, 10, conf);
}

@VisibleForTesting
Expand Down