Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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 @@ -535,10 +535,6 @@ public final class OzoneConfigKeys {

public static final int OZONE_MANAGER_STRIPED_LOCK_SIZE_DEFAULT = 512;

public static final String OZONE_CLIENT_LIST_TRASH_KEYS_MAX =
"ozone.client.list.trash.keys.max";
public static final int OZONE_CLIENT_LIST_TRASH_KEYS_MAX_DEFAULT = 1000;

public static final String OZONE_HTTP_BASEDIR = "ozone.http.basedir";

public static final String OZONE_HTTP_POLICY_KEY =
Expand Down
8 changes: 0 additions & 8 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3356,14 +3356,6 @@
unhealthy will each have their own limit.
</description>
</property>
<property>
<name>ozone.client.list.trash.keys.max</name>
<value>1000</value>
<tag>OZONE, CLIENT</tag>
<description>
The maximum number of keys to return for a list trash request.
</description>
</property>
<property>
<name>ozone.http.basedir</name>
<value/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatus;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatusLight;
import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.S3SecretValue;
import org.apache.hadoop.ozone.om.helpers.S3VolumeContext;
import org.apache.hadoop.ozone.om.helpers.TenantStateList;
Expand Down Expand Up @@ -513,39 +512,6 @@ List<OzoneKey> listKeys(String volumeName, String bucketName,
String keyPrefix, String prevKey, int maxListResult)
throws IOException;

/**
* List trash allows the user to list the keys that were marked as deleted,
* but not actually deleted by Ozone Manager. This allows a user to recover
* keys within a configurable window.
* @param volumeName - The volume name, which can also be a wild card
* using '*'.
* @param bucketName - The bucket name, which can also be a wild card
* using '*'.
* @param startKeyName - List keys from a specific key name.
* @param keyPrefix - List keys using a specific prefix.
* @param maxKeys - The number of keys to be returned. This must be below
* the cluster level set by admins.
* @return The list of keys that are deleted from the deleted table.
* @throws IOException
*/
List<RepeatedOmKeyInfo> listTrash(String volumeName, String bucketName,
String startKeyName, String keyPrefix,
int maxKeys)
throws IOException;

/**
* Recover trash allows the user to recover keys that were marked as deleted,
* but not actually deleted by Ozone Manager.
* @param volumeName - The volume name.
* @param bucketName - The bucket name.
* @param keyName - The key user want to recover.
* @param destinationBucket - The bucket user want to recover to.
* @return The result of recovering operation is success or not.
* @throws IOException
*/
boolean recoverTrash(String volumeName, String bucketName, String keyName,
String destinationBucket) throws IOException;

/**
* Get OzoneKey.
* @param volumeName Name of the Volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
import org.apache.hadoop.ozone.om.helpers.OzoneAclUtil;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatus;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatusLight;
import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.S3SecretValue;
import org.apache.hadoop.ozone.om.helpers.S3VolumeContext;
import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
Expand Down Expand Up @@ -1759,25 +1758,6 @@ public List<OzoneKey> listKeys(String volumeName, String bucketName,
}
}

@Override
public List<RepeatedOmKeyInfo> listTrash(String volumeName, String bucketName,
String startKeyName, String keyPrefix, int maxKeys) throws IOException {

Preconditions.checkNotNull(volumeName);
Preconditions.checkNotNull(bucketName);

return ozoneManagerClient.listTrash(volumeName, bucketName, startKeyName,
keyPrefix, maxKeys);
}

@Override
public boolean recoverTrash(String volumeName, String bucketName,
String keyName, String destinationBucket) throws IOException {

return ozoneManagerClient.recoverTrash(volumeName, bucketName, keyName,
destinationBucket);
}

@Override
public OzoneKeyDetails getKeyDetails(
String volumeName, String bucketName, String keyName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ public static boolean isReadOnly(
case LookupKey:
case ListKeys:
case ListKeysLight:
case ListTrash:
case ServiceList:
case ListOpenFiles:
case ListMultiPartUploadParts:
Expand Down Expand Up @@ -302,7 +301,6 @@ public static boolean isReadOnly(
case SetAcl:
case AddAcl:
case PurgeKeys:
case RecoverTrash:
case FinalizeUpgrade:
case Prepare:
case CancelPrepare:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.apache.hadoop.ozone.om.helpers.OpenKeySession;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatus;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatusLight;
import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.S3SecretValue;
import org.apache.hadoop.ozone.om.helpers.S3VolumeContext;
import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
Expand Down Expand Up @@ -1054,39 +1053,6 @@ DBUpdates getDBUpdates(
OzoneManagerProtocolProtos.DBUpdatesRequest dbUpdatesRequest)
throws IOException;

/**
* List trash allows the user to list the keys that were marked as deleted,
* but not actually deleted by Ozone Manager. This allows a user to recover
* keys within a configurable window.
* @param volumeName - The volume name, which can also be a wild card
* using '*'.
* @param bucketName - The bucket name, which can also be a wild card
* using '*'.
* @param startKeyName - List keys from a specific key name.
* @param keyPrefix - List keys using a specific prefix.
* @param maxKeys - The number of keys to be returned. This must be below
* the cluster level set by admins.
* @return The list of keys that are deleted from the deleted table.
* @throws IOException
*/
List<RepeatedOmKeyInfo> listTrash(String volumeName, String bucketName,
String startKeyName, String keyPrefix, int maxKeys) throws IOException;

/**
* Recover trash allows the user to recover keys that were marked as deleted,
* but not actually deleted by Ozone Manager.
* @param volumeName - The volume name.
* @param bucketName - The bucket name.
* @param keyName - The key user want to recover.
* @param destinationBucket - The bucket user want to recover to.
* @return The result of recovering operation is success or not.
* @throws IOException
*/
default boolean recoverTrash(String volumeName, String bucketName,
String keyName, String destinationBucket) throws IOException {
return false;
}

/**
*
* @param txnApplyWaitTimeoutSeconds Max time in SECONDS to wait for all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
import org.apache.hadoop.ozone.om.helpers.OpenKeySession;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatus;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatusLight;
import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.S3SecretValue;
import org.apache.hadoop.ozone.om.helpers.S3VolumeContext;
import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
Expand Down Expand Up @@ -149,8 +148,6 @@
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTenantRequest;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTenantResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashRequest;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeRequest;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupFileRequest;
Expand Down Expand Up @@ -181,8 +178,6 @@
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RangerBGSyncResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RecoverLeaseRequest;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RecoverLeaseResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RecoverTrashRequest;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RecoverTrashResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RefetchSecretKeyRequest;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RefetchSecretKeyResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RemoveAclRequest;
Expand Down Expand Up @@ -2439,85 +2434,6 @@ public List<OzoneFileStatus> listStatus(OmKeyArgs args, boolean recursive,
return listStatus(args, recursive, startKey, numEntries, false);
}

@Override
public List<RepeatedOmKeyInfo> listTrash(String volumeName,
String bucketName, String startKeyName, String keyPrefix, int maxKeys)
throws IOException {

Preconditions.checkArgument(Strings.isNullOrEmpty(volumeName),
"The volume name cannot be null or " +
"empty. Please enter a valid volume name or use '*' as a wild card");

Preconditions.checkArgument(Strings.isNullOrEmpty(bucketName),
"The bucket name cannot be null or " +
"empty. Please enter a valid bucket name or use '*' as a wild card");

ListTrashRequest trashRequest = ListTrashRequest.newBuilder()
.setVolumeName(volumeName)
.setBucketName(bucketName)
.setStartKeyName(startKeyName)
.setKeyPrefix(keyPrefix)
.setMaxKeys(maxKeys)
.build();

OMRequest omRequest = createOMRequest(Type.ListTrash)
.setListTrashRequest(trashRequest)
.build();

ListTrashResponse trashResponse =
handleError(submitRequest(omRequest)).getListTrashResponse();

List<RepeatedOmKeyInfo> deletedKeyList =
new ArrayList<>(trashResponse.getDeletedKeysCount());

List<RepeatedOmKeyInfo> list = new ArrayList<>();
for (OzoneManagerProtocolProtos.RepeatedKeyInfo
repeatedKeyInfo : trashResponse.getDeletedKeysList()) {
RepeatedOmKeyInfo fromProto =
RepeatedOmKeyInfo.getFromProto(repeatedKeyInfo);
list.add(fromProto);
}
deletedKeyList.addAll(list);

return deletedKeyList;
}

@Override
public boolean recoverTrash(String volumeName, String bucketName,
String keyName, String destinationBucket) throws IOException {

Preconditions.checkArgument(Strings.isNullOrEmpty(volumeName),
"The volume name cannot be null or empty. " +
"Please enter a valid volume name.");

Preconditions.checkArgument(Strings.isNullOrEmpty(bucketName),
"The bucket name cannot be null or empty. " +
"Please enter a valid bucket name.");

Preconditions.checkArgument(Strings.isNullOrEmpty(keyName),
"The key name cannot be null or empty. " +
"Please enter a valid key name.");

Preconditions.checkArgument(Strings.isNullOrEmpty(destinationBucket),
"The destination bucket name cannot be null or empty. " +
"Please enter a valid destination bucket name.");

RecoverTrashRequest.Builder req = RecoverTrashRequest.newBuilder()
.setVolumeName(volumeName)
.setBucketName(bucketName)
.setKeyName(keyName)
.setDestinationBucket(destinationBucket);

OMRequest omRequest = createOMRequest(Type.RecoverTrash)
.setRecoverTrashRequest(req)
.build();

RecoverTrashResponse recoverResponse =
handleError(submitRequest(omRequest)).getRecoverTrashResponse();

return recoverResponse.getResponse();
}

@Override
public long prepareOzoneManager(
long txnApplyWaitTimeoutSeconds, long txnApplyCheckIntervalSeconds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ public void testKeyOps() throws Exception {
doThrow(exception).when(mockKm).lookupKey(any(), any(), any());
doThrow(exception).when(mockKm).listKeys(
any(), any(), any(), any(), anyInt());
doThrow(exception).when(mockKm).listTrash(
any(), any(), any(), any(), anyInt());
OmMetadataReader omMetadataReader =
(OmMetadataReader) ozoneManager.getOmMetadataReader().get();
HddsWhiteboxTestUtils.setInternalState(
Expand Down Expand Up @@ -843,12 +841,6 @@ private void doKeyOps(OmKeyArgs keyArgs) {
} catch (IOException ignored) {
}

try {
ozoneManager.listTrash(keyArgs.getVolumeName(),
keyArgs.getBucketName(), null, null, 0);
} catch (IOException ignored) {
}

try {
writeClient.deleteKey(keyArgs);
} catch (IOException ignored) {
Expand Down
40 changes: 25 additions & 15 deletions hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ enum Type {

ListMultipartUploads = 82;

// Not used anymore due to HDDS-11251
ListTrash = 91;
RecoverTrash = 92;
Comment thread
spacemonkd marked this conversation as resolved.
Outdated

Expand Down Expand Up @@ -232,8 +233,9 @@ message OMRequest {
optional UpdateGetS3SecretRequest updateGetS3SecretRequest = 82;
optional ListMultipartUploadsRequest listMultipartUploadsRequest = 83;

optional ListTrashRequest listTrashRequest = 91;
optional RecoverTrashRequest RecoverTrashRequest = 92;
// Not used anymore due to HDDS-11251
optional ListTrashRequest listTrashRequest = 91 [deprecated = true];
optional RecoverTrashRequest RecoverTrashRequest = 92 [deprecated = true];

optional RevokeS3SecretRequest RevokeS3SecretRequest = 93;

Expand Down Expand Up @@ -360,8 +362,10 @@ message OMResponse {

optional ListMultipartUploadsResponse listMultipartUploadsResponse = 82;

optional ListTrashResponse listTrashResponse = 91;
optional RecoverTrashResponse RecoverTrashResponse = 92;
// Not used anymore due to HDDS-11251
optional ListTrashResponse listTrashResponse = 91 [deprecated = true];
optional RecoverTrashResponse RecoverTrashResponse = 92 [deprecated = true];

optional PurgePathsResponse purgePathsResponse = 93 [deprecated = true];
optional PurgeDirectoriesResponse purgeDirectoriesResponse = 108;

Expand Down Expand Up @@ -545,33 +549,39 @@ enum Status {
/**
This command acts as a list command for deleted keys that are still present
in the deleted table on Ozone Manager.
Not used anymore due to HDDS-11251
*/
message ListTrashRequest {
required string volumeName = 1;
required string bucketName = 2;
optional string startKeyName = 3;
optional string keyPrefix = 4;
optional int32 maxKeys = 5;
// option deprecated = true;
required string volumeName = 1 [deprecated = true];
required string bucketName = 2 [deprecated = true];
optional string startKeyName = 3 [deprecated = true];
optional string keyPrefix = 4 [deprecated = true];
optional int32 maxKeys = 5 [deprecated = true];
}

message ListTrashResponse {
repeated RepeatedKeyInfo deletedKeys = 1;
// option deprecated = true;
repeated RepeatedKeyInfo deletedKeys = 1 [deprecated = true];
}

/**
This command acts as a recover command for deleted keys that are still
in deleted table on Ozone Manager.
Not used anymore due to HDDS-11251
*/

message RecoverTrashRequest {
required string volumeName = 1;
required string bucketName = 2;
required string keyName = 3;
required string destinationBucket = 4;
// option deprecated = true;
required string volumeName = 1 [deprecated = true];
required string bucketName = 2 [deprecated = true];
required string keyName = 3 [deprecated = true];
required string destinationBucket = 4 [deprecated = true];
}

message RecoverTrashResponse {
required bool response = 1;
// option deprecated = true;
required bool response = 1 [deprecated = true];
}

message VolumeInfo {
Expand Down
Loading