From 1ca77d4cd4c194dc87f624b2273aa07fc6585256 Mon Sep 17 00:00:00 2001 From: Michael Tinker Date: Tue, 20 Feb 2024 13:13:54 -0600 Subject: [PATCH] Ignore FileAlreadyExistsException when creating a signature file Signed-off-by: Michael Tinker --- .../records/impl/producers/formats/v6/SignatureWriterV6.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/records/impl/producers/formats/v6/SignatureWriterV6.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/records/impl/producers/formats/v6/SignatureWriterV6.java index 91a8c9af9667..d4e624861ab9 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/records/impl/producers/formats/v6/SignatureWriterV6.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/records/impl/producers/formats/v6/SignatureWriterV6.java @@ -31,6 +31,7 @@ import edu.umd.cs.findbugs.annotations.NonNull; import java.io.IOException; import java.io.UncheckedIOException; +import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; @@ -107,6 +108,10 @@ static void writeSignatureFile( logger.debug("signature file saved: {}", sigFilePath); // flush fileOut.flush(); + } catch (final FileAlreadyExistsException ignore) { + // This is part of normal operations, as a reconnected node will very commonly + // re-create an existing record stream file while REPLAYING_EVENTS + logger.info("Skipping signature file for {} as it already exists", recordFilePath); } catch (final IOException e) { logger.error("Fail to generate signature file for {}", recordFilePath, e); throw new UncheckedIOException(e);