peterxcli commented on code in PR #7817:
URL: https://github.com/apache/ozone/pull/7817#discussion_r1957135934
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1929,46 +1929,58 @@ 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, String keyMarker,
+ String uploadIdMarker, int maxUploads) throws IOException {
- Set<String> response = new TreeSet<>();
- Set<String> aborted = new TreeSet<>();
-
- Iterator<Map.Entry<CacheKey<String>, CacheValue<OmMultipartKeyInfo>>>
- cacheIterator = getMultipartInfoTable().cacheIterator();
+ MultipartUploadKeys.Builder resultBuilder =
MultipartUploadKeys.newBuilder();
+ Set<String> responseKeys = new TreeSet<>();
+ String lastKey = null;
String prefixKey =
OmMultipartUpload.getDbKey(volumeName, bucketName, prefix);
- // First iterate all the entries in cache.
- while (cacheIterator.hasNext()) {
- 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());
- } else {
- aborted.add(cacheEntry.getKey().getCacheKey());
- }
Review Comment:
I think this is still necessary to guarantee consistency. And I guess one
possible way is to use some two pointer technique to merge two sorted keyset,
first is from all cache entries(exclude those less than startKey), second is
those records retrieved from db(current change). After merge them, truncate
extra records.
--
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]