summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorRandall Leeds <randall@apache.org>2011-06-08 18:57:43 +0000
committerRandall Leeds <randall@apache.org>2011-06-08 18:57:43 +0000
commit218f61ca2844ef4326157c6db958574c29c1ea40 (patch)
treeeac4897afdb2f3f564ca1a54d815ab9f9c184475 /src/couchdb
parentea57780780730eb5f2d98f30697e6a8c2b3cf7f7 (diff)
backport r1133312 from trunk
_view_cleanup with no _design docs - COUCHDB-1136 git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1133510 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_view.erl17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/couchdb/couch_view.erl b/src/couchdb/couch_view.erl
index 911f1aa6..c9a9b2cc 100644
--- a/src/couchdb/couch_view.erl
+++ b/src/couchdb/couch_view.erl
@@ -92,13 +92,18 @@ cleanup_index_files(Db) ->
FileList = list_index_files(Db),
- % regex that matches all ddocs
- RegExp = "("++ string:join(Sigs, "|") ++")",
+ DeleteFiles =
+ if length(Sigs) =:= 0 ->
+ FileList;
+ true ->
+ % regex that matches all ddocs
+ RegExp = "("++ string:join(Sigs, "|") ++")",
+
+ % filter out the ones in use
+ [FilePath || FilePath <- FileList,
+ re:run(FilePath, RegExp, [{capture, none}]) =:= nomatch]
+ end,
- % filter out the ones in use
- DeleteFiles = [FilePath
- || FilePath <- FileList,
- re:run(FilePath, RegExp, [{capture, none}]) =:= nomatch],
% delete unused files
?LOG_DEBUG("deleting unused view index files: ~p",[DeleteFiles]),
RootDir = couch_config:get("couchdb", "view_index_dir"),