From b79f19757434b407060d044979af82b7123b5dc4 Mon Sep 17 00:00:00 2001 From: jiangph Date: Mon, 9 Sep 2019 14:31:51 +0800 Subject: fixup fabric:cleanup_index_files --- src/fabric/src/fabric.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fabric/src/fabric.erl b/src/fabric/src/fabric.erl index d98ffc978..27fa8c045 100644 --- a/src/fabric/src/fabric.erl +++ b/src/fabric/src/fabric.erl @@ -524,8 +524,11 @@ inactive_index_files(DbName) -> end, mem3:local_shards(dbname(DbName))), if ActiveSigs =:= [] -> FileList; true -> + %% .view and .compact.view where is in ActiveSigs + %% will be excluded from FileList because they are active view + %% files and should not be deleted. lists:filter(fun(FilePath) -> - not maps:is_key(filename:basename(FilePath, ".view"), ActiveSigs) + not maps:is_key(get_view_sig_from_filename(FilePath), ActiveSigs) end, FileList) end. @@ -662,6 +665,8 @@ kl_to_record(KeyList,RecName) -> set_namespace(NS, #mrargs{extra = Extra} = Args) -> Args#mrargs{extra = [{namespace, NS} | Extra]}. +get_view_sig_from_filename(FilePath) -> + filename:basename(filename:basename(FilePath, ".view"), ".compact"). -ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). -- cgit v1.2.1