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
13 changes: 13 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,19 @@
</description>
</property>

<property>
<name>ozone.om.open.key.cleanup.service.timeout</name>
<value>300s</value>
<tag>OZONE, OM, PERFORMANCE</tag>
<description>A timeout value of open key cleanup service. If this is set
greater than 0, the service will stop waiting for the open key deleting
completion after this time. If timeout happens to a large proportion of
open key deletion, this value needs to be increased or
ozone.om.open.key.cleanup.limit.per.task should be decreased.
Unit could be defined with postfix (ns,ms,s,m,h,d)
</description>
</property>

<property>
<name>ozone.om.open.key.expire.threshold</name>
<value>7d</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ private OMConfigKeys() {
public static final String
OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_INTERVAL_DEFAULT = "24h";

public static final String OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_TIMEOUT =
"ozone.om.open.key.cleanup.service.timeout";
public static final String OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_TIMEOUT_DEFAULT
= "300s";

public static final String OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD =
"ozone.om.open.key.expire.threshold";
public static final String OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD_DEFAULT =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.io.IOException;
import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMMetrics;
Expand All @@ -40,7 +39,6 @@
import org.apache.commons.io.FileUtils;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED;
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_DB_CHECKPOINT_REQUEST_FLUSH;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD;

import org.junit.After;
import org.junit.Assert;
Expand Down Expand Up @@ -86,8 +84,6 @@ public void init() throws Exception {
scmId = UUID.randomUUID().toString();
omId = UUID.randomUUID().toString();
conf.setBoolean(OZONE_ACL_ENABLED, true);
conf.setTimeDuration(OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD,
2, TimeUnit.SECONDS);
cluster = MiniOzoneCluster.newBuilder(conf)
.setClusterId(clusterId)
.setScmId(scmId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@

import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;

import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS_WILDCARD;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD;

/**
* This class tests MiniOzoneHAClusterImpl.
Expand Down Expand Up @@ -71,8 +69,6 @@ public void init() throws Exception {
conf.setBoolean(OZONE_ACL_ENABLED, true);
conf.set(OzoneConfigKeys.OZONE_ADMINISTRATORS,
OZONE_ADMINISTRATORS_WILDCARD);
conf.setTimeDuration(OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD,
2, TimeUnit.SECONDS);
cluster = (MiniOzoneHAClusterImpl) MiniOzoneCluster.newOMHABuilder(conf)
.setClusterId(clusterId)
.setScmId(scmId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@

import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.MiniOzoneCluster;
import org.apache.hadoop.security.authentication.client.AuthenticationException;

import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD;

import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -67,8 +64,6 @@ public static void init() throws Exception {
clusterId = UUID.randomUUID().toString();
scmId = UUID.randomUUID().toString();
omId = UUID.randomUUID().toString();
conf.setTimeDuration(OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD,
2, TimeUnit.SECONDS);
cluster = MiniOzoneCluster.newBuilder(conf)
.setClusterId(clusterId)
.setScmId(scmId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@
import java.security.PublicKey;
import java.security.cert.X509Certificate;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION;
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IPC_CLIENT_CONNECT_MAX_RETRIES_KEY;
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_NAMES;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_SECURITY_ENABLED_KEY;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD;
import static org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS;
import static org.apache.ozone.test.GenericTestUtils.LogCapturer;
import static org.apache.ozone.test.GenericTestUtils.getTempPath;
Expand Down Expand Up @@ -85,8 +83,6 @@ public void init() throws Exception {
omId = UUID.randomUUID().toString();
conf.setBoolean(OZONE_ACL_ENABLED, true);
conf.setBoolean(OZONE_SECURITY_ENABLED_KEY, true);
conf.setTimeDuration(OZONE_OM_OPEN_KEY_EXPIRE_THRESHOLD,
2, TimeUnit.SECONDS);
conf.set(HADOOP_SECURITY_AUTHENTICATION, KERBEROS.toString());
conf.setInt(IPC_CLIENT_CONNECT_MAX_RETRIES_KEY, 2);
conf.set(OZONE_SCM_NAMES, "localhost");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,7 @@ message PurgePathRequest {

message DeleteOpenKeysRequest {
repeated OpenKeyBucket openKeysPerBucket = 1;
optional BucketLayoutProto bucketLayout = 2;
}

message OpenKeyBucket {
Expand Down
4 changes: 4 additions & 0 deletions hadoop-ozone/ozone-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,10 @@ List<OmKeyInfo> getPendingDeletionSubFiles(long volumeId,
* @return Background service.
*/
BackgroundService getDirDeletingService();

/**
* Returns the instance of Open Key Cleanup Service.
* @return Background service.
*/
BackgroundService getOpenKeyCleanupService();
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DIR_DELETING_SERVICE_INTERVAL;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DIR_DELETING_SERVICE_INTERVAL_DEFAULT;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_INTERVAL;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_INTERVAL_DEFAULT;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_TIMEOUT;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_TIMEOUT_DEFAULT;
import static org.apache.hadoop.ozone.om.OzoneManagerUtils.getBucketLayout;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.BUCKET_NOT_FOUND;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.DIRECTORY_NOT_FOUND;
Expand Down Expand Up @@ -167,6 +171,8 @@ public class KeyManagerImpl implements KeyManager {
private final boolean enableFileSystemPaths;
private BackgroundService dirDeletingService;

private BackgroundService openKeyCleanupService;

@VisibleForTesting
public KeyManagerImpl(ScmBlockLocationProtocol scmBlockClient,
OMMetadataManager metadataManager, OzoneConfiguration conf, String omId,
Expand Down Expand Up @@ -254,6 +260,20 @@ public void start(OzoneConfiguration configuration) {
TimeUnit.SECONDS, serviceTimeout, ozoneManager, configuration);
dirDeletingService.start();
}

if (openKeyCleanupService == null) {
long serviceInterval = configuration.getTimeDuration(
OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_INTERVAL,
OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
long serviceTimeout = configuration.getTimeDuration(
OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_TIMEOUT,
OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);
openKeyCleanupService = new OpenKeyCleanupService(serviceInterval,
TimeUnit.MILLISECONDS, serviceTimeout, ozoneManager, configuration);
openKeyCleanupService.start();
}
}

KeyProviderCryptoExtension getKMSProvider() {
Expand All @@ -270,6 +290,10 @@ public void stop() throws IOException {
dirDeletingService.shutdown();
dirDeletingService = null;
}
if (openKeyCleanupService != null) {
openKeyCleanupService.shutdown();
openKeyCleanupService = null;
}
}

private OmBucketInfo getBucketInfo(String volumeName, String bucketName)
Expand Down Expand Up @@ -604,6 +628,10 @@ public BackgroundService getDirDeletingService() {
return dirDeletingService;
}

public BackgroundService getOpenKeyCleanupService() {
return openKeyCleanupService;
}

@Override
public OmMultipartUploadList listMultipartUploads(String volumeName,
String bucketName, String prefix) throws OMException {
Expand Down
Loading