rnewson commented on a change in pull request #1656: Partition review fixes
URL: https://github.com/apache/couchdb/pull/1656#discussion_r226628173
 
 

 ##########
 File path: src/fabric/src/fabric_view_all_docs.erl
 ##########
 @@ -148,16 +154,16 @@ shards(DbName, Args) ->
                 {_, _} ->
                     mem3:shards(DbName)
             end;
-        _ ->
-            mem3:shards(DbName)
+        {true, Partition} ->
+            mem3:shards(DbName, <<Partition/binary, ":foo">>)
     end.
 
-partition(undefined) ->
-    undefined;
-partition(null) ->
-    null;
+
 partition(Key) when is_binary(Key) ->
-    hd(binary:split(Key, <<":">>)).
+    hd(binary:split(Key, <<":">>));
+partition(_) ->
+    undefined.
 
 Review comment:
   my point is that this is defensive programming which we avoid as much as 
possible. if mango 'can pass through a number' that means we have a bug in 
mango. 

----------------------------------------------------------------
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