Skip to content

Commit 84892b7

Browse files
authored
chore: Change Block Buffer persistence logic (#22283)
Signed-off-by: Derek Riley <[email protected]>
1 parent a4252d6 commit 84892b7

File tree

3 files changed

+2
-36
lines changed

3 files changed

+2
-36
lines changed

hedera-node/hedera-app/src/main/java/com/hedera/node/app/blocks/impl/streaming/BlockBufferService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ private void loadBufferFromDisk() {
517517
* @see BlockBufferIO
518518
*/
519519
public void persistBuffer() {
520-
if (!isBackpressureEnabled() || !isStarted.get() || !isBufferPersistenceEnabled()) {
520+
if (!isGrpcStreamingEnabled() || !isStarted.get() || !isBufferPersistenceEnabled()) {
521521
return;
522522
}
523523

hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/streaming/BlockBufferServiceTest.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,40 +1610,6 @@ void testPersistBuffer_notEnabled() throws Throwable {
16101610
}
16111611
}
16121612

1613-
@Test
1614-
void testPersistBuffer_recordsMode() throws Throwable {
1615-
final Configuration config = HederaTestConfigBuilder.create()
1616-
.withConfigDataType(BlockStreamConfig.class)
1617-
.withConfigDataType(BlockBufferConfig.class)
1618-
.withValue("blockStream.writerMode", "GRPC")
1619-
.withValue("blockStream.streamMode", "RECORDS")
1620-
.withValue("blockStream.blockPeriod", Duration.ofSeconds(1))
1621-
.withValue("blockStream.buffer.isBufferPersistenceEnabled", true)
1622-
.withValue("blockStream.buffer.bufferDirectory", testDir)
1623-
.getOrCreateConfig();
1624-
when(configProvider.getConfiguration()).thenReturn(new VersionedConfigImpl(config, 1));
1625-
1626-
Files.createDirectories(testDirFile.toPath());
1627-
1628-
blockBufferService = initBufferService(configProvider);
1629-
1630-
// create a block
1631-
final long BLOCK_1 = 1L;
1632-
blockBufferService.openBlock(BLOCK_1);
1633-
final List<BlockItem> block1Items = generateBlockItems(60, BLOCK_1, Set.of(10L, 11L));
1634-
block1Items.forEach(item -> blockBufferService.addItem(BLOCK_1, item));
1635-
blockBufferService.closeBlock(BLOCK_1);
1636-
1637-
blockBufferService.persistBuffer();
1638-
1639-
persistBufferHandle.invoke(blockBufferService);
1640-
1641-
// verify nothing on disk - should not persist when streamMode != BLOCKS
1642-
try (final Stream<Path> stream = Files.list(testDirFile.toPath())) {
1643-
assertThat(stream.count()).isZero();
1644-
}
1645-
}
1646-
16471613
@Test
16481614
void testPersistBuffer_notStarted() throws Throwable {
16491615
final Configuration config = HederaTestConfigBuilder.create()

hedera-node/hedera-config/src/main/java/com/hedera/node/config/data/BlockBufferConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ public record BlockBufferConfig(
3737
@ConfigProperty(defaultValue = "50.0") @Min(0) @NetworkProperty double actionStageThreshold,
3838
@ConfigProperty(defaultValue = "20s") @Min(0) @NetworkProperty Duration actionGracePeriod,
3939
@ConfigProperty(defaultValue = "85.0") @Min(0) @NetworkProperty double recoveryThreshold,
40-
@ConfigProperty(defaultValue = "true") @NodeProperty boolean isBufferPersistenceEnabled,
40+
@ConfigProperty(defaultValue = "false") @NodeProperty boolean isBufferPersistenceEnabled,
4141
@ConfigProperty(defaultValue = "/opt/hgcapp/blockStreams/buffer") @NodeProperty String bufferDirectory) {}

0 commit comments

Comments
 (0)