peterxcli commented on code in PR #7817:
URL: https://github.com/apache/ozone/pull/7817#discussion_r1947895938
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1929,26 +1931,38 @@ public <KEY, VALUE> long
countEstimatedRowsInTable(Table<KEY, VALUE> table)
}
@Override
- public Set<String> getMultipartUploadKeys(
- String volumeName, String bucketName, String prefix) throws IOException {
+ public MultipartUploadKeys getMultipartUploadKeys(
+ String volumeName, String bucketName, String prefix, @NotNull String
keyMarker,
+ @NotNull String uploadIdMarker, int maxUploads) throws IOException {
- Set<String> response = new TreeSet<>();
+ MultipartUploadKeys.Builder resultBuilder =
MultipartUploadKeys.newBuilder();
+ Set<String> responseKeys = new TreeSet<>();
Set<String> aborted = new TreeSet<>();
+ String lastKey = null;
Iterator<Map.Entry<CacheKey<String>, CacheValue<OmMultipartKeyInfo>>>
cacheIterator = getMultipartInfoTable().cacheIterator();
String prefixKey =
OmMultipartUpload.getDbKey(volumeName, bucketName, prefix);
+ if (!keyMarker.equals("")) {
+ prefix = keyMarker;
+ if (!uploadIdMarker.equals("")) {
+ prefix = prefix + OM_KEY_PREFIX + uploadIdMarker;
+ }
+ }
+ String startKey = OmMultipartUpload.getDbKey(volumeName, bucketName,
prefix);
+
// First iterate all the entries in cache.
- while (cacheIterator.hasNext()) {
+ while (cacheIterator.hasNext() && responseKeys.size() < maxUploads + 1) {
Map.Entry<CacheKey<String>, CacheValue<OmMultipartKeyInfo>> cacheEntry =
cacheIterator.next();
if (cacheEntry.getKey().getCacheKey().startsWith(prefixKey)) {
// Check if it is marked for delete, due to abort mpu
if (cacheEntry.getValue().getCacheValue() != null) {
- response.add(cacheEntry.getKey().getCacheKey());
+ responseKeys.add(cacheEntry.getKey().getCacheKey());
+ lastKey = cacheEntry.getKey().getCacheKey();
Review Comment:
I think this case should be removed as the the cacheKey retrieved may not be
in the target page.
So the whole cacheIterator scan step can be removed, then the tombstone
check step can be moved to tableIterator step. I made some modification on it,
but I'm still fixing some effected failed tests.
--
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]