CouchDB
  1. CouchDB
  2. COUCHDB-514

Redirect from _list using view rows

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 0.10
    • Fix Version/s: None
    • Component/s: JavaScript View Server
    • Labels:
      None
    • Skill Level:
      Regular Contributors Level (Easy to Medium)

      Description

      There is no way to redirect from a _list function after calling the getRow() API function.

      Here's a link to the discussion on the dev mailing list:
      http://is.gd/3KZRg

      1. render.diff
        10 kB
        Joscha Feth
      2. list_views.diff
        1 kB
        Yohei Sasaki
      3. list-redir.diff
        3 kB
        Zachary Zolton

        Issue Links

          Activity

          Hide
          Dave Cottlehuber added a comment -

          consolidate these into COUCHDB-430.

          Show
          Dave Cottlehuber added a comment - consolidate these into COUCHDB-430 .
          Show
          Caleb Case added a comment - https://github.com/apache/couchdb/pull/18#issuecomment-5167025
          Hide
          Jan Lehnardt added a comment -

          needs updating to master.

          Show
          Jan Lehnardt added a comment - needs updating to master.
          Hide
          Chris Anderson added a comment -

          Joscha,

          If you can provide just the bug fix (not _stylistic changes) I'll be glad to help you finish it.

          I do think this will require an Erlang fix. I won't let it slip past 1.0 but I don't have time to write it before 0.11

          Chris

          Show
          Chris Anderson added a comment - Joscha, If you can provide just the bug fix (not _stylistic changes) I'll be glad to help you finish it. I do think this will require an Erlang fix. I won't let it slip past 1.0 but I don't have time to write it before 0.11 Chris
          Hide
          Joscha Feth added a comment -

          Added render.diff which enables the list render function to disable/enable automatic flushing and fixes the problem with start() being sent automatically when getRow() gets called. Needs readline() to be fixed first to also return if there is no header sent, yet.

          Show
          Joscha Feth added a comment - Added render.diff which enables the list render function to disable/enable automatic flushing and fixes the problem with start() being sent automatically when getRow() gets called. Needs readline() to be fixed first to also return if there is no header sent, yet.
          Hide
          Paul Joseph Davis added a comment -

          Ohhhh.

          The reason that Zachary's patch won't work is that the Erlang side is waiting for the start before sending the first row. The "getRow()" style API in JavaScript is still bound by the serialized enforcement that the Erlang side does. Sadly that means the patch is more involved than I had initially thought.

          For interested parties, the fix for this is in reworking how couch_httpd_show.erl uses the btree fold function. Basically, in couch_httpd_show:start_list_resp/5 the proper thing would be to just send the head info and defer the response building till later in the iteration process when render_list_row is called.

          Show
          Paul Joseph Davis added a comment - Ohhhh. The reason that Zachary's patch won't work is that the Erlang side is waiting for the start before sending the first row. The "getRow()" style API in JavaScript is still bound by the serialized enforcement that the Erlang side does. Sadly that means the patch is more involved than I had initially thought. For interested parties, the fix for this is in reworking how couch_httpd_show.erl uses the btree fold function. Basically, in couch_httpd_show:start_list_resp/5 the proper thing would be to just send the head info and defer the response building till later in the iteration process when render_list_row is called.
          Hide
          Paul Joseph Davis added a comment -

          Hmm, Zachary looks like he's going in the right direction with his patch. I'll try and get to this tonight or tomorrow to see if we can get something worked out.

          Yohei, thanks for the failing test case. That should be most useful in fixing this.

          Show
          Paul Joseph Davis added a comment - Hmm, Zachary looks like he's going in the right direction with his patch. I'll try and get to this tonight or tomorrow to see if we can get something worked out. Yohei, thanks for the failing test case. That should be most useful in fixing this.
          Hide
          Yohei Sasaki added a comment -

          I'm troubled with the similar problem to this issue.

          I attached a patch(for svn:rev834436) for adding javascript test case(share/www/test/list_views.js).
          This test case would be passed when Erlang side is fixed.

          Show
          Yohei Sasaki added a comment - I'm troubled with the similar problem to this issue. I attached a patch(for svn:rev834436) for adding javascript test case(share/www/test/list_views.js). This test case would be passed when Erlang side is fixed.
          Hide
          Zachary Zolton added a comment -

          This patch (from a reasonably current HEAD on github) shows how I was attempting to get the JavaScript view server to defer sending the headers until after the first time send() is called.

          Unfortunately, this code doesn't work, but I'm attaching it here to encourage some dialog... :^D

          Show
          Zachary Zolton added a comment - This patch (from a reasonably current HEAD on github) shows how I was attempting to get the JavaScript view server to defer sending the headers until after the first time send() is called. Unfortunately, this code doesn't work, but I'm attaching it here to encourage some dialog... :^D

            People

            • Assignee:
              Chris Anderson
              Reporter:
              Zachary Zolton
            • Votes:
              6 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development