nickva commented on a change in pull request #3969:
URL: https://github.com/apache/couchdb/pull/3969#discussion_r839656833



##########
File path: src/couch/src/couch_db.erl
##########
@@ -2062,67 +2067,73 @@ is_system_db_name(DbName) when is_binary(DbName) ->
             re:run(Prefix, ?DBNAME_REGEX, ReOpts) == match
     end.
 
-set_design_doc_keys(Options1) ->
+-define(DOC_KEYS, #{
+    design => #{sk => <<"_design/">>, ek => <<"_design0">>},
+    non_design => #{sk => <<"_design0">>, ek => <<255>>}
+}).

Review comment:
       This would almost work except for cases when there are system db which 
start with `_a...` or `_b...`, `_db...`.
   
   In couch_db.hrl we see this list:
   
   ```erlang
   -define(SYSTEM_DATABASES, [
       <<"_dbs">>,
       <<"_global_changes">>,
       <<"_metadata">>,
       <<"_nodes">>,
       <<"_replicator">>,
       <<"_users">>
   ]).
   ```
   They all sort after `_design0` except `_dbs`. In this case, I think, we 
don't have to worry about listing` _dbs` with a `non_design` namespace because 
it doesn't seem like `_dbs` would appear in any db as a document? (Can anyone 
think of a counter-example).
   
   At least if we go forward in this case, we'd want to add a warning comment 
to the `SYSTEM_DATABASES` define in `couch_db.hrl` that if we add any new items 
to the list in the future, we'd might have to rework how `non_design` namespace 
works.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to