davisp commented on a change in pull request #597: Move view index files to 
.view_deleted when db is deleted
URL: https://github.com/apache/couchdb/pull/597#discussion_r127759989
 
 

 ##########
 File path: src/couch/src/couch_file.erl
 ##########
 @@ -750,11 +771,28 @@ make_filename_fixtures(DbNames) ->
         "shards/00000000-1fffffff/~s.1458336317.couch",
         ".shards/00000000-1fffffff/~s.1458336317_design",
         ".shards/00000000-1fffffff/~s.1458336317_design"
-            "/mrview/3133e28517e89a3e11435dd5ac4ad85a.view"
+            "/mrview/3133e28517e89a3e11435dd5ac4ad85a.view",
+        
".recovery/~s.1499329402/shards/00000000-1fffffff/~s.1499329402_design",
+        ".recovery/~s.1499329402/shards/00000000-1fffffff/~s.1499329402_design"
+            "/mrview/8fabddcb28f501d6764afd7def3bd352.view"
     ],
     lists:flatmap(fun(DbName) ->
         lists:map(fun(Format) ->
-            filename:join("/srv/data", io_lib:format(Format, [DbName]))
+            % calculate the occurrence of "~s" in the Format string
+            % by splitting Format String using ~s.
+            TildeSOccNum = erlang:length(binary:split(
+                list_to_binary(Format),
+                list_to_binary("~s"),
+                [global])
+            ) - 1,
+            if TildeSOccNum == 1 ->
 
 Review comment:
   TildeSOccNum is a fairly confusing name. Something like "ArgCount".
   
   Using `if` probably isn't the cleanest approach here. I'd do something like:
   
   ```erlang
   Args = case ArgCount of
       1 -> [DbName];
       2 -> [DbName, DbName]
   end,
   filename:join("/srv/data/", io_lib:format(Format, Args)
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to