jiahuili430 opened a new pull request #3779:
URL: https://github.com/apache/couchdb/pull/3779


   ## Overview
   
   The fabric:cleanup_index_files/1 is crashing when database is deleted 
between execution start and completion.
   
   ```
   ([email protected])2> fabric:cleanup_index_files().
   ** exception error: database_does_not_exist
        in function  mem3_shards:load_shards_from_db/89
           called as 
mem3_shards:load_shards_from_db(53,51,54,99,100,102,98,56,45,102,57,54,53,45,52,54,49,97,
                                                     
45,56,49,55,49,45,52,100,56,101,55|...)
        in call from mem3_shards:load_shards_from_disk/1 (src/mem3_shards.erl, 
line 368)
        in call from mem3_shards:for_db/2 (src/mem3_shards.erl, line 54)
        in call from fabric_util:is_partitioned/1 (src/fabric_util.erl, line 
253)
        in call from fabric_view_all_docs:shards/2 
(src/fabric_view_all_docs.erl, line 145)
        in call from fabric_view_all_docs:go/5 (src/fabric_view_all_docs.erl, 
line 26)
        in call from fabric:inactive_index_files/1 (src/fabric.erl, line 514)
        in call from fabric:cleanup_index_files/1 (src/fabric.erl, line 509)
   ```
   
   This problem can be easily solved by wrapping the function body in a 
try/catch block and checking database_does_not_exist. In this case, we will 
return an empty list.
   
   <!-- 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: [email protected]

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


Reply via email to