HDDS-170. Fix TestBlockDeletingService#testBlockDeletionTimeout. Contributed by Lokesh Jain.
This commit is contained in:
parent
e9ec3d78f5
commit
1e30547642
@ -126,7 +126,7 @@ public synchronized void run() {
|
|||||||
try {
|
try {
|
||||||
// Collect task results
|
// Collect task results
|
||||||
BackgroundTaskResult result = serviceTimeout > 0
|
BackgroundTaskResult result = serviceTimeout > 0
|
||||||
? taskResultFuture.get(serviceTimeout, TimeUnit.MILLISECONDS)
|
? taskResultFuture.get(serviceTimeout, unit)
|
||||||
: taskResultFuture.get();
|
: taskResultFuture.get();
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("task execution result size {}", result.getSize());
|
LOG.debug("task execution result size {}", result.getSize());
|
||||||
|
@ -83,10 +83,10 @@ public class BlockDeletingService extends BackgroundService{
|
|||||||
private final static int BLOCK_DELETING_SERVICE_CORE_POOL_SIZE = 10;
|
private final static int BLOCK_DELETING_SERVICE_CORE_POOL_SIZE = 10;
|
||||||
|
|
||||||
public BlockDeletingService(ContainerManager containerManager,
|
public BlockDeletingService(ContainerManager containerManager,
|
||||||
long serviceInterval, long serviceTimeout, Configuration conf) {
|
long serviceInterval, long serviceTimeout, TimeUnit unit,
|
||||||
super("BlockDeletingService", serviceInterval,
|
Configuration conf) {
|
||||||
TimeUnit.MILLISECONDS, BLOCK_DELETING_SERVICE_CORE_POOL_SIZE,
|
super("BlockDeletingService", serviceInterval, unit,
|
||||||
serviceTimeout);
|
BLOCK_DELETING_SERVICE_CORE_POOL_SIZE, serviceTimeout);
|
||||||
this.containerManager = containerManager;
|
this.containerManager = containerManager;
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
this.blockLimitPerTask = conf.getInt(
|
this.blockLimitPerTask = conf.getInt(
|
||||||
|
@ -122,7 +122,7 @@ public OzoneContainer(
|
|||||||
OZONE_BLOCK_DELETING_SERVICE_TIMEOUT,
|
OZONE_BLOCK_DELETING_SERVICE_TIMEOUT,
|
||||||
OZONE_BLOCK_DELETING_SERVICE_TIMEOUT_DEFAULT, TimeUnit.MILLISECONDS);
|
OZONE_BLOCK_DELETING_SERVICE_TIMEOUT_DEFAULT, TimeUnit.MILLISECONDS);
|
||||||
this.blockDeletingService = new BlockDeletingService(manager,
|
this.blockDeletingService = new BlockDeletingService(manager,
|
||||||
svcInterval, serviceTimeout, ozoneConfig);
|
svcInterval, serviceTimeout, TimeUnit.MILLISECONDS, ozoneConfig);
|
||||||
|
|
||||||
this.dispatcher = new Dispatcher(manager, this.ozoneConfig);
|
this.dispatcher = new Dispatcher(manager, this.ozoneConfig);
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ public class BlockDeletingServiceTestImpl
|
|||||||
|
|
||||||
public BlockDeletingServiceTestImpl(ContainerManager containerManager,
|
public BlockDeletingServiceTestImpl(ContainerManager containerManager,
|
||||||
int serviceInterval, Configuration conf) {
|
int serviceInterval, Configuration conf) {
|
||||||
super(containerManager, serviceInterval,
|
super(containerManager, serviceInterval, SERVICE_TIMEOUT_IN_MILLISECONDS,
|
||||||
SERVICE_TIMEOUT_IN_MILLISECONDS, conf);
|
TimeUnit.MILLISECONDS, conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@ -280,10 +280,11 @@ public void testBlockDeletionTimeout() throws Exception {
|
|||||||
ContainerManager containerManager = createContainerManager(conf);
|
ContainerManager containerManager = createContainerManager(conf);
|
||||||
createToDeleteBlocks(containerManager, conf, 1, 3, 1, chunksDir);
|
createToDeleteBlocks(containerManager, conf, 1, 3, 1, chunksDir);
|
||||||
|
|
||||||
// set timeout value as 1ms to trigger timeout behavior
|
// set timeout value as 1ns to trigger timeout behavior
|
||||||
long timeout = 1;
|
long timeout = 1;
|
||||||
BlockDeletingService svc =
|
BlockDeletingService svc = new BlockDeletingService(containerManager,
|
||||||
new BlockDeletingService(containerManager, 1000, timeout, conf);
|
TimeUnit.MILLISECONDS.toNanos(1000), timeout, TimeUnit.NANOSECONDS,
|
||||||
|
conf);
|
||||||
svc.start();
|
svc.start();
|
||||||
|
|
||||||
LogCapturer log = LogCapturer.captureLogs(BackgroundService.LOG);
|
LogCapturer log = LogCapturer.captureLogs(BackgroundService.LOG);
|
||||||
@ -303,7 +304,9 @@ public void testBlockDeletionTimeout() throws Exception {
|
|||||||
// test for normal case that doesn't have timeout limitation
|
// test for normal case that doesn't have timeout limitation
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
createToDeleteBlocks(containerManager, conf, 1, 3, 1, chunksDir);
|
createToDeleteBlocks(containerManager, conf, 1, 3, 1, chunksDir);
|
||||||
svc = new BlockDeletingService(containerManager, 1000, timeout, conf);
|
svc = new BlockDeletingService(containerManager,
|
||||||
|
TimeUnit.MILLISECONDS.toNanos(1000), timeout, TimeUnit.NANOSECONDS,
|
||||||
|
conf);
|
||||||
svc.start();
|
svc.start();
|
||||||
|
|
||||||
// get container meta data
|
// get container meta data
|
||||||
|
Loading…
Reference in New Issue
Block a user