Skip to content

fix(replay): prefetch stakes from inc snapshot #4771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions src/discof/replay/fd_replay_tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,6 @@ exec_slice( fd_replay_tile_ctx_t * ctx,
&pay_sz );

if( FD_UNLIKELY( !pay_sz || !txn_sz || txn_sz > FD_TXN_MTU ) ) {
__asm__("int $3");
FD_LOG_ERR(( "failed to parse transaction in replay" ));
}
fd_memcpy( txn_p.payload, ctx->mbatch + ctx->slice_exec_ctx.wmark, pay_sz );
Expand Down Expand Up @@ -1889,7 +1888,6 @@ handle_slice( fd_replay_tile_ctx_t * ctx,
ctx->slice_exec_ctx.last_mblk_off = 0;

if( FD_UNLIKELY( err ) ) {
__asm__("int $3");
FD_LOG_ERR(( "Failed to query blockstore for slot %lu", slot ));
}
}
Expand Down Expand Up @@ -2069,6 +2067,7 @@ read_snapshot( void * _ctx,
TODO: If prefetching the manifest is enabled it leads to
incorrect snapshot loads. This needs to be looked into. */
if( strlen( incremental )>0UL ) {
FD_LOG_NOTICE(( "PREFETCHING" ));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove?

uchar * tmp_mem = fd_spad_alloc( ctx->runtime_spad, fd_snapshot_load_ctx_align(), fd_snapshot_load_ctx_footprint() );
/* TODO: enable snapshot verification */

Expand All @@ -2088,6 +2087,7 @@ read_snapshot( void * _ctx,
kickoff_repair_orphans( ctx, stem );

}
FD_LOG_NOTICE(( "after prefetch" ));

/* In order to kick off repair effectively we need the snapshot slot and
the stake weights. These are both available in the manifest. We will
Expand Down Expand Up @@ -2519,6 +2519,20 @@ after_credit( fd_replay_tile_ctx_t * ctx,
fd_stem_context_t * stem,
int * opt_poll_in FD_PARAM_UNUSED,
int * charge_busy FD_PARAM_UNUSED ) {
FD_LOG_NOTICE(( "after credit" ));

if( FD_UNLIKELY( ctx->snapshot_init_done==0 ) ) {
init_snapshot( ctx, stem );
ctx->snapshot_init_done = 1;
//*charge_busy = 0;
if( ctx->replay_plugin_out_mem ) {
// ValidatorStartProgress::Running
uchar msg[56];
fd_memset( msg, 0, sizeof(msg) );
msg[0] = 11;
replay_plugin_publish( ctx, stem, FD_PLUGIN_MSG_START_PROGRESS, msg, sizeof(msg) );
}
}

/* TODO: Consider moving state management to during_housekeeping */
/* Check all the exec fseqs and handle any updates if needed. */
Expand Down Expand Up @@ -2792,19 +2806,6 @@ after_credit( fd_replay_tile_ctx_t * ctx,
ctx->flags = EXEC_FLAG_READY_NEW;
} // end of if( FD_UNLIKELY( ( flags & REPLAY_FLAG_FINISHED_BLOCK ) ) )

if( FD_UNLIKELY( ctx->snapshot_init_done==0 ) ) {
init_snapshot( ctx, stem );
ctx->snapshot_init_done = 1;
//*charge_busy = 0;
if( ctx->replay_plugin_out_mem ) {
// ValidatorStartProgress::Running
uchar msg[56];
fd_memset( msg, 0, sizeof(msg) );
msg[0] = 11;
replay_plugin_publish( ctx, stem, FD_PLUGIN_MSG_START_PROGRESS, msg, sizeof(msg) );
}
}

long now = fd_log_wallclock();
if( ctx->votes_plugin_out_mem && FD_UNLIKELY( ( now - ctx->last_plugin_push_time )>PLUGIN_PUBLISH_TIME_NS ) ) {
ctx->last_plugin_push_time = now;
Expand Down Expand Up @@ -3349,6 +3350,7 @@ unprivileged_init( fd_topo_t * topo,
FD_LOG_ERR(( "failed to join and create exec slice deque" ));
}

__asm__("int $3");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove?

FD_LOG_NOTICE(("Finished unprivileged init"));
}

Expand Down
1 change: 1 addition & 0 deletions src/flamenco/snapshot/fd_snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ fd_snapshot_load_all( const char * source_cstr,

void
fd_snapshot_load_prefetch_manifest( fd_snapshot_load_ctx_t * ctx ) {
FD_LOG_NOTICE(( "fd_snapshot_load_prefetch_manifest(\"%s\")", ctx->snapshot_file ));

size_t slen = strlen( ctx->snapshot_file );
char * snapshot_cstr = fd_spad_alloc( ctx->runtime_spad, 8UL, slen + 1 );
Expand Down
Loading