Skip to content

Commit 444a61c

Browse files
fix: remove BlockRemover from BlockReader
Signed-off-by: Matt Peterson <matt.peterson@swirldslabs.com>
1 parent d3b4978 commit 444a61c

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

server/src/main/java/com/hedera/block/server/persistence/storage/BlockAsDirReader.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ public class BlockAsDirReader implements BlockReader<Block> {
3939

4040
private final Path blockNodeRootPath;
4141
private final FileAttribute<Set<PosixFilePermission>> filePerms;
42-
private final BlockRemover blockRemover;
4342

4443
public BlockAsDirReader(
4544
final String key,
4645
final Config config,
47-
final BlockRemover blockRemover,
4846
final FileAttribute<Set<PosixFilePermission>> filePerms) {
4947

5048
LOGGER.log(System.Logger.Level.INFO, "Initializing FileSystemBlockReader");
@@ -55,16 +53,11 @@ public BlockAsDirReader(
5553
LOGGER.log(System.Logger.Level.INFO, "Block Node Root Path: " + blockNodeRootPath);
5654

5755
this.blockNodeRootPath = blockNodeRootPath;
58-
this.blockRemover = blockRemover;
5956
this.filePerms = filePerms;
6057
}
6158

6259
public BlockAsDirReader(final String key, final Config config) {
63-
this(
64-
key,
65-
config,
66-
new BlockAsDirRemover(Path.of(config.get(key).asString().get()), Util.defaultPerms),
67-
Util.defaultPerms);
60+
this(key, config, Util.defaultPerms);
6861
}
6962

7063
@Override
@@ -109,8 +102,6 @@ public Optional<Block> read(final long blockNumber) throws IOException {
109102
return Optional.of(builder.build());
110103
} catch (IOException io) {
111104
LOGGER.log(System.Logger.Level.ERROR, "Error reading block: " + blockPath, io);
112-
LOGGER.log(System.Logger.Level.ERROR, "Attempting to remove the block: " + blockPath);
113-
blockRemover.remove(blockNumber);
114105

115106
throw io;
116107
}

server/src/test/java/com/hedera/block/server/persistence/storage/BlockAsDirReaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void testRemoveBlockReadPermsRepairFailed() throws IOException {
113113
new BlockAsDirRemover(
114114
Path.of(testConfig.get(JUNIT).asString().get()), Util.defaultPerms);
115115
final BlockReader<Block> blockReader =
116-
new BlockAsDirReader(JUNIT, testConfig, blockRemover, TestUtils.getNoPerms());
116+
new BlockAsDirReader(JUNIT, testConfig, TestUtils.getNoPerms());
117117
final Optional<Block> blockOpt = blockReader.read(1);
118118
assertTrue(blockOpt.isEmpty());
119119
}

0 commit comments

Comments
 (0)