$ make shell
1> ra:start([{wal_data_dir, "wal"}]).
{ok,[sasl,crypto,aten,gen_batch_server,seshat,ra]}
2> halt().
$ make shell
1> ra:start([{wal_data_dir, "wal"}]).
=ERROR REPORT==== 4-Nov-2025::08:39:55.288171 ===
** Generic server ra_log_segment_writer terminating
** Last message in was {'$gen_cast',{mem_tables,#{},"0000000000000001.wal"}}
** When Server state == {state,"/home/mbj/src/ra/nonode@nohost",default,
{write_concurrency,
#Ref<0.2884975887.1890189317.172623>},
#{max_size => 64000000,compute_checksums => true,
max_count => 4096,max_pending => 1024}}
** Reason for termination ==
** {{badmatch,{error,enoent}},
[{ra_log_segment_writer,handle_cast,2,
[{file,"src/ra_log_segment_writer.erl"},
{line,180}]},
{gen_server,try_handle_cast,3,[{file,"gen_server.erl"},{line,2371}]},
{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,2433}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,329}]}]}
...
I don't expect the code to crash.
Describe the bug
When
wal_data_diris used and is different thandata_dir, thera_log_segment_writercrashes witha
badmatchon node restart. It seemsra_log_segment_writerassumes that the wal file will be in thedata_dir.Reproduction steps
Tested on 2.17.1
Expected behavior
I don't expect the code to crash.
Additional context
(the bug seems to be old, but the code didn't check the return value from
prim_file:delete()before 24c7c00)