Copilot commented on code in PR #10745:
URL: https://github.com/apache/ozone/pull/10745#discussion_r3626963063
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -2993,8 +2993,17 @@ public List<OmBucketInfo> listBuckets(String volumeName,
String startKey,
volumeName, null, null);
}
metrics.incNumBucketLists();
- return bucketManager.listBuckets(volumeName,
+ List<OmBucketInfo> buckets = bucketManager.listBuckets(volumeName,
startKey, prefix, maxNumOfBuckets, hasSnapshot);
+ Map<Pair<String, String>, OmBucketInfo> resolvedSourceCache = new
HashMap<>();
+ for (int i = 0; i < buckets.size(); i++) {
+ try {
+ buckets.set(i, enrichLinkBucketInfo(buckets.get(i),
resolvedSourceCache));
+ } catch (IOException e) {
+ LOG.debug("Failed to enrich listBuckets entry for {}/{}; returning
raw entry", volumeName, buckets.get(i).getBucketName(), e);
+ }
Review Comment:
This LOG.debug(...) line is longer than the 120-character checkstyle limit
used in this repo, and is likely to fail checkstyle. Wrap the call over
multiple lines to stay within the limit.
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmBucketInfo.java:
##########
@@ -396,6 +396,31 @@ public Builder toBuilder() {
.setTags(tags);
}
+ /**
+ * Returns a copy of this bucket with operational properties taken from
+ * {@code source}. Link identity fields (volume, name, owner, source path,
+ * ACLs, timestamps, object/update IDs) are unchanged.
+ *
+ * <p>When adding new operational bucket fields, update this method if they
+ * should be resolved from a link's source bucket.
+ */
+ public OmBucketInfo withOperationalPropertiesFrom(OmBucketInfo source) {
+ return toBuilder()
+ .setDefaultReplicationConfig(source.getDefaultReplicationConfig())
+ .setIsVersionEnabled(source.getIsVersionEnabled())
+ .setStorageType(source.getStorageType())
+ .setQuotaInBytes(source.getQuotaInBytes())
+ .setQuotaInNamespace(source.getQuotaInNamespace())
+ .setUsedBytes(source.getUsedBytes())
+ .setUsedNamespace(source.getUsedNamespace())
+ .setSnapshotUsedBytes(source.getSnapshotUsedBytes())
+ .setSnapshotUsedNamespace(source.getSnapshotUsedNamespace())
+ .addAllMetadata(source.getMetadata())
+ .setBucketLayout(source.getBucketLayout())
+ .setTags(source.getTags())
+ .build();
Review Comment:
withOperationalPropertiesFrom(...) now overwrites the link bucket’s tag map
with the source bucket’s tags. Previously, link enrichment (in
OzoneManager#getBucketInfo) did not copy tags, so link-specific tags (if any)
would be preserved; after this refactor they would be lost and the API response
changes beyond the stated operational fields (layout/replication/quotas/etc.).
If tags are not intended to be resolved from the source, avoid overriding them
here (or implement an explicit merge strategy).
--
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]