From 68b4bb3690fa178d2d23421fe633622d8c1c9e52 Mon Sep 17 00:00:00 2001 From: Zhanhui Li Date: Fri, 3 Nov 2023 14:34:05 +0800 Subject: [PATCH] feat: move log4j2.xml to conf (#561) Signed-off-by: Li Zhanhui --- .../controller/server/tasks/RecycleS3Task.java | 4 ++++ .../main/resources => distribution/conf}/log4j2.xml | 0 .../rocketmq/metadata/s3/DefaultS3MetadataService.java | 10 +++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) rename {broker/src/main/resources => distribution/conf}/log4j2.xml (100%) diff --git a/controller/src/main/java/com/automq/rocketmq/controller/server/tasks/RecycleS3Task.java b/controller/src/main/java/com/automq/rocketmq/controller/server/tasks/RecycleS3Task.java index bd63e662d..108bdf3ba 100644 --- a/controller/src/main/java/com/automq/rocketmq/controller/server/tasks/RecycleS3Task.java +++ b/controller/src/main/java/com/automq/rocketmq/controller/server/tasks/RecycleS3Task.java @@ -69,6 +69,10 @@ public void process() throws ControllerException { recyclable.addAll(streamObjectMapper.recyclable(streamIds, threshold)); } + if (recyclable.isEmpty()) { + return; + } + metadataStore.getDataStore().batchDeleteS3Objects(recyclable) .whenComplete((list, e) -> { if (null != e) { diff --git a/broker/src/main/resources/log4j2.xml b/distribution/conf/log4j2.xml similarity index 100% rename from broker/src/main/resources/log4j2.xml rename to distribution/conf/log4j2.xml diff --git a/metadata/src/main/java/com/automq/rocketmq/metadata/s3/DefaultS3MetadataService.java b/metadata/src/main/java/com/automq/rocketmq/metadata/s3/DefaultS3MetadataService.java index c396feb79..133b3c6df 100644 --- a/metadata/src/main/java/com/automq/rocketmq/metadata/s3/DefaultS3MetadataService.java +++ b/metadata/src/main/java/com/automq/rocketmq/metadata/s3/DefaultS3MetadataService.java @@ -119,13 +119,21 @@ public CompletableFuture commitWalObject(S3WALObject walObject, return CompletableFuture.failedFuture(e); } - LOGGER.info("commitWalObject with walObject: {}, streamObjects: {}, compactedObjects: {}", + LOGGER.info("commitWalObject with walObject=[{}], streamObjects=[{}], compactedObjects={}", TextFormat.shortDebugString(walObject), streamObjects.stream() .map(TextFormat::shortDebugString) .collect(Collectors.joining()), compactedObjects ); + // Debug + for (S3StreamObject item : streamObjects) { + if (item.getStreamId() <= 0) { + LOGGER.error("Yuck, S3StreamObject is having invalid stream-id: {}", + TextFormat.printer().printToString(item)); + } + } + CompletableFuture future = new CompletableFuture<>(); try (SqlSession session = sessionFactory.openSession()) { S3WalObjectMapper s3WALObjectMapper = session.getMapper(S3WalObjectMapper.class);