devmadhuu commented on code in PR #4626:
URL: https://github.com/apache/ozone/pull/4626#discussion_r1221384866
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskDbEventHandler.java:
##########
@@ -225,4 +336,136 @@ protected boolean checkAndCallFlushToDB(
}
return true;
}
+
+ protected boolean writeFlushAndCommitOrphanKeysMetaDataToDB(
+ Map<Long, OrphanKeyMetaData> orphanKeyMetaDataMap, long status) {
+ try {
+ writeOrphanKeysMetaDataToDB(orphanKeyMetaDataMap, status);
+ orphanKeyMetaDataMap.clear();
+ } catch (IOException e) {
+ LOG.error("Unable to write orphan keys meta data in Recon DB.", e);
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean checkOrphanDataAndCallWriteFlushToDB(
+ Map<Long, OrphanKeyMetaData> orphanKeyMetaDataMap, long status) {
+ // if map contains more than entries, flush to DB and clear the map
+ if (null != orphanKeyMetaDataMap && orphanKeyMetaDataMap.size() >=
+ orphanKeysFlushToDBMaxThreshold) {
+ return writeFlushAndCommitOrphanKeysMetaDataToDB(
+ orphanKeyMetaDataMap, status);
+ }
+ return true;
+ }
+
+ protected void deleteOrphanKeysMetaDataFromDB(
+ List<Long> orphanKeysParentIdList) throws IOException {
+ try (RDBBatchOperation rdbBatchOperation = new RDBBatchOperation()) {
+ orphanKeysParentIdList.forEach(parentId -> {
+ try {
+ reconNamespaceSummaryManager.batchDeleteOrphanKeyMetaData(
+ rdbBatchOperation, parentId);
+ } catch (IOException e) {
+ LOG.error(
Review Comment:
handled.
--
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]