You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by nickva <gi...@git.apache.org> on 2017/01/30 19:52:15 UTC

[GitHub] couchdb-fabric issue #86: Return Error When Workers Crash

Github user nickva commented on the issue:

    https://github.com/apache/couchdb-fabric/pull/86
  
    Created a 5 nodes clusters with `./dev/run -n5` that did not go smoothly and had to tweak it by hand some. Somehow ended up with a 'couchdb@127.0.0.1' node in mem3:nodes() instead of node4 and node5.
    
    Then created a `<<"db">>` and `<<"doc1">>` they ended up on nodes 2,3 and 4
    ```
    rp(mem3:shards(<<"db">>, <<"doc1">>)).
    [{shard,<<"shards/c0000000-dfffffff/db.1485801065">>,
            'node2@127.0.0.1',<<"db">>,
            [3221225472,3758096383],
            undefined},
     {shard,<<"shards/c0000000-dfffffff/db.1485801065">>,
            'node3@127.0.0.1',<<"db">>,
            [3221225472,3758096383],
            undefined},
     {shard,<<"shards/c0000000-dfffffff/db.1485801065">>,
            'node4@127.0.0.1',<<"db">>,
            [3221225472,3758096383],
            undefined}]
    ```
    
    Put all 3 nodes in maintenance and when querying via http got bad_match error
    
    ```
     $ http 'http://adm:pass@localhost:15984/db/doc1?open_revs=["1-967a00dff5e02add41819138abb3284d"]&latest=true&revs=true'
    HTTP/1.1 500 Internal Server Error
    
    {
        "error": "badmatch",
        "reason": "{error,all_workers_died}",
        "ref": 281556634
    }
    ```
    
    Just to compare *without* the fix I get:
    
    ```
    http  'http://adm:pass@localhost:15984/db/doc1?open_revs=["1-967a00dff5e02add41819138abb3284d"]&latest=true&revs=true' 'Accept:application/json'
    HTTP/1.1 200 OK
    
    []
    ```
     
    Also notice, we apparently also do handle `{ok, []}` result and return missing 404 but only if open_revs=all case:
    
    ```
            {ok, Results} = fabric:open_revs(Db, DocId, Revs, Options),
            case Results of
                [] when Revs == all ->
                    chttpd:send_error(Req, {not_found, missing});
    ```
    
    In https://github.com/cloudant/couchdb-chttpd/blob/master/src/chttpd_db.erl#L675


---
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.
---