Update leveled_penciller.erl

Sometimes when testing (especially with coverage), the sst file is not alive when it is to be closed.  Check it is alive before closing.
This commit is contained in:
Martin Sumner 2019-03-13 21:19:32 +00:00
parent 01f0dadbb3
commit ffcd577f83

View file

@ -1210,7 +1210,7 @@ shutdown_manifest(Manifest, L0Constructor) ->
end end
end, end,
ok = ok =
case is_pid(Owner) of case check_alive(Owner) of
true -> true ->
leveled_sst:sst_close(Owner); leveled_sst:sst_close(Owner);
false -> false ->
@ -1221,6 +1221,15 @@ shutdown_manifest(Manifest, L0Constructor) ->
EntryCloseFun(L0Constructor). EntryCloseFun(L0Constructor).
-spec check_alive(pid()|undefined) -> boolean().
%% @doc
%% Double-check a processis active before attempting to terminate
check_alive(Owner) when is_pid(Owner) ->
is_process_alive(Owner);
check_alive(_Owner) ->
false.
-spec archive_files(list(), list()) -> ok. -spec archive_files(list(), list()) -> ok.
%% @doc %% @doc
%% Archive any sst files in the folder that have not been used to build the %% Archive any sst files in the folder that have not been used to build the