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 2022/03/21 21:19:14 UTC

[GitHub] [couchdb] noahshaw11 opened a new pull request #3964: Fix unhandled all_dbs_active errors

noahshaw11 opened a new pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964


   <!-- Thank you for your contribution!
   
        Please file this form by replacing the Markdown comments
        with your text. If a section needs no action - remove it.
   
        Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
        of code collaboration. Positive feedback is represented +1 from committers
        and negative is a -1. The -1 also means veto, and needs to be addressed
        to proceed. Once there are no objections, the PR can be merged by a
        CouchDB committer.
   
        See: http://couchdb.apache.org/bylaws.html#decisions for more info. -->
   
   ## Overview
   
   <!-- Please give a short brief for the pull request,
        what problem it solves or how it makes things better. -->
   
   ## Testing recommendations
   
   <!-- Describe how we can test your changes.
        Does it provides any behaviour that the end users
        could notice? -->
   
   ## Related Issues or Pull Requests
   
   <!-- If your changes affects multiple components in different
        repositories please put links to those issues or pull requests here.  -->
   
   ## Checklist
   
   - [ ] Code is written and works correctly
   - [ ] Changes are covered by tests
   - [ ] Any new configurable parameters are documented in `rel/overlay/etc/default.ini`
   - [ ] A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation
   


-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 edited a comment on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 edited a comment on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074714240


   If we do not plan on implementing any behavior if an `all_dbs_active` error is encountered, then maybe just wrapping https://github.com/apache/couchdb/blob/3.x/src/couch/src/couch_server.erl#L126 in a `throw/1` would suffice for the errors found by Dialyzer because of the catch found at https://github.com/apache/couchdb/blob/3.x/src/couch/src/couch_server.erl#L102-L104.


-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 edited a comment on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 edited a comment on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074725480


   Listed below are the errors found by Dialyzer via adding the following spec:
   ```
   diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
   index 3c72e3357..72bd51375 100644
   --- a/src/couch/src/couch_server.erl
   +++ b/src/couch/src/couch_server.erl
   @@ -90,6 +90,9 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
    sup_start_link(N) ->
        gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
    
   +-spec open(any(), [any()]) ->
   +    {ok, any()} |
   +    {error, all_dbs_active}.
    open(DbName, Options) ->
        try
            validate_open_or_create(DbName, Options),
   ```
   List of errors:
   ```
   src/couch_db_split.erl:0: in couch_db_split:copy_local_docs/3[78-111]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/couch_db_split.erl:0: in couch_db_split:cleanup_target/2[112-126]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_non_existent/1[32-38]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_create/1[39-45]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_when_exists/1[46-52]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_terminate/1[53-59]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/dreyfus_rpc.erl:0: in dreyfus_rpc:get_or_create_db/2[104-113]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
   
   
   src/mem3_rep.erl:0: in mem3_rep:go/1[106-132]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_rep.erl:0: in mem3_rep:with_src_db/2[711-723]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_reshard_job.erl:0: in mem3_reshard_job:wait_source_close_impl/1[499-516]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:ensure_exists/1[294-305]:The pattern 
             'file_exists' can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db/2[548-564]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db_int/2[565-582]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_shard_props/1[589-610]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/hastings_rpc.erl:0: in hastings_rpc:get_or_create_db/2[111-120]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
    ```


-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 edited a comment on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 edited a comment on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074725480


   Listed below are the errors found by Dialyzer via adding the following spec:
   ```
   diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
   index 3c72e3357..72bd51375 100644
   --- a/src/couch/src/couch_server.erl
   +++ b/src/couch/src/couch_server.erl
   @@ -90,6 +90,9 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
    sup_start_link(N) ->
        gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
    
   +-spec open(any(), [any()]) ->
   +    {ok, any()} |
   +    {error, all_dbs_active}.
    open(DbName, Options) ->
        try
            validate_open_or_create(DbName, Options),
   ```
   List of errors:
   ```
   src/couch_db_split.erl:0: in couch_db_split:split/3[57-77]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/couch_db_split.erl:0: in couch_db_split:copy_local_docs/3[78-111]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/couch_db_split.erl:0: in couch_db_split:cleanup_target/2[112-126]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_non_existent/1[32-38]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_create/1[39-45]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_when_exists/1[46-52]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_terminate/1[53-59]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/dreyfus_rpc.erl:0: in dreyfus_rpc:get_or_create_db/2[104-113]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
   
   
   src/mem3_rep.erl:0: in mem3_rep:go/1[106-132]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_rep.erl:0: in mem3_rep:with_src_db/2[711-723]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_reshard_job.erl:0: in mem3_reshard_job:wait_source_close_impl/1[499-516]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:ensure_exists/1[294-305]:The pattern 
             'file_exists' can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db/2[548-564]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db_int/2[565-582]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_shard_props/1[589-610]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/hastings_rpc.erl:0: in hastings_rpc:get_or_create_db/2[111-120]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
    ```


-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 commented on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 commented on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074714240


   If we do not plan on implementing any behavior if an `all_dbs_active` error is encountered, then maybe just wrapping https://github.com/apache/couchdb/blob/3.x/src/couch/src/couch_server.erl#L126 in a `throw/1` would suffice for the errors found by Dialyzer.


-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 edited a comment on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 edited a comment on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074725480


   Listed below are the errors found by Dialyzer via adding the following spec:
   ```
   diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
   index 3c72e3357..72bd51375 100644
   --- a/src/couch/src/couch_server.erl
   +++ b/src/couch/src/couch_server.erl
   @@ -90,6 +90,9 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
    sup_start_link(N) ->
        gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
    
   +-spec open(any(), [any()]) ->
   +    {ok, any()} |
   +    {error, all_dbs_active}.
    open(DbName, Options) ->
        try
            validate_open_or_create(DbName, Options),
   ```
   List of errors:
   ```
   src/couch_db_split.erl:0: in couch_db_split:split/3[57-77]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/couch_db_split.erl:0: in couch_db_split:copy_local_docs/3[78-111]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/couch_db_split.erl:0: in couch_db_split:cleanup_target/2[112-126]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_non_existent/1[32-38]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_create/1[39-45]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_when_exists/1[46-52]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_terminate/1[53-59]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/dreyfus_rpc.erl:0: in dreyfus_rpc:get_or_create_db/2[104-113]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
   
   
   src/mem3_rep.erl:0: in mem3_rep:go/1[106-132]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_rep.erl:0: in mem3_rep:with_src_db/2[711-723]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_reshard_job.erl:0: in mem3_reshard_job:wait_source_close_impl/1[499-516]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:ensure_exists/1[294-305]:The pattern 
             'file_exists' can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db/2[548-564]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db_int/2[565-582]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_shard_props/1[589-610]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/hastings_rpc.erl:0: in hastings_rpc:get_or_create_db/2[111-120]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
    ```


-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] iilyak commented on a change in pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
iilyak commented on a change in pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#discussion_r832201438



##########
File path: src/couch/src/couch_server.erl
##########
@@ -95,8 +95,6 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
 sup_start_link(N) ->
     gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
 
--spec open(any(), [any()]) ->

Review comment:
       don't remove the spec, please. Add auxiliary type instead. 
   
   ```
   -type throw(_Reason) :: no_return().
   
   ....
   
   -spec open(any(), [any()]) -> 
        throw({error, all_dbs_active}).
   ```




-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 edited a comment on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 edited a comment on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074725480


   Listed below are the errors found by Dialyzer via adding the following spec:
   ```
   diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
   index 3c72e3357..72bd51375 100644
   --- a/src/couch/src/couch_server.erl
   +++ b/src/couch/src/couch_server.erl
   @@ -90,6 +90,9 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
    sup_start_link(N) ->
        gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
    
   +-spec open(any(), [any()]) ->
   +    {ok, any()} |
   +    {error, all_dbs_active}.
    open(DbName, Options) ->
        try
            validate_open_or_create(DbName, Options),
   ```
   List of errors left to handle:
   ```
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_non_existent/1[32-38]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_create/1[39-45]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_when_exists/1[46-52]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_terminate/1[53-59]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   src/mem3_reshard_job.erl:0: in mem3_reshard_job:wait_source_close_impl/1[499-516]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/hastings_rpc.erl:0: in hastings_rpc:get_or_create_db/2[111-120]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
    ```


-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] iilyak commented on a change in pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
iilyak commented on a change in pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#discussion_r832201438



##########
File path: src/couch/src/couch_server.erl
##########
@@ -95,8 +95,6 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
 sup_start_link(N) ->
     gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
 
--spec open(any(), [any()]) ->

Review comment:
       don't remove the spec, please. Add auxiliary type instead. 
   
   ```
   -type throw(_Reason) :: no_return().
   
   ....
   
   -spec open(any(), [any()]) -> 
        {ok, any()} | throw({error, all_dbs_active}).
   ```




-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 commented on a change in pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 commented on a change in pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#discussion_r832447823



##########
File path: src/couch/src/couch_server.erl
##########
@@ -95,8 +95,6 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
 sup_start_link(N) ->
     gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
 
--spec open(any(), [any()]) ->

Review comment:
       Bad delete. Added back with the auxiliary type.




-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 edited a comment on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 edited a comment on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074725480


   Listed below are the errors found by Dialyzer via adding the following spec:
   ```
   diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
   index 3c72e3357..72bd51375 100644
   --- a/src/couch/src/couch_server.erl
   +++ b/src/couch/src/couch_server.erl
   @@ -90,6 +90,9 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
    sup_start_link(N) ->
        gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
    
   +-spec open(any(), [any()]) ->
   +    {ok, any()} |
   +    {error, all_dbs_active}.
    open(DbName, Options) ->
        try
            validate_open_or_create(DbName, Options),
   ```
   List of errors:
   ```
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_non_existent/1[32-38]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_create/1[39-45]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_when_exists/1[46-52]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_terminate/1[53-59]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   src/mem3_rep.erl:0: in mem3_rep:go/1[106-132]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_rep.erl:0: in mem3_rep:with_src_db/2[711-723]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_reshard_job.erl:0: in mem3_reshard_job:wait_source_close_impl/1[499-516]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:ensure_exists/1[294-305]:The pattern 
             'file_exists' can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db/2[548-564]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db_int/2[565-582]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:get_shard_props/1[589-610]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/hastings_rpc.erl:0: in hastings_rpc:get_or_create_db/2[111-120]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
    ```


-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 edited a comment on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 edited a comment on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074725480


   Listed below are the errors found by Dialyzer via adding the following spec:
   ```
   diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
   index 3c72e3357..72bd51375 100644
   --- a/src/couch/src/couch_server.erl
   +++ b/src/couch/src/couch_server.erl
   @@ -90,6 +90,9 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
    sup_start_link(N) ->
        gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
    
   +-spec open(any(), [any()]) ->
   +    {ok, any()} |
   +    {error, all_dbs_active}.
    open(DbName, Options) ->
        try
            validate_open_or_create(DbName, Options),
   ```
   List of errors:
   ```
   src/couch_db_split.erl:0: in couch_db_split:split/3[57-77]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/couch_db_split.erl:0: in couch_db_split:copy_local_docs/3[78-111]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/couch_db_split.erl:0: in couch_db_split:cleanup_target/2[112-126]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_non_existent/1[32-38]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_create/1[39-45]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_when_exists/1[46-52]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_terminate/1[53-59]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/dreyfus_rpc.erl:0: in dreyfus_rpc:get_or_create_db/2[104-113]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
   
   
   src/mem3_rep.erl:0: in mem3_rep:go/1[106-132]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_rep.erl:0: in mem3_rep:with_src_db/2[711-723]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_reshard_job.erl:0: in mem3_reshard_job:wait_source_close_impl/1[499-516]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:ensure_exists/1[294-305]:The pattern 
             'file_exists' can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db/2[548-564]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db_int/2[565-582]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_shard_props/1[589-610]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/hastings_rpc.erl:0: in hastings_rpc:get_or_create_db/2[111-120]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
    ```


-- 
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: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 edited a comment on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 edited a comment on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074714240


   If we do not plan on implementing any behavior if an `all_dbs_active` error is encountered, then maybe just wrapping https://github.com/apache/couchdb/blob/3.x/src/couch/src/couch_server.erl#L126 in a `throw/1` would suffice for the errors found by Dialyzer because of the catch found at https://github.com/apache/couchdb/blob/3.x/src/couch/src/couch_server.erl#L102-L104. This is because all of these errors stem from calls to `couch_db:open_int/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.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

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



[GitHub] [couchdb] noahshaw11 commented on pull request #3964: Fix unhandled all_dbs_active errors

Posted by GitBox <gi...@apache.org>.
noahshaw11 commented on pull request #3964:
URL: https://github.com/apache/couchdb/pull/3964#issuecomment-1074725480


   Listed below are the errors found via adding the following spec:
   ```
   diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
   index 3c72e3357..72bd51375 100644
   --- a/src/couch/src/couch_server.erl
   +++ b/src/couch/src/couch_server.erl
   @@ -90,6 +90,9 @@ get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).
    sup_start_link(N) ->
        gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).
    
   +-spec open(any(), [any()]) ->
   +    {ok, any()} |
   +    {error, all_dbs_active}.
    open(DbName, Options) ->
        try
            validate_open_or_create(DbName, Options),
   ```
   List of errors:
   ```
   src/couch_db_split.erl:0: in couch_db_split:split/3[57-77]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/couch_db_split.erl:0: in couch_db_split:copy_local_docs/3[78-111]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/couch_db_split.erl:0: in couch_db_split:cleanup_target/2[112-126]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_non_existent/1[32-38]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_create/1[39-45]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_open_when_exists/1[46-52]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/cpse_test_open_close_delete.erl:0: in cpse_test_open_close_delete:cpse_terminate/1[53-59]:Guard test 
             {'error', 'all_dbs_active'} | {'ok', _} =:= 
             __X :: {'not_found', 'no_db_file'} can never succeed
   
   
   src/dreyfus_rpc.erl:0: in dreyfus_rpc:get_or_create_db/2[104-113]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
   
   
   src/mem3_rep.erl:0: in mem3_rep:go/1[106-132]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_rep.erl:0: in mem3_rep:with_src_db/2[711-723]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_reshard_job.erl:0: in mem3_reshard_job:wait_source_close_impl/1[499-516]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:ensure_exists/1[294-305]:The pattern 
             'file_exists' can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db/2[548-564]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/mem3_util.erl:0: in mem3_util:get_or_create_db_int/2[565-582]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'}
   
   
   src/mem3_util.erl:0: in mem3_util:get_shard_props/1[589-610]:The pattern 
             {'not_found', _} can never match the type 
             {'error', 'all_dbs_active'}
   
   src/hastings_rpc.erl:0: in hastings_rpc:get_or_create_db/2[111-120]:The pattern 
             {'not_found', 'no_db_file'} can never match the type 
             {'error', 'all_dbs_active'} | {'ok', _}
    ```


-- 
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: notifications-unsubscribe@couchdb.apache.org

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