gavinchou commented on code in PR #35474:
URL: https://github.com/apache/doris/pull/35474#discussion_r1616172934
##########
fe/fe-core/src/main/java/org/apache/doris/transaction/PublishVersionDaemon.java:
##########
@@ -302,7 +302,14 @@ private List<TPartitionVersionInfo>
generatePartitionVersionInfos(Collection<Tab
private List<TPartitionVersionInfo>
generatePartitionVersionInfos(TableCommitInfo tableCommitInfo,
TransactionState transactionState, Map<Long, Set<Long>>
beIdToBaseTabletIds) {
try {
-
beIdToBaseTabletIds.putAll(getBaseTabletIdsForEachBe(transactionState,
tableCommitInfo));
+ Map<Long, Set<Long>> map =
getBaseTabletIdsForEachBe(transactionState, tableCommitInfo);
+ map.forEach((beId, newSet) -> {
+ beIdToBaseTabletIds.computeIfPresent(beId, (id, orgSet) -> {
+ orgSet.addAll(newSet);
+ return orgSet;
+ });
+ beIdToBaseTabletIds.putIfAbsent(beId, newSet);
Review Comment:
Is line 311 necessary?
The lib says that for computeIfPresent
> If the specified key is not already associated with a value (or is mapped
to null), attempts to compute its value using the given mapping function and
enters it into this map unless null.
If the function returns null no mapping is recorded. If the function itself
throws an (unchecked) exception, the exception is rethrown, and no mapping is
recorded. The most common usage is to construct a new object serving as an
initial mapped value or memoized result, as in:
map.computeIfAbsent(key, k -> new Value(f(k)));
--
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]