ChenSammi commented on code in PR #9894: URL: https://github.com/apache/ozone/pull/9894#discussion_r2994507306
########## hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/protocol/ListStatusLightOptions.java: ########## @@ -0,0 +1,182 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.ozone.client.protocol; + +import java.util.Objects; + +/** + * Options for {@link ClientProtocol#listStatusLight(ListStatusLightOptions)}. + * Encapsulates all parameters to allow future extensibility without breaking + * the method signature. + */ +public final class ListStatusLightOptions { + + private final String volumeName; + private final String bucketName; + private final String keyName; + private final boolean recursive; + private final String startKey; + private final long numEntries; + private final boolean allowPartialPrefixes; + // When keyName is empty (root listing), this is the original S3/list + // prefix for STS auth. Enables LIST check on this prefix instead of "*". + private final String listPrefix; Review Comment: The current change will break the list-objects-v2 behavior. ``` keyPrefix delimiterKeyPrefix(with patch) delimiterKeyPrefix(without patch) "" "" "" "dir" "dir" "" "dir/" "dir/" "dir/" ``` So the impact is if keyPrefix is "dir". If prefix='dir', Delimiter='/', list-objects-v2 behavior is search for "folders" or files that starts with string "dir1". Let's assume there are "dir1/", "dir-file1", "dir0-file2", and "dir12/", then all these four items are expected to be returned. When we change the delimiterKeyPrefix to "dir", the current Ozone logic will return empty(OBS), or fail with exception(FSO), because when the delimiterKeyPrefix is "dir", it only search for any file or directory which has the exactly "dir" name, it doesn't treat "dir" as a prefix. I'm kind of understand your problem, to restrict OM to only touch key/directory under s3:prefix, for example, "userA/*", which will work without this patch, but for prefix, like "userA*", then only when userA really exist, it could work as you expected, if there is no userA, but userAA, userAB, then current change will fail the list operation. There are two possible solutions, - Limit the s3:prefix support scope, only support prefix which is exactly a file or directory exists in bucket. prefix don't point to any key or directory doesn't support. But I'm afraid this is not that user friendly. - Adjust the permission required by STS ListBucket with s3:prefix, or normal ListBucket operation? I'm not quite get what's the permission issue here, is it that you don't want to grant user READ permission on bucket? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
