iilyak commented on a change in pull request #1789: New Feature: Database 
Partitions
URL: https://github.com/apache/couchdb/pull/1789#discussion_r239200442
 
 

 ##########
 File path: src/couch/src/couch_db.erl
 ##########
 @@ -604,12 +628,21 @@ get_db_info(Db) ->
         {disk_format_version, DiskVersion},
         {committed_update_seq, CommittedUpdateSeq},
         {compacted_seq, CompactedSeq},
+        {props, {Props}},
         {uuid, Uuid}
     ],
     {ok, InfoList}.
 
-get_design_docs(#db{name = <<"shards/", _/binary>> = ShardDbName}) ->
-    DbName = mem3:dbname(ShardDbName),
+
+get_partition_info(#db{} = Db, Partition) when is_binary(Partition) ->
+    Sizes = couch_db_engine:get_partition_info(Db, Partition),
+    {ok, Sizes};
+get_partition_info(_Db, _Partition) ->
+    throw({bad_request, <<"`partition` is not valid">>}).
+
+
+get_design_docs(#db{name = <<"shards/", _:18/binary, DbFullName/binary>>}) ->
+    DbName = ?l2b(filename:rootname(filename:basename(?b2l(DbFullName)))),
 
 Review comment:
   I think `couch_db:normalize_dbname(ShardName)` would be better here for the 
following reasons:
   - it encapsulates naming convention in one place
   - `filename:rootname/1` is expensive 
[see](https://github.com/apache/couchdb/commit/e8a97f52b0cf0d0408d5a4ea625644684edaa6f5).

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