Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
private OmTransport transport;
private ThreadLocal<S3Auth> threadLocalS3Auth
= new ThreadLocal<>();

private boolean s3AuthCheck;

public static final int BLOCK_ALLOCATION_RETRY_COUNT = 5;
Expand Down Expand Up @@ -1033,7 +1032,7 @@ public ListKeysLightResult listKeysLight(String volumeName,
reqBuilder.setBucketName(bucketName);
reqBuilder.setCount(maxKeys);

if (StringUtils.isNotEmpty(startKey)) {
if (startKey != null) {
Comment thread
ivanzlenko marked this conversation as resolved.
reqBuilder.setStartKey(startKey);
}

Expand Down Expand Up @@ -2261,9 +2260,12 @@ public List<OzoneFileStatus> listStatus(OmKeyArgs args, boolean recursive,
ListStatusRequest.newBuilder()
.setKeyArgs(keyArgs)
.setRecursive(recursive)
.setStartKey(startKey)
.setNumEntries(numEntries);

if (startKey != null) {
listStatusRequestBuilder.setStartKey(startKey);
Comment thread
ivanzlenko marked this conversation as resolved.
Outdated
}

if (allowPartialPrefixes) {
listStatusRequestBuilder.setAllowPartialPrefix(allowPartialPrefixes);
}
Expand Down Expand Up @@ -2297,9 +2299,12 @@ public List<OzoneFileStatusLight> listStatusLight(OmKeyArgs args,
ListStatusRequest.newBuilder()
.setKeyArgs(keyArgs)
.setRecursive(recursive)
.setStartKey(startKey)
.setNumEntries(numEntries);

if (startKey != null) {
listStatusRequestBuilder.setStartKey(startKey);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is also a ListStatusRequest, I think we need to set "" in else branch here, too.


if (allowPartialPrefixes) {
listStatusRequestBuilder.setAllowPartialPrefix(allowPartialPrefixes);
}
Expand Down
Comment thread
adoroszlai marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.hadoop.ozone.om;
package org.apache.hadoop.ozone;

import org.apache.hadoop.hdds.client.ReplicationConfig;
import org.apache.hadoop.hdds.utils.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.StorageType;
import org.apache.hadoop.ozone.MiniOzoneCluster;
import org.apache.hadoop.ozone.TestDataUtil;
import org.apache.hadoop.ozone.client.BucketArgs;
import org.apache.hadoop.ozone.client.OzoneBucket;
import org.apache.hadoop.ozone.client.OzoneClient;
import org.apache.hadoop.ozone.client.OzoneKey;
import org.apache.hadoop.ozone.client.OzoneVolume;
import org.apache.hadoop.ozone.client.io.OzoneInputStream;
import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
import org.apache.hadoop.ozone.om.OMConfigKeys;
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
Expand Down Expand Up @@ -63,6 +62,8 @@ public class TestListKeysWithFSO {
private static OzoneBucket fsoOzoneBucket;
private static OzoneBucket legacyOzoneBucket2;
private static OzoneBucket fsoOzoneBucket2;
private static OzoneBucket emptyLegacyOzoneBucket;
private static OzoneBucket emptyFsoOzoneBucket;
private static OzoneClient client;

/**
Expand Down Expand Up @@ -105,6 +106,10 @@ public static void init() throws Exception {
ozoneVolume.createBucket(fsoBucketName, omBucketArgs);
fsoOzoneBucket2 = ozoneVolume.getBucket(fsoBucketName);

fsoBucketName = "bucket" + RandomStringUtils.randomNumeric(5);
ozoneVolume.createBucket(fsoBucketName, omBucketArgs);
emptyFsoOzoneBucket = ozoneVolume.getBucket(fsoBucketName);

builder = BucketArgs.newBuilder();
builder.setStorageType(StorageType.DISK);
builder.setBucketLayout(BucketLayout.LEGACY);
Expand All @@ -113,6 +118,10 @@ public static void init() throws Exception {
ozoneVolume.createBucket(legacyBucketName, omBucketArgs);
legacyOzoneBucket2 = ozoneVolume.getBucket(legacyBucketName);

legacyBucketName = "bucket" + RandomStringUtils.randomNumeric(5);
ozoneVolume.createBucket(legacyBucketName, omBucketArgs);
emptyLegacyOzoneBucket = ozoneVolume.getBucket(legacyBucketName);

initFSNameSpace();
}

Expand Down Expand Up @@ -479,6 +488,24 @@ public void testShallowListKeys() throws Exception {
expectedKeys =
getExpectedKeyShallowList(keyPrefix, startKey, legacyOzoneBucket);
checkKeyShallowList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);

// case-7: keyPrefix corresponds to multiple existing keys and
// startKey is null in empty bucket
keyPrefix = "a1/b1/c12";
startKey = null;
// a1/b1/c1222.tx
expectedKeys =
getExpectedKeyShallowList(keyPrefix, startKey, emptyLegacyOzoneBucket);
checkKeyShallowList(keyPrefix, startKey, expectedKeys, emptyFsoOzoneBucket);

// case-8: keyPrefix corresponds to multiple existing keys and
// startKey is null
keyPrefix = "a1/b1/c12";
startKey = "a1/b1/c12/c3.tx";
// a1/b1/c1222.tx
expectedKeys =
getExpectedKeyShallowList(keyPrefix, startKey, legacyOzoneBucket);
checkKeyShallowList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
}

/**
Expand Down