You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by iilyak <gi...@git.apache.org> on 2016/01/28 22:24:59 UTC

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

GitHub user iilyak opened a pull request:

    https://github.com/apache/couchdb-couch/pull/135

    Add couch_file:open_files/0

    Adding debugging function to list all opened couch_file files.
    This function is for debugging purposes only. It iterates through all
    open ports and returns file descriptor and filename correspondent to
    every port.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cloudant/couchdb-couch list_open_files

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-couch/pull/135.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #135
    
----
commit 2756dd72087a9e3362799f0bbccd2cfc54058e23
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date:   2016-01-28T21:17:42Z

    Add couch_file:open_files/0
    
    This function is for debugging purposes only. It iterates through all
    open ports and returns file descriptor and filename correspondent to
    every port.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/135#issuecomment-182901117
  
    @tsutsu: Your suggestion was implemented. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/135#discussion_r51191417
  
    --- Diff: src/couch_file.erl ---
    @@ -299,6 +301,8 @@ init({Filepath, Options, ReturnPid, Ref}) ->
             filelib:ensure_dir(Filepath),
             case file:open(Filepath, OpenOptions) of
             {ok, Fd} ->
    +            %% Save Fd in process dictionary for debugging purposes
    +            put(couch_file_fd, {Fd, Filepath}),
    --- End diff --
    
    Why not to use `pid2name/1` instead?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

Posted by tsutsu <gi...@git.apache.org>.
Github user tsutsu commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/135#issuecomment-181614474
  
    I wouldn't expect a function called `couch_file:process_info(Pid)` to return a single property tuple, but rather a processed and filtered version of `erlang:process_info(Pid)`—a list of tuples.
    
    What you probably want is more like `erlang:process_info(Pid, Key)`—a key parameter to make it clear you're pulling out a particular tuple, e.g. `couch_file:process_info(Pid, fd)`. The function could just be defined for the `fd` case and nothing else.
    
    Other than that, looks good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/135#issuecomment-182092383
  
    @tsutsu: Thank you. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/135#discussion_r51201958
  
    --- Diff: src/couch_file.erl ---
    @@ -299,6 +301,8 @@ init({Filepath, Options, ReturnPid, Ref}) ->
             filelib:ensure_dir(Filepath),
             case file:open(Filepath, OpenOptions) of
             {ok, Fd} ->
    +            %% Save Fd in process dictionary for debugging purposes
    +            put(couch_file_fd, {Fd, Filepath}),
    --- End diff --
    
    Hm...true, I miss that moment. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

Posted by tsutsu <gi...@git.apache.org>.
Github user tsutsu commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/135#issuecomment-183522845
  
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/couchdb-couch/pull/135


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/135#issuecomment-176435462
  
    Good call to provide debug helper utilities! 
    A bit long shot, but I think better to start with separate module (like `couch_debug`). This function won't be the only and we can keep those isolated from modules public api (since comment about debugging purposes won't be available on autocompletion hints). And it could make us free on utilities content. What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Add couch_file:open_files/0

Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/135#discussion_r51196276
  
    --- Diff: src/couch_file.erl ---
    @@ -299,6 +301,8 @@ init({Filepath, Options, ReturnPid, Ref}) ->
             filelib:ensure_dir(Filepath),
             case file:open(Filepath, OpenOptions) of
             {ok, Fd} ->
    +            %% Save Fd in process dictionary for debugging purposes
    +            put(couch_file_fd, {Fd, Filepath}),
    --- End diff --
    
    pid2name doesn't work for raw file descriptors.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---