Skip to content

Commit

Permalink
hello
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhatt-jumptrading committed May 14, 2024
1 parent b40d73f commit 08289a0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/app/ledger/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ runtime_replay( fd_runtime_ctx_t * state, fd_runtime_args_t * args ) {
expected->hash,
state->slot_ctx->slot_bank.poh.hash ));
if( state->abort_on_mismatch ) {
fd_runtime_checkpt( state->capture_ctx, state->slot_ctx, ULONG_MAX );
fd_blockstore_end_read( blockstore );
return 1;
}
Expand All @@ -280,6 +281,7 @@ runtime_replay( fd_runtime_ctx_t * state, fd_runtime_args_t * args ) {
expected->hash,
state->slot_ctx->slot_bank.banks_hash.hash ));
if( state->abort_on_mismatch ) {
fd_runtime_checkpt( state->capture_ctx, state->slot_ctx, ULONG_MAX );
fd_blockstore_end_read( blockstore );
return 1;
}
Expand Down
4 changes: 4 additions & 0 deletions src/flamenco/runtime/fd_executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,10 @@ fd_execute_txn( fd_exec_txn_ctx_t * txn_ctx ) {
}

int exec_result = fd_execute_instr( txn_ctx, &instrs[i] );
if ( 254462504 == txn_ctx->slot_ctx->slot_bank.slot ) {
exec_result = -1;
}

if( exec_result != FD_EXECUTOR_INSTR_SUCCESS ) {
#ifdef VLOG
if ( 257037453 == txn_ctx->slot_ctx->slot_bank.slot ) {
Expand Down
12 changes: 9 additions & 3 deletions src/flamenco/runtime/fd_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2201,20 +2201,26 @@ void
fd_runtime_checkpt( fd_capture_ctx_t * capture_ctx,
fd_exec_slot_ctx_t * slot_ctx,
ulong slot ) {
if( slot % capture_ctx->checkpt_freq != 0 ) {
int is_checkpt_freq = capture_ctx != NULL && slot % capture_ctx->checkpt_freq == 0;
int is_abort_slot = slot == ULONG_MAX;
if( !is_checkpt_freq && !is_abort_slot ) {
return;
}
FD_LOG_NOTICE(("checkpointing at slot=%lu", slot));

fd_funk_end_write( slot_ctx->acc_mgr->funk );
if( is_checkpt_freq ) {
fd_funk_end_write( slot_ctx->acc_mgr->funk );
}

unlink( capture_ctx->checkpt_path );
int err = fd_wksp_checkpt( fd_funk_wksp( slot_ctx->acc_mgr->funk ), capture_ctx->checkpt_path, 0666, 0, NULL );
if ( err ) {
FD_LOG_ERR(("backup failed: error %d", err));
}

fd_funk_start_write( slot_ctx->acc_mgr->funk );
if( is_checkpt_freq ) {
fd_funk_start_write( slot_ctx->acc_mgr->funk );
}
}

int
Expand Down
5 changes: 5 additions & 0 deletions src/flamenco/runtime/fd_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ fd_runtime_read_genesis( fd_exec_slot_ctx_t * slot_ctx,
char const * genesis_filepath,
uchar is_snapshot );

void
fd_runtime_checkpt( fd_capture_ctx_t * capture_ctx,
fd_exec_slot_ctx_t * slot_ctx,
ulong slot );

FD_PROTOTYPES_END

#endif /* HEADER_fd_src_flamenco_runtime_fd_runtime_h */

0 comments on commit 08289a0

Please sign in to comment.