swamirishi commented on code in PR #8091:
URL: https://github.com/apache/ozone/pull/8091#discussion_r1997601727
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskWithFSO.java:
##########
@@ -164,67 +178,99 @@ public Pair<Integer, Boolean>
processWithFSO(OMUpdateEventBatch events,
return new ImmutablePair<>(seekPos, false);
}
if (nsSummaryMap.size() >= nsSummaryFlushToDBMaxThreshold) {
- if (!flushAndCommitNSToDB(nsSummaryMap)) {
+ if (!flushAndCommitNSToDB(nsSummaryMap,
nsSummaryFlushToDBMaxThreshold)) {
return new ImmutablePair<>(seekPos, false);
}
seekPos = eventCounter + 1;
}
}
// flush and commit left out entries at end
- if (!flushAndCommitNSToDB(nsSummaryMap)) {
+ if (!flushAndCommitNSToDB(nsSummaryMap, 0)) {
return new ImmutablePair<>(seekPos, false);
}
LOG.debug("Completed a process run of NSSummaryTaskWithFSO");
return new ImmutablePair<>(seekPos, true);
}
public boolean reprocessWithFSO(OMMetadataManager omMetadataManager) {
- Map<Long, NSSummary> nsSummaryMap = new HashMap<>();
+ Map<Long, NSSummary> nsSummaryMap = new ConcurrentHashMap<>();
try {
- Table<String, OmDirectoryInfo> dirTable =
- omMetadataManager.getDirectoryTable();
- try (TableIterator<String,
- ? extends Table.KeyValue<String, OmDirectoryInfo>>
- dirTableIter = dirTable.iterator()) {
- while (dirTableIter.hasNext()) {
- Table.KeyValue<String, OmDirectoryInfo> kv = dirTableIter.next();
- OmDirectoryInfo directoryInfo = kv.getValue();
- handlePutDirEvent(directoryInfo, nsSummaryMap);
- if (nsSummaryMap.size() >= nsSummaryFlushToDBMaxThreshold) {
- if (!flushAndCommitNSToDB(nsSummaryMap)) {
- return false;
+ ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
Review Comment:
I am taking locks only when I have to flush
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskWithFSO.java:
##########
@@ -164,67 +178,99 @@ public Pair<Integer, Boolean>
processWithFSO(OMUpdateEventBatch events,
return new ImmutablePair<>(seekPos, false);
}
if (nsSummaryMap.size() >= nsSummaryFlushToDBMaxThreshold) {
- if (!flushAndCommitNSToDB(nsSummaryMap)) {
+ if (!flushAndCommitNSToDB(nsSummaryMap,
nsSummaryFlushToDBMaxThreshold)) {
return new ImmutablePair<>(seekPos, false);
}
seekPos = eventCounter + 1;
}
}
// flush and commit left out entries at end
- if (!flushAndCommitNSToDB(nsSummaryMap)) {
+ if (!flushAndCommitNSToDB(nsSummaryMap, 0)) {
return new ImmutablePair<>(seekPos, false);
}
LOG.debug("Completed a process run of NSSummaryTaskWithFSO");
return new ImmutablePair<>(seekPos, true);
}
public boolean reprocessWithFSO(OMMetadataManager omMetadataManager) {
- Map<Long, NSSummary> nsSummaryMap = new HashMap<>();
+ Map<Long, NSSummary> nsSummaryMap = new ConcurrentHashMap<>();
try {
- Table<String, OmDirectoryInfo> dirTable =
- omMetadataManager.getDirectoryTable();
- try (TableIterator<String,
- ? extends Table.KeyValue<String, OmDirectoryInfo>>
- dirTableIter = dirTable.iterator()) {
- while (dirTableIter.hasNext()) {
- Table.KeyValue<String, OmDirectoryInfo> kv = dirTableIter.next();
- OmDirectoryInfo directoryInfo = kv.getValue();
- handlePutDirEvent(directoryInfo, nsSummaryMap);
- if (nsSummaryMap.size() >= nsSummaryFlushToDBMaxThreshold) {
- if (!flushAndCommitNSToDB(nsSummaryMap)) {
- return false;
+ ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
Review Comment:
I am taking locks only when I have to flush to db
--
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]