Skip to content

Commit 078147f

Browse files
riptlripatel-fd
authored andcommitted
Integrate vinyl tile into fdctl
Also adds a proper command-line to firedancer-dev snapshot-load
1 parent f109545 commit 078147f

File tree

16 files changed

+606
-75
lines changed

16 files changed

+606
-75
lines changed

src/app/firedancer-dev/commands/backtest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ backtest_topo( config_t * config ) {
9090
fd_topob_tile_uses( topo, replay_tile, progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE );
9191

9292
if( snap_vinyl ) {
93-
setup_topo_vinyl( topo, &config->firedancer );
93+
setup_topo_vinyl_meta( topo, &config->firedancer );
9494
}
9595

9696
/**********************************************************************/

src/app/firedancer-dev/commands/snapshot_load.c

Lines changed: 226 additions & 55 deletions
Large diffs are not rendered by default.

src/app/firedancer-dev/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern fd_topo_obj_callbacks_t fd_obj_cb_mcache;
1212
extern fd_topo_obj_callbacks_t fd_obj_cb_dcache;
1313
extern fd_topo_obj_callbacks_t fd_obj_cb_fseq;
1414
extern fd_topo_obj_callbacks_t fd_obj_cb_metrics;
15+
extern fd_topo_obj_callbacks_t fd_obj_cb_cnc;
1516
extern fd_topo_obj_callbacks_t fd_obj_cb_opaque;
1617
extern fd_topo_obj_callbacks_t fd_obj_cb_dbl_buf;
1718
extern fd_topo_obj_callbacks_t fd_obj_cb_neigh4_hmap;
@@ -27,12 +28,14 @@ extern fd_topo_obj_callbacks_t fd_obj_cb_bank_hash_cmp;
2728

2829
extern fd_topo_obj_callbacks_t fd_obj_cb_vinyl_meta;
2930
extern fd_topo_obj_callbacks_t fd_obj_cb_vinyl_meta_ele;
31+
extern fd_topo_obj_callbacks_t fd_obj_cb_vinyl_data;
3032

3133
fd_topo_obj_callbacks_t * CALLBACKS[] = {
3234
&fd_obj_cb_mcache,
3335
&fd_obj_cb_dcache,
3436
&fd_obj_cb_fseq,
3537
&fd_obj_cb_metrics,
38+
&fd_obj_cb_cnc,
3639
&fd_obj_cb_opaque,
3740
&fd_obj_cb_dbl_buf,
3841
&fd_obj_cb_neigh4_hmap,
@@ -47,6 +50,7 @@ fd_topo_obj_callbacks_t * CALLBACKS[] = {
4750
&fd_obj_cb_bank_hash_cmp,
4851
&fd_obj_cb_vinyl_meta,
4952
&fd_obj_cb_vinyl_meta_ele,
53+
&fd_obj_cb_vinyl_data,
5054
NULL,
5155
};
5256

@@ -106,6 +110,7 @@ extern fd_topo_run_tile_t fd_tile_archiver_feeder;
106110
extern fd_topo_run_tile_t fd_tile_archiver_writer;
107111
extern fd_topo_run_tile_t fd_tile_archiver_playback;
108112
extern fd_topo_run_tile_t fd_tile_shredcap;
113+
extern fd_topo_run_tile_t fd_tile_vinyl;
109114

110115
extern fd_topo_run_tile_t fd_tile_snapct;
111116
extern fd_topo_run_tile_t fd_tile_snapld;
@@ -161,6 +166,7 @@ fd_topo_run_tile_t * TILES[] = {
161166
&fd_tile_snapwr,
162167
&fd_tile_genesi,
163168
&fd_tile_ipecho,
169+
&fd_tile_vinyl,
164170
NULL,
165171
};
166172

src/app/firedancer/callbacks.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ funk_footprint( fd_topo_t const * topo,
8383
static ulong
8484
funk_loose( fd_topo_t const * topo,
8585
fd_topo_obj_t const * obj ) {
86-
(void)topo;
8786
return VAL("heap_max");
8887
}
8988

src/app/firedancer/callbacks_vinyl.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,32 @@ fd_topo_obj_callbacks_t fd_obj_cb_vinyl_meta_ele = {
8282
.align = vinyl_meta_ele_align,
8383
.new = vinyl_meta_ele_new,
8484
};
85+
86+
/* vinyl_data: memory arena for data cache entries */
87+
88+
static ulong
89+
vinyl_data_align( fd_topo_t const * topo,
90+
fd_topo_obj_t const * obj ) {
91+
(void)topo; (void)obj;
92+
return alignof(fd_vinyl_data_obj_t);
93+
}
94+
95+
static ulong
96+
vinyl_data_footprint( fd_topo_t const * topo,
97+
fd_topo_obj_t const * obj ) {
98+
return fd_ulong_align_dn( VAL("data_sz"), alignof(fd_vinyl_data_obj_t) );
99+
}
100+
101+
static void
102+
vinyl_data_new( fd_topo_t const * topo,
103+
fd_topo_obj_t const * obj ) {
104+
(void)topo; (void)obj;
105+
/* initialized by user */
106+
}
107+
108+
fd_topo_obj_callbacks_t fd_obj_cb_vinyl_data = {
109+
.name = "vinyl_data",
110+
.footprint = vinyl_data_footprint,
111+
.align = vinyl_data_align,
112+
.new = vinyl_data_new,
113+
};

src/app/firedancer/config/default.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ user = ""
502502
enabled = false
503503
max_account_records = 30_000_000
504504
file_size_gib = 16
505+
max_cache_entries = 1_000_000
506+
cache_size_gib = 2
505507

506508
[runtime]
507509
# TODO: This is not respected, the max vote accounts seems to be

src/app/firedancer/topology.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,11 @@ setup_topo_txncache( fd_topo_t * topo,
158158
}
159159

160160
void
161-
setup_topo_vinyl( fd_topo_t * topo,
162-
fd_configf_t * config ) {
163-
(void)config;
164-
fd_topob_wksp( topo, "vinyl" );
161+
setup_topo_vinyl_meta( fd_topo_t * topo,
162+
fd_configf_t * config ) {
163+
fd_topob_wksp( topo, "vinyl_meta" );
165164

166-
fd_topo_obj_t * map_obj = fd_topob_obj( topo, "vinyl_meta", "vinyl" );
165+
fd_topo_obj_t * map_obj = fd_topob_obj( topo, "vinyl_meta", "vinyl_meta" );
167166
ulong const meta_max = fd_ulong_pow2_up( config->vinyl.max_account_records );
168167
ulong const lock_cnt = fd_vinyl_meta_lock_cnt_est ( meta_max );
169168
ulong const probe_max = fd_vinyl_meta_probe_max_est( meta_max );
@@ -172,13 +171,24 @@ setup_topo_vinyl( fd_topo_t * topo,
172171
fd_pod_insertf_ulong( topo->props, probe_max, "obj.%lu.probe_max", map_obj->id );
173172
fd_pod_insertf_ulong( topo->props, (ulong)fd_tickcount(), "obj.%lu.seed", map_obj->id );
174173

175-
fd_topo_obj_t * meta_pool_obj = fd_topob_obj( topo, "vinyl_meta_e", "vinyl" );
174+
fd_topo_obj_t * meta_pool_obj = fd_topob_obj( topo, "vinyl_meta_e", "vinyl_meta" );
176175
fd_pod_insertf_ulong( topo->props, meta_max, "obj.%lu.cnt", meta_pool_obj->id );
177176

178177
fd_pod_insert_ulong( topo->props, "vinyl.meta_map", map_obj->id );
179178
fd_pod_insert_ulong( topo->props, "vinyl.meta_pool", meta_pool_obj->id );
180179
}
181180

181+
fd_topo_obj_t *
182+
setup_topo_vinyl_cache( fd_topo_t * topo,
183+
fd_configf_t * config ) {
184+
fd_topob_wksp( topo, "vinyl_data" );
185+
fd_topo_obj_t * line_obj = fd_topob_obj( topo, "vinyl_data", "vinyl_data" );
186+
ulong const heap_max = config->vinyl.cache_size_gib<<30;
187+
fd_pod_insertf_ulong( topo->props, heap_max, "obj.%lu.data_sz", line_obj->id );
188+
fd_pod_insert_ulong( topo->props, "vinyl.data", line_obj->id );
189+
return line_obj;
190+
}
191+
182192
static int
183193
resolve_address( char const * address,
184194
uint * ip_addr ) {
@@ -363,17 +373,13 @@ fd_topo_initialize( config_t * config ) {
363373
fd_topob_wksp( topo, "snapld" );
364374
fd_topob_wksp( topo, "snapdc" );
365375
fd_topob_wksp( topo, "snapin" );
366-
if( vinyl_enabled ) {
367-
fd_topob_wksp( topo, "snapwr" );
368-
}
376+
if( vinyl_enabled ) fd_topob_wksp( topo, "snapwr" );
369377

370378
fd_topob_wksp( topo, "snapct_ld" );
371379
fd_topob_wksp( topo, "snapld_dc" );
372380
fd_topob_wksp( topo, "snapdc_in" );
373381
fd_topob_wksp( topo, "snapin_ct" );
374-
if( vinyl_enabled ) {
375-
fd_topob_wksp( topo, "snapin_wr" );
376-
}
382+
if( vinyl_enabled ) fd_topob_wksp( topo, "snapin_wr" );
377383

378384
if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapct_gui" );
379385
if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapin_gui" );

src/app/firedancer/topology.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ setup_topo_txncache( fd_topo_t * topo,
4848
char const * wksp_name,
4949
ulong max_live_slots,
5050
ulong max_txn_per_slot );
51+
5152
void
52-
setup_topo_vinyl( fd_topo_t * topo,
53-
fd_configf_t * config );
53+
setup_topo_vinyl_meta( fd_topo_t * topo,
54+
fd_configf_t * config );
55+
56+
fd_topo_obj_t *
57+
setup_topo_vinyl_cache( fd_topo_t * topo,
58+
fd_configf_t * config );
5459

5560
void
5661
fd_topo_configure_tile( fd_topo_tile_t * tile,

src/app/shared/fd_action.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,22 @@ union fdctl_args {
117117
} metrics;
118118

119119
struct {
120-
uint fsck;
121-
uint accounts_hist;
122-
char snapshot_path[ PATH_MAX ];
120+
uint fsck : 1;
121+
uint accounts_hist : 1;
122+
uint offline : 1;
123+
uint no_incremental : 1;
124+
uint no_watch : 1;
125+
uint is_vinyl : 1;
126+
uint vinyl_server : 1;
127+
128+
char snapshot_dir[ PATH_MAX ];
129+
char vinyl_path [ PATH_MAX ];
130+
char vinyl_io [ 3 ];
131+
132+
ulong db_sz;
133+
ulong db_rec_max;
134+
ulong cache_sz;
135+
ulong cache_rec_max;
123136
} snapshot_load;
124137

125138
};

src/app/shared/fd_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ struct fd_configf {
107107
int enabled;
108108
ulong max_account_records;
109109
ulong file_size_gib;
110+
ulong max_cache_entries;
111+
ulong cache_size_gib;
110112
} vinyl;
111113

112114
struct {

0 commit comments

Comments
 (0)