iilyak opened a new pull request #1601: Implement couch_file:format_status to 
log filepath
URL: https://github.com/apache/couchdb/pull/1601
 
 
   ## Overview
   
   Erlang OTP logs the fact when gen_server behavior crashes. However in case 
of couch_file the filename is not part of the state. So it is quite hard to 
figure out what happened given the current log entry format. This PR adds 
information about filepath to the log entry. Keep in mind though that the 
filepath value is captured on couch_file:start_link. It is not representing the 
current file name if file is renamed or moved.
   
   ## Testing recommendations
   
   1. Start couchdb `dev/run --admin=adm:pass`
   2. Start remsh session `dev/remsh`
   3. Inject failure in one of the couch_file processes (by reading with 
position greater than the file size) 
   ```
   {_Port, Pid, _Fd, _Name} = hd(couch_debug:opened_files()).
   couch_file:pread_binary(Pid, 999999999999999).
   ```
   4. Check logs to make sure the following messages are present:
   ```
   [error] 2018-09-12T20:01:02.957946Z node1@127.0.0.1 <0.390.0> -------- 
gen_server <0.390.0> terminated with reason: bad return value 
{read_beyond_eof,"/home/jenkins/dev/lib/node1/data/dbs/nodes.couch"}
     last msg: {pread_iolist,123123123}
        state: 
[{data,[{"State",{file,{file_descriptor,prim_file,{#Port<0.51359>,29}},true,139454,#Ref<0.0.3.65>,infinity}},{"InitialFilePath","/home/jenkins/dev/lib/node1/data/dbs/nodes.couch"}]}]
   ```
   
   ## Related Issues or Pull Requests
   
   This is a port of PR from https://github.com/apache/couchdb-couch/pull/215 
to couchdb repository. 
   
   ## Checklist
   
   - [x] Code is written and works correctly;
   - [ ] Changes are covered by tests;
   - [ ] Documentation reflects the changes;
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to