devmadhuu commented on code in PR #5517:
URL: https://github.com/apache/ozone/pull/5517#discussion_r1381661011
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskWithLegacy.java:
##########
@@ -206,6 +131,103 @@ public boolean processWithLegacy(OMUpdateEventBatch
events) {
return true;
}
+ private void processWithFileSystemLayout(OmKeyInfo updatedKeyInfo,
+ OmKeyInfo oldKeyInfo,
+ OMDBUpdateEvent.OMDBUpdateAction
action,
+ Map<Long, NSSummary> nsSummaryMap)
+ throws IOException {
+ setParentDirectoryId(updatedKeyInfo);
+
+ if (!updatedKeyInfo.getKeyName().endsWith(OM_KEY_PREFIX)) {
+ switch (action) {
+ case PUT:
+ handlePutKeyEvent(updatedKeyInfo, nsSummaryMap);
+ break;
+
+ case DELETE:
+ handleDeleteKeyEvent(updatedKeyInfo, nsSummaryMap);
+ break;
+
+ case UPDATE:
+ if (oldKeyInfo != null) {
+ setParentDirectoryId(oldKeyInfo);
+ handleDeleteKeyEvent(oldKeyInfo, nsSummaryMap);
+ } else {
+ LOG.warn("Update event does not have the old keyInfo for {}.",
+ updatedKeyInfo.getKeyName());
+ }
+ handlePutKeyEvent(updatedKeyInfo, nsSummaryMap);
+ break;
+ }
+ } else {
+ OmDirectoryInfo updatedDirectoryInfo = new OmDirectoryInfo.Builder()
+ .setName(updatedKeyInfo.getKeyName())
+ .setObjectID(updatedKeyInfo.getObjectID())
+ .setParentObjectID(updatedKeyInfo.getParentObjectID())
+ .build();
+
+ OmDirectoryInfo oldDirectoryInfo = null;
+
+ if (oldKeyInfo != null) {
+ oldDirectoryInfo =
+ new OmDirectoryInfo.Builder()
+ .setName(oldKeyInfo.getKeyName())
+ .setObjectID(oldKeyInfo.getObjectID())
+ .setParentObjectID(oldKeyInfo.getParentObjectID())
+ .build();
+ }
+
+ switch (action) {
+ case PUT:
+ handlePutDirEvent(updatedDirectoryInfo, nsSummaryMap);
+ break;
+
+ case DELETE:
+ handleDeleteDirEvent(updatedDirectoryInfo, nsSummaryMap);
+ break;
+
+ case UPDATE:
+ if (oldDirectoryInfo != null) {
+ handleDeleteDirEvent(oldDirectoryInfo, nsSummaryMap);
+ } else {
+ LOG.warn("Update event does not have the old dirInfo for {}.",
+ updatedKeyInfo.getKeyName());
+ }
+ handlePutDirEvent(updatedDirectoryInfo, nsSummaryMap);
+ break;
+ }
+ }
+ }
+
+ private void processWithObjectStoreLayout(OmKeyInfo updatedKeyInfo,
Review Comment:
@ArafatKhan2198 thanks for working on this patch. I think we can refactor
and reuse this OBS handling code with LEGACY of FS path enabled scenario when
key doesn't end with / prefix (actual key case), so that below code
duplication can be avoided.
--
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]