Permalink
Commits on Oct 24, 2016
  1. MB-21303 Handle race between stream addition and updater exit

    DocLoader sub-process adds dcp stream for a vbucket.
    Streams are added into active streams list after a response is
    received from dcp producer. If updater exits before the stream
    is added into active list, there is no way of closing this stream
    until updater is stopped in subsequent iteration, which could
    potentially result in not acknowledgeing any stream events for
    this vbucket.
    
    This patch avoids race by monitoring the DocLoader process and
    removes the streams whenevr the process terminates or the stream
    is explicitly closed.
    
    Change-Id: I9cf738460dbba8d6adf529764e816e2c5981484c
    Reviewed-on: http://review.couchbase.org/68808
    Tested-by: Harsha H S <hhs.couchbase@gmail.com>
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    aartamonau committed with hsharsha Oct 23, 2016
Commits on Oct 21, 2016
  1. MB-21303 Address leak in stream_info queue

    In the error condition of add_stream, stream_info
    queue entry was not flushed out which resulted in leak.
    
    Change-Id: Ia499ea3d2c1f10b8dc990a8695dd7e4475354853
    Reviewed-on: http://review.couchbase.org/68565
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    hsharsha committed with hsharsha Oct 11, 2016
Commits on Oct 17, 2016
  1. MB-21303 Handle ack from dcp producer for control_request correctly

    control_request for flow control buffer size is added into the
    pending request dictionary with nil as SendTo parameter as
    gen_server need not reply when it gets response from producer.
    This was not handled correctly when stream_response is handled
    in the client which is fixed in this patch.
    
    Change-Id: I7afb11adbde79fe2ee0895feac8fec91d563a062
    Reviewed-on: http://review.couchbase.org/68525
    Reviewed-by: Dave Rigby <daver@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Tested-by: Abhishek Singh <abhishek@couchbase.com>
    Tested-by: buildbot <build@couchbase.com>
    hsharsha committed with hsharsha Oct 10, 2016
Commits on Jun 30, 2016
  1. MB-16737 Set default timeout late

    The default timeout for internal scatter requests is 60s. It can be changed
    with the `connection_timeout` query parameter. For future changes it's needed
    to be able to distinguish the `connection_timeout` parameter being set at
    query time or not.
    
    Hence set the default value to `nil` and set it to the default value of
    60 seconds as late as possible.
    
    Change-Id: I45e7a2b07d27abb656150492e3a11985b77f901e
    Reviewed-on: http://review.couchbase.org/64651
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    vmx committed with vmx Jun 1, 2016
Commits on Jun 22, 2016
  1. Remove the `Timeout` variable which isn't used

    Change-Id: I50d1e8755de7986ae6a724540cc9e57856b0df11
    Reviewed-on: http://review.couchbase.org/64650
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    vmx committed with vmx Jun 1, 2016
Commits on Jun 13, 2016
  1. MB-19783 Use barrier to prevent exit of long running task

    There is a potential race in which terminator thread decides to
    terminate map reduce context and gets switched out of context.
    In the meantime map reduce task is finished normally and the same
    context is reused to perform map reduce for subsequent mutations.
    Now terminator thread will potentially terminate this new task,
    when it is scheduled back to run.
    This is avoided by using mutex in which either terminator thread,
    if successful will terminate long running map reduce task or the
    task is terminated normally.
    
    Change-Id: I6785a4f12155eab637e924290889284050e13888
    Reviewed-on: http://review.couchbase.org/64604
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Dave Finlay <dave.finlay@couchbase.com>
    Reviewed-by: Dave Rigby <daver@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    hsharsha committed with hsharsha May 31, 2016
Commits on May 30, 2016
  1. Enable asserts in release builds

    Change-Id: I70a6a4afb1eaada643e9a70d33b43d5912f81d6b
    Reviewed-on: http://review.couchbase.org/64101
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    hsharsha committed with hsharsha May 17, 2016
Commits on May 19, 2016
  1. Reference expected and received ddoc revision appropriately

    Change-Id: I12c4a22da7b98f3e8e6574579465532c849948ee
    Reviewed-on: http://review.couchbase.org/63923
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    abhi-bit committed May 11, 2016
Commits on May 17, 2016
  1. MB-16712 Stop group synchronously after master db deletion

    When the master database that contains the design documents is deleted,
    the corresponding view group is also stopped/removed.
    
    Previously that view group deletion was asynchronous. That lead to issues
    when the master database was deleted, but shortly afterwards recreated. If
    the view group didn't terminate fast enough (which was the case for the
    spatial views in the travel sample), calls to the view group ended up in
    the old group, instead of the newly created one.
    
    We now make a synchronous call to remove the group after the master deletion,
    to make sure the group got shutdown properly before any further requests
    can be initiated.
    
    Change-Id: Ib91b7000b31d9111b0cedf093de8e05c61956c1b
    Reviewed-on: http://review.couchbase.org/64029
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    vmx committed with vmx May 13, 2016
Commits on May 11, 2016
  1. MB-19502 Catch exceptions from jsonStringify function

    Reduce and emit functions did not handle exceptions thrown from
    jsonStringify, which resulted in bringing down of couchdb VM.
    This fix catches these exceptions and returns gracefully.
    
    Change-Id: I7455fe9f33d7f70e5cc9946bd59a8ece1c518633
    Reviewed-on: http://review.couchbase.org/63707
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    hsharsha committed with hsharsha May 4, 2016
  2. MB-19378 Handle memory leaks in context initialization

    Memory allocated dynamically was not freed in the catch clause,
    when exceptions happened. Also release resource if
    initialization fails.
    
    Change-Id: I4233a5104a03805beda09291f9a346f60379fdbb
    Reviewed-on: http://review.couchbase.org/63412
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    hsharsha committed with hsharsha Apr 27, 2016
  3. MB-19377 Handle collisions in context hash map

    Mapreduce contexts were stored in hash table and key was provided
    by erlang process to NIF using phash2 routine which is not
    collision resistent. This fix usues context address as key to
    avoid collision.
    
    Change-Id: I31defc4b1926022c9e649b8e2c7e11a8f4a56195
    Reviewed-on: http://review.couchbase.org/63318
    Reviewed-by: Dave Rigby <daver@couchbase.com>
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    hsharsha committed with hsharsha Apr 25, 2016
Commits on Apr 29, 2016
  1. Merge remote-tracking branch 'couchbase/watson' into master

    * couchbase/watson:
      MB-18985 Use platform APIs for thread creation and synchronization
      Increase DCP connection timeout for unit tests
    
    Change-Id: I4415f19c5b0b78c543a47c28e01451b18968ff7a
    vmx committed Apr 29, 2016
Commits on Apr 28, 2016
  1. MB-18985 Use platform APIs for thread creation and synchronization

    Platform APIs are compatible with NIF APIs for thread creation
    and synchronization. So mapreduce NIF uses platform APIs instead
    of C++11 primitivies to be compatible with NIF APIs.
    
    On Windows, mixing C++11 primitives with NIF APIs resulted in improper
    shutdown of erl.exe application in the unit tests which resulted in
    error popups at the exit of every unit test run.
    
    Change-Id: I002510632673ccbaee76f4f71b89526f00271dcd
    Reviewed-on: http://review.couchbase.org/63406
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    Reviewed-by: Dave Rigby <daver@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Tested-by: Harsha H S <hhs.couchbase@gmail.com>
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    hsharsha committed with hsharsha Apr 22, 2016
Commits on Apr 27, 2016
  1. Increase DCP connection timeout for unit tests

    The build slaves can be slow, hence set the DCP connection timeout
    high enough to prevent sporadic failures.
    
    Change-Id: I611da567980293d525dbc9ce44db929ef73b6e4c
    Reviewed-on: http://review.couchbase.org/63403
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Tested-by: Abhishek Singh <abhishek@couchbase.com>
    Tested-by: buildbot <build@couchbase.com>
    vmx committed with vmx Apr 27, 2016
Commits on Apr 21, 2016
  1. Merge remote-tracking branch 'remotes/couchbase/watson' into master

    * remotes/couchbase/watson:
      MB-19245 Don't use fresh view group header
    
    Change-Id: Ie37ee0b93cae7054df1d1626e08e0ef550035cb8
    vmx committed Apr 21, 2016
  2. Merge remote-tracking branch 'remotes/couchbase/sherlock' into watson

    * remotes/origin/sherlock:
      MB-19245 Don't use fresh view group header
    
    Change-Id: Ibd01aeb820fe2e9e64f53bd3b5b506f71ea79dc5
    vmx committed Apr 21, 2016
  3. Fix log message formatting

    A log message was spanning to lines like:
    
        [info] [<0.518.0>] Updater for main set view group `_design/test`, set `couch_test_dcp_rollback` (prod), read a total
                      of 320 changes and doc_fields_used
    
    This changes it back to a single line:
    
        [info] [<0.286.0>] Updater for main set view group `_design/test`, set `couch_test_dcp_rollback` (prod), read a total of 255 changes and doc_fields_used
    
    Change-Id: I29883fa0e232cd59454982eb3897695068a0a5f4
    Reviewed-on: http://review.couchbase.org/63086
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    Tested-by: buildbot <build@couchbase.com>
    vmx committed with vmx Apr 20, 2016
  4. Merge remote-tracking branch 'remotes/couchbase/3.x' into sherlock

    * remotes/origin/3.x:
      MB-19245 Don't use fresh view group header
    
    Change-Id: I09cf078ff5a4f3f18e6578ed24d1bc3588b36ae8
    vmx committed Apr 21, 2016
  5. MB-19245 Don't use fresh view group header

    A fresh view group header was used instead of an updated one.
    
    Change-Id: I25a44f05099b6d809617b9910724e625db46be61
    Reviewed-on: http://review.couchbase.org/62950
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    Tested-by: Volker Mische <volker.mische@gmail.com>
    vmx committed with vmx Apr 18, 2016
Commits on Apr 20, 2016
  1. MB-18124: [Unit test] - Simulating index build post rollback

    Unit test does initial index build post rollback to sequence
    number 0 from mock dcp_server
    
    Change-Id: I57302e0affd0847b2a8b30c459a904cd3ee3fee3
    Reviewed-on: http://review.couchbase.org/60369
    Tested-by: Volker Mische <volker.mische@gmail.com>
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    abhi-bit committed Feb 23, 2016
Commits on Apr 19, 2016
  1. MB-8512 Unit test for optimizing document loads

    Change-Id: I975e96a617e13dabe559a1b02354857bddeaf53e
    Reviewed-on: http://review.couchbase.org/60921
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    Tested-by: buildbot <build@couchbase.com>
    hsharsha committed with hsharsha Apr 9, 2016
  2. MB-8512 Do not load doc when document fields are not indexed

    If document is not used by all the view functions defined in design doc, we
    can optimize by not loading documents during indexing.
    esprima and unused java script are used to detect if javascript map
    function uses document in its function body. If none of the views
    defined on design doc does not index document fields in their map function,
    then we prevent loading of documents for that design document during
    updater runs. This helps with sync gateway views.
    
    Change-Id: Ic3d50185cb2a5d13b29a2e43290e51b663cebf8c
    Reviewed-on: http://review.couchbase.org/54777
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    Tested-by: buildbot <build@couchbase.com>
    hsharsha committed with hsharsha Apr 9, 2016
  3. MB-8512 Add helper code and generate raw string header of js code

    Helper java script code is added which returns if the document
    (first parameter) of map function is used or not.
    All the related JavaScript code is embedded as a raw string
    which is included in relevant V8 code.
    
    Change-Id: Iba4861a5fd0cbd3950b2f2ed33f71f7985908ec5
    Reviewed-on: http://review.couchbase.org/60709
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    Tested-by: buildbot <build@couchbase.com>
    hsharsha committed with hsharsha Apr 9, 2016
  4. MB-8512 Modify unused code to return AST along with unused variables

    Change-Id: Ib6ed1c00bdbd6ed6ae03565aa369b9569f6ef435
    Reviewed-on: http://review.couchbase.org/60707
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    hsharsha committed with hsharsha Apr 9, 2016
  5. MB-8512 Latest stable vanilla code for esprima and unused

    Esprima is tool to generate AST for ECMA Script a.k.a JavaScript
    Source: https://raw.githubusercontent.com/jquery/esprima/2.7/esprima.js
    Git SHA: eb05a03b18b8433ab1ebeabea635a949219cd75e
    License: BSD
    
    Unused is a node module that uses esprima to detect unused variables
    in the JavaScript code.
    Source: https://raw.githubusercontent.com/Kami/node-unused/master/lib/context.js
            https://raw.githubusercontent.com/Kami/node-unused/master/index.js
    Git SHA: ff619df98dfb112ed2b69dad0ed94ab0227e6191
    License: Apache
    
    Change-Id: I8225162d9701386f38a73a099e5b4a7330b36804
    Reviewed-on: http://review.couchbase.org/60706
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    hsharsha committed with hsharsha Apr 9, 2016
  6. MB-18268 - Add newline at the end of query stats response

    cbcollect_info query stats dump would be inconvenient to
    parse using nutshell without newline.
    
    Change-Id: I17ce6524d8706788fcf5b1647c93606668873fef
    Reviewed-on: http://review.couchbase.org/62545
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    Tested-by: buildbot <build@couchbase.com>
    abhi-bit committed Apr 7, 2016
Commits on Apr 7, 2016
  1. MB-19031 Handle race in updating terminator timeout

    Change-Id: I8f819e9673bcff7e6fd0b3971a1f191dd43c38ba
    Reviewed-on: http://review.couchbase.org/62489
    Reviewed-by: Dave Rigby <daver@couchbase.com>
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    Tested-by: Harsha H S <hhs.couchbase@gmail.com>
    hsharsha committed with hsharsha Apr 6, 2016
  2. Store mapreduce contexts in ets table

    Store the map and reduce contexts in ets table with design doc
    signature as key. This prevent unnecessary triggering of context
    creation during every udpater or query run.
    
    Change-Id: I939e75c9689d41c806a34d77f93f69a3ab7a5ff5
    Reviewed-on: http://review.couchbase.org/61748
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    Tested-by: Harsha H S <hhs.couchbase@gmail.com>
    hsharsha committed with hsharsha Mar 19, 2016
  3. MB-18268 - Add newline at the end of query stats response

    cbcollect_info query stats dump would be inconvenient to
    parse using nutshell without newline.
    
    Change-Id: Ief143f85d8931c8246ead9a070bb6880f858673d
    Reviewed-on: http://review.couchbase.org/62534
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Tested-by: Abhishek Singh <abhishek@couchbase.com>
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    abhi-bit committed Apr 7, 2016
Commits on Apr 1, 2016
  1. MB-17567 Add startup snapshot for builtin JavaScript functions

    Change-Id: I83a75f8d91870d39bfee6a7baae53ba6266f4d17
    Reviewed-on: http://review.couchbase.org/62052
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    Tested-by: buildbot <build@couchbase.com>
    hsharsha committed with hsharsha Mar 28, 2016
Commits on Mar 23, 2016
  1. MB-18268 - Adding timing stats for view queries

    Exposing view query timing stats over _get_query_stats endpoint
    
    Sample example:
    
    curl http://10.142.200.101:9500/_set_view/default/_design/ddoc1/_get_query_stats -s | python -m json.tool
    {
        "query_timing_in_ms": {
            "_design/ddoc1": {
                "view1": {
                    "1": 0,
                    "10": 16,
                    "100": 0,
                    "1000": 0,
                    "10000": 0,
                    "100000": 0
                },
                "view2": {
                    "1": 0,
                    "10": 14,
                    "100": 0,
                    "1000": 0,
                    "10000": 0,
                    "100000": 0
                }
            }
        }
    }
    
    Change-Id: I6d1260c9b4d7146f0365862a9be797001e9d7db0
    Reviewed-on: http://review.couchbase.org/60499
    Reviewed-by: Volker Mische <volker.mische@gmail.com>
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    Tested-by: Abhishek Singh <abhishek@couchbase.com>
    abhi-bit committed with abhi-bit Feb 25, 2016
Commits on Mar 14, 2016
  1. CBD-1453: Rebuild when header files change

    Whenever an Erlang header file changes, rebuild the corresponding
    Erlang files. This isn't an automated process, but you need to pass
    in the header files a project should depend on manually. For simplicity
    sometimes more headers are use than strictly needed. We rather rebuild
    more than having a broken incremental build.
    
    Change-Id: Iae6d0a9043ed1b74f2c104d9b251f45715ac04fd
    Reviewed-on: http://review.couchbase.org/61152
    Tested-by: buildbot <build@couchbase.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    vmx committed with vmx Mar 9, 2016
  2. MB-17420 Don't use GLOB to find source/test files

    Instead of using globbing, it's better to name the files
    explicitely. That way incremental builds work.
    
    Change-Id: I1b47c61b0f524e5576d4111075516d923f039a6f
    Reviewed-on: http://review.couchbase.org/60856
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Tested-by: buildbot <build@couchbase.com>
    vmx committed with vmx Mar 3, 2016
Commits on Mar 7, 2016
  1. MB-16618 Sort keys the expected way

    When a mapreduce query is using the `keys` parameter, you would expect
    the result sorted the same way as the supplied keys. This wasn't the
    case, but it is now.
    
    Change-Id: I75cab77a44eb4cdc26a98118c6abca5a1635bd62
    Reviewed-on: http://review.couchbase.org/60121
    Reviewed-by: Harsha H S <hhs.couchbase@gmail.com>
    Reviewed-by: Abhishek Singh <abhishek@couchbase.com>
    Tested-by: buildbot <build@couchbase.com>
    vmx committed with vmx Feb 17, 2016