From 7fbf16a3c7e6a352390b8c8111c7a88894578657 Mon Sep 17 00:00:00 2001 From: David Ryan Date: Mon, 14 Oct 2024 09:58:34 +1100 Subject: [PATCH] Fixed related to feedback. --- .../teku/services/chainstorage/StorageService.java | 2 +- .../tech/pegasys/teku/storage/archive/DataArchive.java | 8 ++++---- .../teku/storage/archive/fsarchive/FileSystemArchive.java | 6 +++--- .../teku/storage/server/kvstore/KvStoreDatabase.java | 4 ++-- .../teku/storage/server/pruner/BlobSidecarPruner.java | 4 +++- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java index c9cb152f4f2..9e243e6fd05 100644 --- a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java +++ b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java @@ -157,7 +157,7 @@ protected SafeFuture doStart() { final DataArchive dataArchive = config .getBlobsArchivePath() - .map(path -> (DataArchive) new FileSystemArchive(Path.of(path))) + .map(path -> new FileSystemArchive(Path.of(path))) .orElse(new NoopDataArchive()); if (config.getSpec().isMilestoneSupported(SpecMilestone.DENEB)) { diff --git a/storage/src/main/java/tech/pegasys/teku/storage/archive/DataArchive.java b/storage/src/main/java/tech/pegasys/teku/storage/archive/DataArchive.java index c020011ae60..2cad69228e3 100644 --- a/storage/src/main/java/tech/pegasys/teku/storage/archive/DataArchive.java +++ b/storage/src/main/java/tech/pegasys/teku/storage/archive/DataArchive.java @@ -18,10 +18,10 @@ import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; /** - * Interface for a data archive which stores non-current BlobSidecars and could be extended later to - * include other data types. It is expected that the DataArchive is on disk or externally stored - * with slow write and recovery times. Initial interface is write only, but may be expanded to - * include read operations later. + * Interface for a data archive which stores prunable BlobSidecars outside the data availability + * window and could be extended later to include other data types. It is expected that the + * DataArchive is on disk or externally stored with slow write and recovery times. Initial interface + * is write only, but may be expanded to include read operations later. */ public interface DataArchive { diff --git a/storage/src/main/java/tech/pegasys/teku/storage/archive/fsarchive/FileSystemArchive.java b/storage/src/main/java/tech/pegasys/teku/storage/archive/fsarchive/FileSystemArchive.java index 98990abb8ff..f731a1c081e 100644 --- a/storage/src/main/java/tech/pegasys/teku/storage/archive/fsarchive/FileSystemArchive.java +++ b/storage/src/main/java/tech/pegasys/teku/storage/archive/fsarchive/FileSystemArchive.java @@ -78,14 +78,14 @@ public boolean archive(final List blobSidecars) { final SlotAndBlockRoot slotAndBlockRoot = blobSidecars.getFirst().getSlotAndBlockRoot(); final File file = resolve(slotAndBlockRoot); if (file.exists()) { - LOG.warn("Failed to write BlobSidecar. File exists: {}", file.toString()); + LOG.error("Failed to write BlobSidecar. File exists: {}", file.toString()); return false; } try { Files.createDirectories(file.toPath().getParent()); } catch (IOException e) { - LOG.warn( + LOG.error( "Failed to write BlobSidecar. Could not make directories to: {}", file.getParentFile().toString()); return false; @@ -97,7 +97,7 @@ public boolean archive(final List blobSidecars) { indexWriter.newLine(); return true; } catch (IOException | NullPointerException e) { - LOG.warn("Failed to write BlobSidecar.", e); + LOG.error("Failed to write BlobSidecar.", e); return false; } } diff --git a/storage/src/main/java/tech/pegasys/teku/storage/server/kvstore/KvStoreDatabase.java b/storage/src/main/java/tech/pegasys/teku/storage/server/kvstore/KvStoreDatabase.java index 2bc0a1a7a76..9f3fdf05da0 100644 --- a/storage/src/main/java/tech/pegasys/teku/storage/server/kvstore/KvStoreDatabase.java +++ b/storage/src/main/java/tech/pegasys/teku/storage/server/kvstore/KvStoreDatabase.java @@ -932,13 +932,13 @@ private boolean pruneBlobSidecars( // Just warn if we failed to find all the BlobSidecars. if (keys.size() != blobSidecars.size()) { - LOG.warn("Failed to retrieve BlobSidecars for keys:{}", keys); + LOG.warn("Failed to retrieve BlobSidecars for keys: {}", keys); } // Attempt to archive the BlobSidecars. final boolean blobSidecarArchived = archiveWriter.archive(blobSidecars); if (!blobSidecarArchived) { - LOG.warn("Failed to archive and prune BlobSidecars. Stopping pruning"); + LOG.error("Failed to archive and prune BlobSidecars. Stopping pruning"); break; } diff --git a/storage/src/main/java/tech/pegasys/teku/storage/server/pruner/BlobSidecarPruner.java b/storage/src/main/java/tech/pegasys/teku/storage/server/pruner/BlobSidecarPruner.java index 4e42583e887..c7d54252b42 100644 --- a/storage/src/main/java/tech/pegasys/teku/storage/server/pruner/BlobSidecarPruner.java +++ b/storage/src/main/java/tech/pegasys/teku/storage/server/pruner/BlobSidecarPruner.java @@ -172,7 +172,9 @@ private void pruneBlobsPriorToAvailabilityWindow() { nonCanonicalBlobsPruningStart, nonCanonicalBlobsLimitReached); } - } catch (ShuttingDownException | RejectedExecutionException | IOException ex) { + } catch (IOException ex) { + LOG.error("Failed to get the BlobSidecar archive writer", ex); + } catch (ShuttingDownException | RejectedExecutionException ex) { LOG.debug("Shutting down", ex); } }