You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/06/18 20:55:57 UTC

[GitHub] [couchdb] iilyak commented on a change in pull request #3633: 3631 3.x fix pq shard creation

iilyak commented on a change in pull request #3633:
URL: https://github.com/apache/couchdb/pull/3633#discussion_r654348512



##########
File path: src/dreyfus/src/dreyfus_rpc.erl
##########
@@ -102,10 +102,12 @@ disk_size(DbName, DDoc, IndexName) ->
     end.
 
 get_or_create_db(DbName, Options) ->
+    DbOpts = mem3_shards:opts_for_db(DbName),
+    Options1 = mem3_util:merge_opts(DbOpts, Options),
     case couch_db:open_int(DbName, Options) of

Review comment:
       Should we use `couch_db:open_int(DbName, Options1)` here?

##########
File path: src/dreyfus/src/dreyfus_rpc.erl
##########
@@ -102,10 +102,12 @@ disk_size(DbName, DDoc, IndexName) ->
     end.
 
 get_or_create_db(DbName, Options) ->
+    DbOpts = mem3_shards:opts_for_db(DbName),

Review comment:
       I don't have a very strong opinion against this approach. Just wanted to mention that it looks like leaking abstraction where all components need to deal with internal details of another app. Alternative solution could be:
   
   mem3_util.erl
   ```
   get_or_create_db(DbName, Options, CreateFun) ->
       DbOpts = mem3_shards:opts_for_db(DbName),
       Options1 = mem3_util:merge_opts(DbOpts, Options),
       case couch_db:open_int(DbName, Options1) of           
            {not_found, no_db_file} ->
                   couch_log:warning("~p creating ~s", [?MODULE,  DbName]),
                   CreateFun(DbName, Options1);
             Else ->
                   Else
   end
   ```
   
   dreyfus_rpc.erl (and hastings_rpc.erl)
   ```
   get_or_create_db(DbName, Options) ->
       mem3_util:get_or_create_db(DbName, Options, fun couch_server:create/2).
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org