Created
September 16, 2010 21:42
-
-
Save tilgovi/583223 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/couchdb/couch_view.erl b/src/couchdb/couch_view.erl | |
index 35bc80b..2980370 100644 | |
--- a/src/couchdb/couch_view.erl | |
+++ b/src/couchdb/couch_view.erl | |
@@ -96,13 +96,19 @@ cleanup_index_files(Db) -> | |
FileList = list_index_files(Db), | |
- % regex that matches all ddocs | |
- RegExp = "("++ string:join(Sigs, "|") ++")", | |
+ DeleteFiles = | |
+ case Sigs of | |
+ [] -> FileList; | |
+ _ -> | |
+ % 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"), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Still needs to catch the cases where you delete all the views but not the design doc.