Skip to content

Commit

Permalink
blockstore: more conservative block publish
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhatt-jumptrading authored and lidatong committed Jan 9, 2025
1 parent 993606b commit cd81bbe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/app/fdctl/run/tiles/fd_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,9 @@ struct fd_status_check_ctx {
typedef struct fd_status_check_ctx fd_status_check_ctx_t;

static void
blockstore_publish( fd_replay_tile_ctx_t * ctx ) {
blockstore_publish( fd_replay_tile_ctx_t * ctx, ulong wmk ) {
fd_blockstore_start_write( ctx->blockstore );
fd_blockstore_publish( ctx->blockstore, ctx->blockstore_fd );
fd_blockstore_publish( ctx->blockstore, ctx->blockstore_fd, wmk );
fd_blockstore_end_write( ctx->blockstore );
}

Expand Down Expand Up @@ -1887,7 +1887,7 @@ during_housekeeping( void * _ctx ) {
fd_blockstore_end_read( ctx->blockstore );
xid.ul[0] = wmk;

if( FD_LIKELY( ctx->blockstore ) ) blockstore_publish( ctx );
if( FD_LIKELY( ctx->blockstore ) ) blockstore_publish( ctx, wmk );
if( FD_LIKELY( ctx->forks ) ) fd_forks_publish( ctx->forks, wmk, ctx->ghost );
if( FD_LIKELY( ctx->funk ) ) funk_and_txncache_publish( ctx, wmk, &xid );
if( FD_LIKELY( ctx->ghost ) ) {
Expand Down
14 changes: 7 additions & 7 deletions src/flamenco/runtime/fd_blockstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,13 +893,13 @@ fd_blockstore_block_data_restore( fd_blockstore_archiver_t * archvr,
}

void
fd_blockstore_publish( fd_blockstore_t * blockstore, int fd ) {
FD_LOG_NOTICE(( "[%s] wmk %lu => smr %lu", __func__, blockstore->wmk, blockstore->smr ));
fd_blockstore_publish( fd_blockstore_t * blockstore, int fd, ulong wmk ) {
FD_LOG_NOTICE(( "[%s] wmk %lu => smr %lu", __func__, blockstore->wmk, wmk ));

/* Caller is incorrectly calling publish. */

if( FD_UNLIKELY( blockstore->wmk == blockstore->smr ) ) {
FD_LOG_WARNING(( "[%s] attempting to re-publish when wmk %lu already at smr %lu", __func__, blockstore->wmk, blockstore->smr ));
if( FD_UNLIKELY( blockstore->wmk == wmk ) ) {
FD_LOG_WARNING(( "[%s] attempting to re-publish when wmk %lu already at smr %lu", __func__, blockstore->wmk, wmk ));
return;
}

Expand Down Expand Up @@ -928,7 +928,7 @@ fd_blockstore_publish( fd_blockstore_t * blockstore, int fd ) {

/* Stop upon reaching the SMR. */

if( FD_LIKELY( block_map_entry->child_slots[i] != blockstore->smr ) ) {
if( FD_LIKELY( block_map_entry->child_slots[i] != wmk ) ) {
fd_slot_deque_push_tail( q, block_map_entry->child_slots[i] );
}
}
Expand Down Expand Up @@ -958,11 +958,11 @@ fd_blockstore_publish( fd_blockstore_t * blockstore, int fd ) {

/* Scan to clean up any orphaned blocks or shreds < new SMR. */

for (ulong slot = blockstore->wmk; slot < blockstore->smr; slot++) {
for (ulong slot = blockstore->wmk; slot < wmk; slot++) {
fd_blockstore_slot_remove( blockstore, slot );
}

blockstore->wmk = blockstore->smr;
blockstore->wmk = wmk;

return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/flamenco/runtime/fd_blockstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ fd_blockstore_block_height_update( fd_blockstore_t * blockstore, ulong slot, ulo
function. */

void
fd_blockstore_publish( fd_blockstore_t * blockstore, int fd );
fd_blockstore_publish( fd_blockstore_t * blockstore, int fd, ulong wmk );

/* fd_blockstore_start_read acquires the read lock */
static inline void
Expand Down

0 comments on commit cd81bbe

Please sign in to comment.