Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Jan 17, 2012
  1. Chris Anderson Jens Alfke

    try restarting inets

    jchris authored snej committed
    Change-Id: I49c2db88fda2dab95cf1d9b18fba714f52713db8
    Reviewed-on: http://review.couchbase.org/12441
    Reviewed-by: Jens Alfke <jens@couchbase.com>
    Tested-by: Jens Alfke <jens@couchbase.com>
Commits on Nov 21, 2011
  1. Jens Alfke

    Eliminate delay in restarting CouchDB when app resumes

    snej authored
    * Instead of restarting the entire Erlang VM, just restart the couch_httpd server, which is very fast.
    * On wake, check whether the listener socket is still alive, and only restart if it's not.
    
    Change-Id: I1942e74bb4dec64b2ef1d97d2e6bc3b5f24b6dc6
    Reviewed-on: http://review.couchbase.org/11026
    Reviewed-by: Jens Alfke <jens@couchbase.com>
    Tested-by: Jens Alfke <jens@couchbase.com>
Commits on Oct 25, 2011
  1. Jens Alfke

    Objective-C view support for Couchbase Mobile iOS

    snej authored
    This is a squashed commit of all the work done on other
    branches by Jonathon Mah & me.
    
    Change-Id: I0b9d020d57502b2ea46b695d9788e42ceb7225fb
    Reviewed-on: http://review.couchbase.org/10023
    Reviewed-by: Jonathon Mah <me@jonathonmah.com>
    Reviewed-by: Chris Anderson <jchris@couchbase.com>
    Tested-by: Jens Alfke <jens@couchbase.com>
  2. Jonathon Mah Jens Alfke

    View servers can add dependencies to their view definitions

    jmah authored snej committed
    This will be necessary for Objective-C views, since the view definition
    simply contains the class and method names, which remain the same as the
    code changes. The ObjC view server can therefore ask the class for a
    version identifier, and append that to be hashed along with the view.
    
    Conflicts:
    
    	src/couchdb/couch_view_server_objc.erl
    
    Change-Id: Ia997d298022909a3c0cbaf0d23f6de38c0ac7a91
    Reviewed-on: http://review.couchbase.org/10022
    Reviewed-by: Chris Anderson <jchris@couchbase.com>
    Reviewed-by: Jonathon Mah <me@jonathonmah.com>
    Tested-by: Jens Alfke <jens@couchbase.com>
  3. Filipe Manana Chris Anderson

    Fix builtin changes filters with ?descending=true

    fdmanana authored jchris committed
    After a recent optimization (COUCHDB-1288), querying the _changes
    feed using one of the builtin filters (_doc_ids, _design) with
    ?descending=true was not producing the correct results anymore.
    This changes fixes it and adds a test.
    
    Change-Id: Iae9479c8c1788facf2f09b313ef82d8de8a21a9d
    Reviewed-on: http://review.couchbase.org/10189
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Reviewed-by: Chris Anderson <jchris@couchbase.com>
Commits on Oct 17, 2011
  1. Filipe Manana Jens Alfke

    Allow by "doc ids" pull replications from a 1.0 server

    fdmanana authored snej committed
    CouchDB 1.0 and older releases don't have the builtin _changes
    feed filter "_doc_ids" (neither support POSTs against _changes).
    
    Change-Id: I421f5c35aedc43e68121a57378a73f8aab6d781c
    Reviewed-on: http://review.couchbase.org/10164
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Tested-by: Jens Alfke <jens@couchbase.com>
    Reviewed-by: Jens Alfke <jens@couchbase.com>
Commits on Oct 3, 2011
  1. Chris Anderson

    rename the release for couchbase mobile beta

    jchris authored
    Change-Id: I1b1158d40c116465a2358c46b1df21cb22a9d46b
    Reviewed-on: http://review.couchbase.org/9929
    Reviewed-by: Chris Anderson <jchris@couchbase.com>
    Tested-by: Chris Anderson <jchris@couchbase.com>
Commits on Sep 27, 2011
  1. Jonathon Mah

    Add map-as-filter support to Emonk (and Erlang) app servers

    jmah authored Dale Harvey committed
    Change-Id: Ie3edcf1be91645f5ddcd5623eb18625cbab4df2f
    Reviewed-on: http://review.couchbase.org/9814
    Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
    Tested-by: Dale Harvey <daleharvey@arandomurl.com>
  2. Jonathon Mah Chris Anderson

    Fixed bug in Emonk design document traversal

    jmah authored jchris committed
    Change-Id: I25ccd828cfe3ffd08153d888454874ac638a2557
    Reviewed-on: http://review.couchbase.org/9813
    Tested-by: Dale Harvey <daleharvey@arandomurl.com>
    Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
    Reviewed-by: Jens Alfke <jens@couchbase.com>
  3. Dale  Harvey Chris Anderson

    Honor conflicts with include_docs paramter

    daleharvey authored jchris committed
    Thanks to Jonathon Mah
    
    Change-Id: I56d688cf99042a58780544e135fa4417d0a9f610
    Reviewed-on: http://review.couchbase.org/9799
    Reviewed-by: Chris Anderson <jchris@couchbase.com>
    Tested-by: Chris Anderson <jchris@couchbase.com>
Commits on Sep 21, 2011
  1. Aaron Miller

    Add isArray to emonk_app sandbox object

    apage43 authored
    Change-Id: I3de56d9bb85497180acb93e250f834eb7038f2e4
    Reviewed-on: http://review.couchbase.org/9345
    Reviewed-by: Chris Anderson <jchris@couchbase.com>
    Reviewed-by: Jens Alfke <jens@couchbase.com>
    Tested-by: Aaron Miller <apage43@ninjawhale.com>
Commits on Sep 20, 2011
  1. Filipe Manana

    Efficient implementation of builtin filters

    fdmanana authored fdmanana committed
    Currently, the builtin changes filters "_doc_ids" and "_design"
    are not very efficient because they fold the entire seq btree
    and then filter the values by document ID.
    This implementation avoids that by doing direct lookups against
    the id btree, and then, for continuous changes requests, it
    just listens for database update events and does partial seq
    btree folds.
    
    COUCHDB-1288
    
    Change-Id: I98a6392d13d967a5a50c5b9b42bfaa30d22fa0c3
    Reviewed-on: http://review.couchbase.org/9686
    Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
  2. Filipe Manana

    Fix introduction of duplicates into _changes feed

    fdmanana authored fdmanana committed
    When a document is updated the new update_seq is assigned as part of the
    rev_tree merging in couch_db_updater:merge_rev_trees/7 based on the
    condition of whether the new rev_tree is equal to the old tree. This
    equality is done as a simple Erlang term comparison. If the trees are
    not equal a new update_seq is assigned to the #full_doc_info{} record
    that is stored in fulldocinfo_by_id_btree.
    
    During replication it is possible that a document update merges into the
    rev_tree internally without creating a leaf. If the terminal node of the
    replicated path happens to land on a node with a value of ?REV_MISSING
    the new document information will be preferred and replace the
    ?REV_MISSING value.
    
    This preference ends up causing the rev_tree comparison to evaluate to
    false which ends up giving this document a new update_seq. Up until this
    point everything is fine. We write a bit of extra data (that will be
    cleared during compaction) because of a previous bug where we decided to
    be cautious and avoid losing data due to a broken rev_tree merging
    aglorithm. It is also important to note that this is the place were we
    calculate the update_seq to remove from the docinfo_by_seq_tree.
    
    After this point we get back to couch_db_udpater:update_docs_int/5 where
    we eventually call couch_db_updater:new_index_entries/3 which creates
    the new entries for the fulldocinfo_by_id_tree and docinfo_by_seq_btree.
    At this point we end up creating a #doc_info{} record based on the
    leaves in the rev_tree. As you recall, the update that caused the new
    update_seq was not a leaf, at this point we create a #doc_info{} record
    with an incorrect high_seq member pointing to the update_seq we are
    about to remove from the docinfo_by_seq_tree (remember we calculated the
    seq to remove before we consulted the leaves).
    
    The end result is that we remove the same update_seq we insert. This
    sets us up for the real bug. The next time we go to update this document
    the same procedure is applied. But what happens is at the point we
    calculate the seq to remove from docinfo_by_seq_tree, we calculate the
    wrong value. Thus when the update continues we remove an update_seq that
    doesn't exist in the tree and insert our new seq. But, the seq from the
    previous update is still in the tree. Thus, our docinfo_by_seq_tree now
    contains two entries pointing at the same document.
    
    At this point, we run into the observed behavior of this bug that ends
    up causing duplicate entries in views which then ends up throwing errors
    when the view is compaction. These errors are also particularly nasty
    because they bubble up the the couch_view gen_server which crashes and
    spiders out crashing every couch_view_group process. That part probably
    isn't important though.
    
    There's a simple test include with the patch to illustrate the behavior
    and maintain an assertion that it stays fixed.
    
    Fixes COUCHDB-1265
    
    Change-Id: Id5fb2d9e14ecda637687c0534b238442fea1ba6d
    Reviewed-on: http://review.couchbase.org/9685
    Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
  3. Filipe Manana

    Remove Style where we have no need for it

    fdmanana authored fdmanana committed
    Change-Id: I376d7ff8781c625be251731860553a7a8c0cfebf
    Reviewed-on: http://review.couchbase.org/9684
    Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
  4. Filipe Manana

    Do not suppress old revisions from _changes

    fdmanana authored fdmanana committed
    Requests to '_changes?style=all_docs' with a 'since' parameter would
    suppress revisions of a document generated before the start of the
    feed.  The assumption may have been that those revisions were seen by
    the client in a previous request to _changes, but this is not
    necessarily true if the client is resuming the feed after a partial
    download.
    
    The safe thing to do is to include all leaf revisions for each document
    in the feed.
    
    Thanks Bob Dionne for the test code.
    
    Closes COUCHDB-1256
    
    Change-Id: If58c365d6398f0065a29549844793186b393894d
    Reviewed-on: http://review.couchbase.org/9683
    Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
  5. Filipe Manana

    Replicator: don't use chunked encoding for _bulk_docs

    fdmanana authored fdmanana committed
    Nginx and a few other servers don't like PUT/POST requests
    without a Content-Length header, making it impossible to
    do a chunked transfer encoding for these requests.
    Issue and patch tested by Dale Harvey, thanks.
    
    Closes COUCHDB-1286.
    
    Change-Id: I25496c73e519556318a4bb37168f9708efc4f8bb
    Reviewed-on: http://review.couchbase.org/9653
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
  6. Filipe Manana

    Make sure httpc pool doesn't reuse dead connections

    fdmanana authored fdmanana committed
    Race conditions allowed dead http connections to be added
    back to the httpc pool and then be given back to clients.
    In extreme cases this could lead to a pool full of dead
    http connections.
    Issue identified by Dale Harvey. Thanks.
    
    Change-Id: I76819e51163c30a47b48abea51a5c416a2e7bc93
    Reviewed-on: http://review.couchbase.org/9511
    Reviewed-by: Chris Anderson <jchris@couchbase.com>
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Commits on Sep 14, 2011
  1. Jens Alfke

    Use a local UUID, not hostname, in replication ID

    snej authored
    In a mobile app, the hostname and port are not at all
    constant between launches, so they're not good to use for
    generating replication IDs. This is causing replication to
    start over from scratch on every launch, making it very
    slow.
    
    Filipe gave me (Jens) this patch, which creates a local
    UUID for the server, stores it in the config, and uses it
    instead of the hostname+port in the replication ID.
    
    Change-Id: I2bc37d3ffb2b5181cbe46decea6399f499a66b2d
    Reviewed-on: http://review.couchbase.org/9575
    Reviewed-by: Chris Anderson <jchris@couchbase.com>
    Tested-by: Jens Alfke <jens@couchbase.com>
Commits on Aug 18, 2011
  1. Filipe Manana Jens Alfke

    Prevent data loss on db creation request

    fdmanana authored snej committed
    1) Create and populate a database
    2) Restart the server
    3) Send a PUT request to create the database - the server
       will override the existing file, making all previous
       documents no longer accessible nor recoverable
    
    Change-Id: I8d30dca712cf0ac514a03b522ed0b909b35c32f9
    Reviewed-on: http://review.couchbase.org/9112
    Tested-by: Jens Alfke <jens@couchbase.com>
    Reviewed-by: Jens Alfke <jens@couchbase.com>
Commits on Aug 15, 2011
  1. Aaron Miller Jens Alfke

    Post couchStarted notification after writing .uri file

    apage43 authored snej committed
    Change-Id: I12864eb1efdd91a9abad73c7c974ffdfdc318ee2
    Reviewed-on: http://review.couchbase.org/8920
    Tested-by: Jens Alfke <jens@couchbase.com>
    Reviewed-by: Jens Alfke <jens@couchbase.com>
Commits on Aug 11, 2011
  1. Aaron Miller

    Restart couch when iOS app returns from background

    apage43 authored
    Change-Id: I980e33afe73ad529cd0743d3bb54754af9842bc9
    Reviewed-on: http://review.couchbase.org/8810
    Reviewed-by: Jens Alfke <jens@couchbase.com>
    Reviewed-by: Chris Anderson <jchris@couchbase.com>
    Tested-by: Chris Anderson <jchris@couchbase.com>
Commits on Jul 27, 2011
  1. Aaron Miller
  2. Aaron Miller
Commits on Jul 25, 2011
  1. Aaron Miller
Commits on Jul 23, 2011
  1. Chris Anderson

    cleanup the updater

    jchris authored
  2. Chris Anderson
  3. Chris Anderson

    Revert "Deal with spaces in the path name."

    jchris authored
    This reverts commit 8449922.
  4. Paul J. Davis Chris Anderson

    Integrate Emonk into CouchDB.

    davisp authored jchris committed
    A flat merge based on work originally done by Paul Davis at http://github.com/davisp/couchdb/tree/emonk
Commits on Jul 19, 2011
  1. Filipe Manana Aliaksey Kandratsenka (aka Aliaksei Kandratsenka)

    Delegate error message formatting

    fdmanana authored alk committed
    Let couch_httpd:error_info assemble a meaningful error
    message (and log it) when opening a database fails.
    
    Change-Id: I4e23d63b5440da36b08de39e5a894fcf422d6957
    Reviewed-on: http://review.couchbase.org/8138
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Commits on Jul 16, 2011
  1. Filipe Manana Aliaksey Kandratsenka (aka Aliaksei Kandratsenka)

    Avoid gen_server call timeouts under heavy load

    fdmanana authored alk committed
    When merging 1024 local database views for e.g., we frequently
    get timeouts when calling OS gen_server processes. These
    gen_server calls are using the default of 5 seconds, which is
    not enough when the system is under heavy load.
    
    Change-Id: I35762960eb96cc0c2e62f4d59b4ad145a123a756
    Reviewed-on: http://review.couchbase.org/8052
    Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
    Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
  2. Filipe Manana Aliaksey Kandratsenka (aka Aliaksei Kandratsenka)

    Improve view merger error handling

    fdmanana authored alk committed
    couch_db:open_doc famility of functions doesn't return
    {error, Error} tuples, but instead other tuples such as
    {not_found, missing} for example. Just throw return values
    other than {ok, Doc} and let couch_httpd:error_info convert
    the tuples to meaningful error messages (and log them).
    Same applies when opening a remote document, we get a JSON
    object with "error" and "reason" fields, so just use them
    as {Error, Reason}, throw it, and less couch_httpd:info/1
    do a better job about assembling an meaningful error message
    and log it.
    
    Change-Id: I80b1bc9b8306f6a6686734e70089ffd1bca8ea24
    Reviewed-on: http://review.couchbase.org/8051
    Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
    Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
  3. Bin Cui

    Upgrade to icu4c-4.4.2 for windows build

    bcui6611 authored
    Change-Id: I0c053d1933263ae6df4bbc832a60bb31c5a5ac7f
    Reviewed-on: http://review.couchbase.org/8050
    Reviewed-by: Bin Cui <bin.cui@gmail.com>
    Tested-by: Bin Cui <bin.cui@gmail.com>
  4. Filipe Manana

    Support _all_docs merging

    fdmanana authored Dale Harvey committed
    The view merger now allows for merging _all_docs from
    several local and remote databases, as well as chained
    merging.
    
    $ curl -H 'Content-Type: application/json' -X POST \
                http://localhost:5984/_view_merge \
                -d '{"views": {
                        "test_db_a": "_all_docs",
                        "http://nodeB:5984/_view_merge": {
                            "views": {
                                "test_db_b": "_all_docs",
                                "test_db_c": "_all_docs"
                            }
                        }
                    }}'
    
    Change-Id: Iff55ef9395bb3d054c61fbf2f2f8bcc2cd90dc4d
    Reviewed-on: http://review.couchbase.org/7909
    Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
    Tested-by: Dale Harvey <daleharvey@arandomurl.com>
Commits on Jul 11, 2011
  1. Aliaksey Kandratsenka (aka Aliaksei Kandratsenka)

    made external reuse of http view merge possible

    alk authored Dale Harvey committed
    Change-Id: I1a2ea49a4cb252441ae8de316c06147d4d57aa94
    Reviewed-on: http://review.couchbase.org/7752
    Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
    Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
    Tested-by: Dale Harvey <daleharvey@arandomurl.com>
Commits on Jul 10, 2011
  1. Filipe Manana Aliaksey Kandratsenka (aka Aliaksei Kandratsenka)

    Add view merging feature

    fdmanana authored alk committed
    This feature allows for merging view streams from several
    local and remote databases.
    
    For map views, the source databases do not need to have
    the same map function code, that is, we can merge arbitry
    map-only views.
    
    For reduce views however, all the source databases must have
    exactly the same reduce function code.
    This is a necessary restriction due to the rereduce
    operations that might be needed during the merge phase.
    However, it a "rereduce" parameter is supplied, which is
    a string encoding a rereduce function, it's possible to
    combine/merge arbitrary reduce views. Bear in mind however
    that combining values originated by different reduce functions
    can yield unexpected results sometimes. The optional parameter
    "language" can also be supplied, which tells the server in
    which language the rereduce function is written (defaults to
    "javascript" if ommitted).
    
    This feature is exposed via the URI /_view_merge/ and accepts
    all the query parameters that regular view URIs accept
    (except for ?update_seq=true, which is not yet implemented).
    
    E.g.
    
    $ curl -H 'Content-Type: application/json' -X POST \
            http://localhost:5984/_view_merge \
            -d '{"views": { \
                  "test_db_1": "test/mapview",
                  "http://myserver:5984/test_db_2": "test2/mapview2",
                  "test_db_3": "test3/mapview3"
                }}'
    
    {"total_rows":20,"rows":[
        {"id":"1","key":1,"value":"1"},
        {"id":"2","key":2,"value":"2"},
        {"id":"3","key":3,"value":"3"},
        {"id":"4","key":4,"value":"4"},
        {"id":"5","key":5,"value":"5"},
        {"id":"6","key":6,"value":"6"},
        {"id":"7","key":7,"value":"7"},
        {"id":"8","key":8,"value":"8"},
        {"id":"9","key":9,"value":"9"},
        {"id":"10","key":10,"value":"10"},
        {"id":"11","key":11,"value":"11"},
        {"id":"12","key":12,"value":"12"},
        {"id":"13","key":13,"value":"13"},
        {"id":"14","key":14,"value":"14"},
        {"id":"15","key":15,"value":"15"},
        {"id":"16","key":16,"value":"16"},
        {"id":"17","key":17,"value":"17"},
        {"id":"18","key":18,"value":"18"},
        {"id":"19","key":19,"value":"19"},
        {"id":"20","key":20,"value":"20"}
    ]}
    
    The HTTP GET verb is also supported (query with ?views=encoded_json_object).
    
    The view merging spec object can also describe a chained view merging
    strategy, allowing for a multi level tree structured view merging.
    This specification is done by nesting view spec objects inside view spec
    objects. Example:
    
    {
        "views": {
             "test_db_a": "test/redview1",
             "http://serverB:5984/_view_merge": {
                  "views": {
                       "test_db_b": "test/redview2",
                       "http://foobar:5985/test_db_c": "test/redview3"
                  }
             }
        }
    }
    
    There's also support for a policy about what to do when streaming
    from a remote server fails. This policy is specified the query
    parameter "on_error" which can have 2 possible values:
    "continue" or "stop".
    
    "continue" means that if streaming from a remote server fails (whether
    at the beginning or in the middle), we continue feeding the client with
    view results from the other souces and add a JSON view row which
    indicates there was an error streaming from that particular source,
    example:
    
    {"total_rows":50,"rows":[
    	{"id":"1","key":1,"value":"1"},
    	{"id":"2","key":2,"value":"2"},
    	{"id":"3","key":3,"value":"3"},
    	{"id":"4","key":4,"value":"4"},
    	{"error": true, "from": "http://myserver:5984/mydb",
    		"reason": "timeout"}
    	{"id":"6","key":6,"value":"6"},
    	(....)
    ]}
    
    The "stop" policy means that when we get an error while streaming from
    a remote server we stop the view merging process and the last row sent
    to the client is an error signaling row like the one given in the
    previous example.
    
    There's also a parameter "connection_timeout" (value in milliseconds)
    that can be specified per /_view_merge/ request. It defaults to 10s.
    
    Change-Id: I49c06fae8198a7e9d32bc4f62a0037866e8c17a2
    Reviewed-on: http://review.couchbase.org/7655
    Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
    Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Something went wrong with that request. Please try again.