sadanand48 commented on code in PR #9635:
URL: https://github.com/apache/ozone/pull/9635#discussion_r2689461970
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java:
##########
@@ -139,23 +139,53 @@ Pair<Pair<Integer, Long>, Boolean>
processKeyDeletes(Map<String, PurgedKey> keyB
String snapTableKey, UUID expectedPreviousSnapshotId) throws IOException
{
long startTime = Time.monotonicNow();
Pair<Pair<Integer, Long>, Boolean> purgeResult = Pair.of(Pair.of(0, 0L),
false);
+
+ // Filter out empty files (files with no blocks) before sending to SCM
+ Map<String, PurgedKey> nonEmptyKeyBlocksList =
keyBlocksList.entrySet().stream()
+ .filter(entry -> entry.getValue().getBlockGroup() != null &&
+ entry.getValue().getBlockGroup().getDeletedBlocks()
!= null &&
+
!entry.getValue().getBlockGroup().getDeletedBlocks().isEmpty())
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+
if (LOG.isDebugEnabled()) {
- LOG.debug("Send {} key(s) to SCM: {}",
- keyBlocksList.size(), keyBlocksList);
+ LOG.debug("Send {} key(s) to SCM (filtered {} empty files): {}",
+ nonEmptyKeyBlocksList.size(), keyBlocksList.size() -
nonEmptyKeyBlocksList.size(), nonEmptyKeyBlocksList);
} else if (LOG.isInfoEnabled()) {
int logSize = 10;
- if (keyBlocksList.size() < logSize) {
- logSize = keyBlocksList.size();
+ if (nonEmptyKeyBlocksList.size() < logSize) {
+ logSize = nonEmptyKeyBlocksList.size();
}
- LOG.info("Send {} key(s) to SCM, first {} keys: {}",
- keyBlocksList.size(), logSize,
keyBlocksList.entrySet().stream().limit(logSize)
+ LOG.info("Send {} key(s) to SCM (filtered {} empty files), first {}
keys: {}",
+ nonEmptyKeyBlocksList.size(), keyBlocksList.size() -
nonEmptyKeyBlocksList.size(), logSize,
+ nonEmptyKeyBlocksList.entrySet().stream().limit(logSize)
Review Comment:
+1. Lets keep them logged as DEBUG. Also probably uniformly use 'keys'
instead of 'files' to maintain uniformity while logging
--
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]