summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiangph <jiangph@cn.ibm.com>2019-09-09 14:31:51 +0800
committerjiangph <jiangph@cn.ibm.com>2019-09-10 07:26:26 +0800
commitb79f19757434b407060d044979af82b7123b5dc4 (patch)
tree9f9ece30dac0f4befceef926303fb8309336b672
parent8a062686fac0a29af2d6f3c7da81ff3ff1e484fb (diff)
downloadcouchdb-b79f19757434b407060d044979af82b7123b5dc4.tar.gz
fixup fabric:cleanup_index_filesfabric-cleanup-view-files
-rw-r--r--src/fabric/src/fabric.erl7
1 files changed, 6 insertions, 1 deletions
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 ->
+ %% <sig>.view and <sig>.compact.view where <sig> 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").