@@ -814,7 +814,6 @@ prioritise_call(Msg, _From, _Len, _State) ->
814814
815815prioritise_cast (Msg , _Len , _State ) ->
816816 case Msg of
817- {compacted_file , _File } -> 8 ;
818817 {client_dying , _Pid } -> 7 ;
819818 _ -> 0
820819 end .
@@ -914,16 +913,7 @@ handle_cast({remove, CRef, MsgIds}, State) ->
914913 ignore -> State2
915914 end
916915 end , State , MsgIds ),
917- noreply (State1 );
918-
919- handle_cast ({compacted_file , File },
920- State = # msstate { file_summary_ets = FileSummaryEts }) ->
921- % % This can return false if the file gets deleted immediately
922- % % after compaction ends, but before we can process this message.
923- % % So this will become a no-op and we can ignore the return value.
924- _ = ets :update_element (FileSummaryEts , File ,
925- {# file_summary .locked , false }),
926- noreply (State ).
916+ noreply (State1 ).
927917
928918handle_info (sync , State ) ->
929919 noreply (internal_sync (State ));
@@ -2048,8 +2038,6 @@ compact_file(File, FileSize,
20482038 Reclaimed = FileSize - TruncateSize ,
20492039 ? LOG_DEBUG (" Compacted segment file number ~tp ; ~tp bytes can now be reclaimed" ,
20502040 [File , Reclaimed ]),
2051- % % Tell the message store to update its state.
2052- gen_server2 :cast (Server , {compacted_file , File }),
20532041 % % Tell the GC process to truncate the file.
20542042 % %
20552043 % % We will truncate later when there are no readers. We want current
@@ -2158,6 +2146,8 @@ truncate_file(File, Size, ThresholdTimestamp, #gc_state{ file_summary_ets = File
21582146 ok = file :close (Fd ),
21592147 true = ets :update_element (FileSummaryEts , File ,
21602148 {# file_summary .file_size , Size }),
2149+ true = ets :update_element (FileSummaryEts , File ,
2150+ {# file_summary .locked , false }),
21612151 ? LOG_DEBUG (" Truncated file number ~tp ; new size ~tp bytes" , [File , Size ]),
21622152 ok
21632153 end
0 commit comments