@@ -199,7 +199,7 @@ struct fd_replay_tile_ctx {
199
199
200
200
fd_alloc_t * alloc ;
201
201
fd_valloc_t valloc ;
202
- fd_funk_t * funk ;
202
+ fd_funk_t funk [ 1 ] ;
203
203
fd_exec_epoch_ctx_t * epoch_ctx ;
204
204
fd_epoch_t * epoch ;
205
205
fd_forks_t * forks ;
@@ -826,9 +826,9 @@ checkpt( fd_replay_tile_ctx_t * ctx ) {
826
826
static void FD_FN_UNUSED
827
827
funk_cancel ( fd_replay_tile_ctx_t * ctx , ulong mismatch_slot ) {
828
828
fd_funk_txn_start_write ( ctx -> funk );
829
- fd_funk_txn_xid_t xid = { .ul = { mismatch_slot , mismatch_slot } };
830
- fd_funk_txn_map_t txn_map = fd_funk_txn_map ( ctx -> funk , fd_funk_wksp ( ctx -> funk ) );
831
- fd_funk_txn_t * mismatch_txn = fd_funk_txn_query ( & xid , & txn_map );
829
+ fd_funk_txn_xid_t xid = { .ul = { mismatch_slot , mismatch_slot } };
830
+ fd_funk_txn_map_t * txn_map = fd_funk_txn_map ( ctx -> funk );
831
+ fd_funk_txn_t * mismatch_txn = fd_funk_txn_query ( & xid , txn_map );
832
832
FD_TEST ( fd_funk_txn_cancel ( ctx -> funk , mismatch_txn , 1 ) );
833
833
fd_funk_txn_end_write ( ctx -> funk );
834
834
}
@@ -860,7 +860,7 @@ txncache_publish( fd_replay_tile_ctx_t * ctx,
860
860
fd_funk_txn_start_read ( ctx -> funk );
861
861
862
862
fd_funk_txn_t * txn = to_root_txn ;
863
- fd_funk_txn_pool_t txn_pool = fd_funk_txn_pool ( ctx -> funk , fd_funk_wksp ( ctx -> funk ) );
863
+ fd_funk_txn_pool_t * txn_pool = fd_funk_txn_pool ( ctx -> funk );
864
864
while ( txn != rooted_txn ) {
865
865
ulong slot = txn -> xid .ul [0 ];
866
866
if ( FD_LIKELY ( !fd_txncache_get_is_constipated ( ctx -> slot_ctx -> status_cache ) ) ) {
@@ -870,7 +870,7 @@ txncache_publish( fd_replay_tile_ctx_t * ctx,
870
870
FD_LOG_INFO (( "Registering constipated slot %lu" , slot ));
871
871
fd_txncache_register_constipated_slot ( ctx -> slot_ctx -> status_cache , slot );
872
872
}
873
- txn = fd_funk_txn_parent ( txn , & txn_pool );
873
+ txn = fd_funk_txn_parent ( txn , txn_pool );
874
874
}
875
875
876
876
fd_funk_txn_end_read ( ctx -> funk );
@@ -962,7 +962,7 @@ funk_publish( fd_replay_tile_ctx_t * ctx,
962
962
fd_funk_txn_start_write ( ctx -> funk );
963
963
964
964
fd_epoch_bank_t * epoch_bank = fd_exec_epoch_ctx_epoch_bank ( ctx -> slot_ctx -> epoch_ctx );
965
- fd_funk_txn_pool_t txn_pool = fd_funk_txn_pool ( ctx -> funk , fd_funk_wksp ( ctx -> funk ) );
965
+ fd_funk_txn_pool_t * txn_pool = fd_funk_txn_pool ( ctx -> funk );
966
966
967
967
/* Try to publish into Funk */
968
968
if ( is_constipated ) {
@@ -982,7 +982,7 @@ funk_publish( fd_replay_tile_ctx_t * ctx,
982
982
if ( FD_UNLIKELY ( fd_funk_txn_publish_into_parent ( ctx -> funk , txn , 0 ) ) ) {
983
983
FD_LOG_ERR (( "Can't publish funk transaction" ));
984
984
}
985
- txn = fd_funk_txn_parent ( txn , & txn_pool );
985
+ txn = fd_funk_txn_parent ( txn , txn_pool );
986
986
}
987
987
988
988
} else {
@@ -1003,7 +1003,7 @@ funk_publish( fd_replay_tile_ctx_t * ctx,
1003
1003
we will calculate the epoch account hash for. */
1004
1004
1005
1005
fd_funk_txn_t * txn = to_root_txn ;
1006
- fd_funk_txn_t * parent_txn = fd_funk_txn_parent ( txn , & txn_pool );
1006
+ fd_funk_txn_t * parent_txn = fd_funk_txn_parent ( txn , txn_pool );
1007
1007
while ( parent_txn ) {
1008
1008
/* We need to be careful here because the eah start slot may be skipped
1009
1009
so the actual slot that we calculate the eah for may be greater than
@@ -1018,7 +1018,7 @@ funk_publish( fd_replay_tile_ctx_t * ctx,
1018
1018
break ;
1019
1019
}
1020
1020
txn = parent_txn ;
1021
- parent_txn = fd_funk_txn_parent ( txn , & txn_pool );
1021
+ parent_txn = fd_funk_txn_parent ( txn , txn_pool );
1022
1022
}
1023
1023
1024
1024
/* At this point, we know txn is the funk txn that we will want to
@@ -1069,17 +1069,17 @@ get_rooted_txn( fd_replay_tile_ctx_t * ctx,
1069
1069
we must also register it into the status cache because we don't register
1070
1070
the root in txncache_publish to avoid registering the same slot multiple times. */
1071
1071
1072
- fd_funk_txn_pool_t txn_pool = fd_funk_txn_pool ( ctx -> funk , fd_funk_wksp ( ctx -> funk ) );
1072
+ fd_funk_txn_pool_t * txn_pool = fd_funk_txn_pool ( ctx -> funk );
1073
1073
1074
1074
if ( is_constipated ) {
1075
1075
1076
1076
if ( FD_UNLIKELY ( !ctx -> false_root ) ) {
1077
1077
1078
1078
fd_funk_txn_t * txn = to_root_txn ;
1079
- fd_funk_txn_t * parent_txn = fd_funk_txn_parent ( txn , & txn_pool );
1079
+ fd_funk_txn_t * parent_txn = fd_funk_txn_parent ( txn , txn_pool );
1080
1080
while ( parent_txn ) {
1081
1081
txn = parent_txn ;
1082
- parent_txn = fd_funk_txn_parent ( txn , & txn_pool );
1082
+ parent_txn = fd_funk_txn_parent ( txn , txn_pool );
1083
1083
}
1084
1084
1085
1085
ctx -> false_root = txn ;
@@ -1143,8 +1143,8 @@ funk_and_txncache_publish( fd_replay_tile_ctx_t * ctx, ulong wmk, fd_funk_txn_xi
1143
1143
/* Handle updates to funk and the status cache. */
1144
1144
1145
1145
fd_funk_txn_start_read ( ctx -> funk );
1146
- fd_funk_txn_map_t txn_map = fd_funk_txn_map ( ctx -> funk , fd_funk_wksp ( ctx -> funk ) );
1147
- fd_funk_txn_t * to_root_txn = fd_funk_txn_query ( xid , & txn_map );
1146
+ fd_funk_txn_map_t * txn_map = fd_funk_txn_map ( ctx -> funk );
1147
+ fd_funk_txn_t * to_root_txn = fd_funk_txn_query ( xid , txn_map );
1148
1148
if ( FD_UNLIKELY ( !to_root_txn ) ) {
1149
1149
FD_LOG_ERR (( "Unable to find funk transaction for xid %lu" , xid -> ul [0 ] ));
1150
1150
}
@@ -2918,26 +2918,27 @@ privileged_init( fd_topo_t * topo,
2918
2918
if ( strcmp ( snapshot , "funk" ) == 0 ) {
2919
2919
/* Funk database already exists. The parameters are actually mostly ignored. */
2920
2920
funk = fd_funk_open_file (
2921
- tile -> replay .funk_file , 1 , ctx -> funk_seed , tile -> replay .funk_txn_max ,
2921
+ ctx -> funk ,
2922
+ tile -> replay .funk_file , 1 , ctx -> funk_seed , tile -> replay .funk_txn_max ,
2922
2923
tile -> replay .funk_rec_max , tile -> replay .funk_sz_gb * (1UL <<30 ),
2923
2924
FD_FUNK_READ_WRITE , NULL );
2924
2925
} else if ( strncmp ( snapshot , "wksp:" , 5 ) == 0 ) {
2925
2926
/* Recover funk database from a checkpoint. */
2926
- funk = fd_funk_recover_checkpoint ( tile -> replay .funk_file , 1 , snapshot + 5 , NULL );
2927
+ funk = fd_funk_recover_checkpoint ( ctx -> funk , tile -> replay .funk_file , 1 , snapshot + 5 , NULL );
2927
2928
} else {
2928
2929
FD_LOG_NOTICE (( "Trying to create new funk at file=%s" , tile -> replay .funk_file ));
2929
2930
/* Create new funk database */
2930
2931
funk = fd_funk_open_file (
2931
- tile -> replay .funk_file , 1 , ctx -> funk_seed , tile -> replay .funk_txn_max ,
2932
+ ctx -> funk ,
2933
+ tile -> replay .funk_file , 1 , ctx -> funk_seed , tile -> replay .funk_txn_max ,
2932
2934
tile -> replay .funk_rec_max , tile -> replay .funk_sz_gb * (1UL <<30 ),
2933
2935
FD_FUNK_OVERWRITE , NULL );
2934
2936
FD_LOG_NOTICE (( "Opened funk file at %s" , tile -> replay .funk_file ));
2935
2937
}
2936
- if ( FD_UNLIKELY ( funk == NULL ) ) {
2937
- FD_LOG_ERR (( "no funk loaded " ));
2938
+ if ( FD_UNLIKELY ( ! funk ) ) {
2939
+ FD_LOG_ERR (( "Failed to join funk database " ));
2938
2940
}
2939
2941
fd_funk_txn_end_write ( NULL );
2940
- ctx -> funk = funk ;
2941
2942
ctx -> funk_wksp = fd_funk_wksp ( funk );
2942
2943
if ( FD_UNLIKELY ( ctx -> funk_wksp == NULL ) ) {
2943
2944
FD_LOG_ERR (( "no funk wksp" ));
0 commit comments