Skip to content

Commit

Permalink
fix: avoid unmodifiable container (#569)
Browse files Browse the repository at this point in the history
Signed-off-by: Li Zhanhui <[email protected]>
  • Loading branch information
lizhanhui authored Nov 3, 2023
1 parent b8e68ad commit f738261
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 3 additions & 0 deletions distribution/conf/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<Logger name="com.automq.rocketmq.controller" level="info" additivity="false">
<AppenderRef ref="controllerAppender" />
</Logger>
<Logger name="com.automq.rocketmq.metadata" level="info" additivity="false">
<AppenderRef ref="controllerAppender" />
</Logger>
<Logger name="com.automq.stream" level="info" additivity="false">
<AppenderRef ref="streamAppender"/>
</Logger>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,7 @@ public CompletableFuture<Void> commitWalObject(S3WALObject walObject,
object.setEndOffset(s3StreamObject.getEndOffset());
object.setObjectSize(s3StreamObject.getObjectSize());
s3StreamObjectMapper.commit(object);
if (toCache.containsKey(object.getStreamId())) {
toCache.get(object.getStreamId()).add(object);
} else {
toCache.put(object.getStreamId(), List.of(object));
}
toCache.computeIfAbsent(object.getStreamId(), streamId -> new ArrayList<>()).add(object);
});
}

Expand Down Expand Up @@ -330,8 +326,7 @@ public CompletableFuture<Void> commitStreamObject(apache.rocketmq.controller.v1.
.min(Long::compareTo).get();
}

List<com.automq.rocketmq.metadata.dao.S3StreamObject>
toCache = new ArrayList<>();
List<com.automq.rocketmq.metadata.dao.S3StreamObject> toCache = new ArrayList<>();

// create a new S3StreamObject to replace committed ones
if (streamObject.getObjectId() != S3Constants.NOOP_OBJECT_ID) {
Expand Down

0 comments on commit f738261

Please sign in to comment.