couchdb-couch-mrview.git
21 months agoMerge remote branch 'cloudant:fix-unused-variable-warning' master
Eric Avdey [Fri, 31 Mar 2017 14:10:32 +0000 (11:10 -0300)] 
Merge remote branch 'cloudant:fix-unused-variable-warning'

This closes #73

Signed-off-by: Eric Avdey <eiri@eiri.ca>
21 months agoFix unused variables warning 73/head
Eric Avdey [Fri, 31 Mar 2017 13:56:03 +0000 (10:56 -0300)] 
Fix unused variables warning

This cleans up the artifacts left after
refactoring of `couch_mrview_index:get/2`

21 months agoFix unit tests in couch_mrview_compactor
Paul J. Davis [Wed, 8 Feb 2017 18:11:47 +0000 (12:11 -0600)] 
Fix unit tests in couch_mrview_compactor

This fixes the two tests that are in couch_mrview_compactor.erl. For
some reason they don't always run in CI or even for local `make check`
runs. However when they do run they fail as they don't account for how
couch_index_updater:update/3 works and don't start couch_log.

The theory for why these don't always run is related to how meck loads
modules. I'm told that these should probably be moved to
test/couch_mrview_compactor_tests.erl but then that would remove access
to the recompact/1 function. For now I'll leave them here I guess and if
they do ever run they'll not break the build now.

22 months agoMerge remote-tracking branch 'cloudant/undef-lacc-list-function'
Benjamin Bastian [Thu, 16 Mar 2017 17:18:03 +0000 (10:18 -0700)] 
Merge remote-tracking branch 'cloudant/undef-lacc-list-function'

22 months agoAdd send_list_row test suite 70/head
Jay Doane [Thu, 16 Mar 2017 06:01:28 +0000 (23:01 -0700)] 
Add send_list_row test suite

22 months agoMerge branch 'couchdb-2992'
Nick Vatamaniuc [Thu, 16 Mar 2017 02:48:49 +0000 (22:48 -0400)] 
Merge branch 'couchdb-2992'

Closes #69

22 months agoAllow limiting maximum document body size 69/head
Nick Vatamaniuc [Wed, 15 Mar 2017 21:55:22 +0000 (17:55 -0400)] 
Allow limiting maximum document body size

This is a companion commit to this one:

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

COUCHDB-2992

22 months agoFix undef error on empty list function response undef-lacc-list-function 68/head
Benjamin Bastian [Fri, 10 Mar 2017 02:20:25 +0000 (18:20 -0800)] 
Fix undef error on empty list function response

Prior to this commit, if a list function did not return any data or
returned an error, it would return a #lacc{} record from list_cb/2
rather than a valid #mochiweb_response{} record. This would cause chttpd
to crash. This commit fixes this bug by always returning a valid
record.

23 months agoMerge remote branch 'cloudant:refactor-mrview-index-get'
Eric Avdey [Thu, 9 Feb 2017 13:57:22 +0000 (09:57 -0400)] 
Merge remote branch 'cloudant:refactor-mrview-index-get'

This closes #65

Signed-off-by: Eric Avdey <eiri@eiri.ca>
23 months agoRe-use get update_options in get(info) 65/head
Eric Avdey [Wed, 8 Feb 2017 18:05:37 +0000 (14:05 -0400)] 
Re-use get update_options in get(info)

23 months agoRefactor mrview_index get
Eric Avdey [Tue, 7 Feb 2017 14:39:46 +0000 (10:39 -0400)] 
Refactor mrview_index get

This is a simple refactoring of mrview's
get function that uses function's pattern
matching instead of staircase case.

Arguably this makes code easier to read
and more idiomatic.

2 years agoMerge remote branch 'cloudant:77867-convert-pid-to-binary'
ILYA Khlopotov [Fri, 2 Dec 2016 15:52:16 +0000 (07:52 -0800)] 
Merge remote branch 'cloudant:77867-convert-pid-to-binary'

This closes #63

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
2 years agoConvert pid of indexer to binary 63/head
ILYA Khlopotov [Fri, 2 Dec 2016 00:51:46 +0000 (16:51 -0800)] 
Convert pid of indexer to binary

This is a fixup for https://github.com/apache/couchdb-couch-mrview/pull/62
Properties passed to couch_task_status:add_task cannot contain complex
types. Because the status need to be representable in JSON.

2 years agoMerge remote branch 'cloudant:make-accumulate_more-pure'
Eric Avdey [Tue, 22 Nov 2016 14:42:43 +0000 (10:42 -0400)] 
Merge remote branch 'cloudant:make-accumulate_more-pure'

This closes #61

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoRemove side effect from accumulate_more 61/head
Eric Avdey [Fri, 18 Nov 2016 19:04:32 +0000 (15:04 -0400)] 
Remove side effect from accumulate_more

2 years agoMerge remote branch 'cloudant:77867-add-indexer-pid-to-task-status'
ILYA Khlopotov [Fri, 18 Nov 2016 22:56:27 +0000 (14:56 -0800)] 
Merge remote branch 'cloudant:77867-add-indexer-pid-to-task-status'

This closes #62

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
2 years agoAdd reference to indexer Pid to task status 62/head
ILYA Khlopotov [Fri, 18 Nov 2016 22:19:11 +0000 (14:19 -0800)] 
Add reference to indexer Pid to task status

When we run re-compaction stage we start second index updater from
view compactor. In this case couch_task_status:all would return two
identical entries for the same `design_document` and `shard`. Which is
very confusing. Add reference to indexer Pid to disambiguate them.
For the recompaction case the indexer_pid will be pointing to compaction task.

2 years agoMerge remote branch 'cloudant:improve-exceeded_recompact_retry_count-error-message'
ILYA Khlopotov [Wed, 2 Nov 2016 23:53:15 +0000 (16:53 -0700)] 
Merge remote branch 'cloudant:improve-exceeded_recompact_retry_count-error-message'

This closes #59

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
2 years agoexceeded_recompact_retry_count: add DbName/IdxName 59/head
ILYA Khlopotov [Wed, 2 Nov 2016 23:44:22 +0000 (16:44 -0700)] 
exceeded_recompact_retry_count: add DbName/IdxName

2 years agoMerge remote-tracking branch 'cloudant/3184-retry-recompact-failure'
Paul J. Davis [Thu, 20 Oct 2016 16:45:35 +0000 (11:45 -0500)] 
Merge remote-tracking branch 'cloudant/3184-retry-recompact-failure'

2 years agoImplement recompact unit tests 58/head
Jay Doane [Sun, 16 Oct 2016 02:28:35 +0000 (19:28 -0700)] 
Implement recompact unit tests

2 years agoUpdate with couch_index_updater:update/3
Jay Doane [Mon, 10 Oct 2016 20:19:56 +0000 (13:19 -0700)] 
Update with couch_index_updater:update/3

Handle '$gen_cast' messages in receive

2 years agoRetry failures in couch_mrview_compactor:recompact
Jay Doane [Fri, 7 Oct 2016 20:04:13 +0000 (13:04 -0700)] 
Retry failures in couch_mrview_compactor:recompact

Currently, if there's an error in the spawned couch_index_updater:update
process, the receive block will not match the message, and the calling
process will block forever.

This commit changes the receive pattern to match both successful updates
as well as errors, logging the errors, and retrying the recompact a
configurable number of times. If the configured retry count is exceeded,
it logs an error, and returns the original state.

COUCHDB-3184

2 years agoMerge remote-tracking branch 'banjiewen/stale-stable-update'
Robert Newson [Thu, 6 Oct 2016 18:02:23 +0000 (19:02 +0100)] 
Merge remote-tracking branch 'banjiewen/stale-stable-update'

2 years agoMerge remote-tracking branch 'cloudant/COUCHDB-3150-add-new-function-to-get-view...
Paul J. Davis [Wed, 28 Sep 2016 17:25:46 +0000 (12:25 -0500)] 
Merge remote-tracking branch 'cloudant/COUCHDB-3150-add-new-function-to-get-view-index-pid'

2 years agoAdd new function to get the view index pid. 57/head
brkolla [Wed, 21 Sep 2016 18:52:57 +0000 (14:52 -0400)] 
Add new function to get the view index pid.
Refactored the code to add a new function to return index pid for a
given view and design document.

COUCHDB-3150

2 years agodon't send undefined etag (COUCHDB-3134)
Robert Newson [Wed, 7 Sep 2016 13:04:23 +0000 (14:04 +0100)] 
don't send undefined etag (COUCHDB-3134)

2 years agoUse canonical case for ETag response header (COUCHDB-3134)
Robert Newson [Wed, 7 Sep 2016 11:54:35 +0000 (12:54 +0100)] 
Use canonical case for ETag response header (COUCHDB-3134)

2 years agoFix sorted=false for multi-query 55/head
Robert Newson [Thu, 25 Aug 2016 16:58:34 +0000 (17:58 +0100)] 
Fix sorted=false for multi-query

I've reordered view_cb for readability, moving all response starting
logic to the front, in order to simplify how meta and row messages are
handled

COUCHDB-3060

2 years agoRevert "Reset row_sent at end of query"
Robert Newson [Thu, 25 Aug 2016 15:01:47 +0000 (16:01 +0100)] 
Revert "Reset row_sent at end of query"

This is now handled at a higher level.

COUCHDB-3060

2 years agoIntroduce reset_vacc
Robert Newson [Thu, 25 Aug 2016 15:01:25 +0000 (16:01 +0100)] 
Introduce reset_vacc

COUCHDB-3060

2 years agoReset row_sent at end of query 54/head
Robert Newson [Thu, 25 Aug 2016 12:08:21 +0000 (13:08 +0100)] 
Reset row_sent at end of query

We need to reset row_sent to false at the end of the query so that we
will emit '{"rows":{' for the next query (if we're in a multi-query
request).

COUCHDB-3060

2 years agoWrap line
Robert Newson [Thu, 25 Aug 2016 11:47:49 +0000 (12:47 +0100)] 
Wrap line

whitespace-only change

COUCHDB-3060

2 years agoRemove outdated test
Paul J. Davis [Fri, 22 Jul 2016 22:34:03 +0000 (17:34 -0500)] 
Remove outdated test

The module load tests date all the way back to when I first learned
about etap from Nick Gerakines. In the age of meck these are even more
brittle as mocked modules can interfere with the `code:load_file/1`
depending on execution.

Also, given that we were missing almost half of the couch_mrview modules
we obviously don't keep these up to date so they're not serving any
purpose.

2 years agoReplace `stale` with `stable` and `update` 51/head
Benjamin Anderson [Sun, 17 Jul 2016 21:25:22 +0000 (14:25 -0700)] 
Replace `stale` with `stable` and `update`

The `stale` mechanism for view queries conflates two independent
concerns:

1. Whether or not the view results should be returned from a "stable"
   set of shards; i.e., mem3:ushards. This semantic is new in 2.0,
   having originated in Cloudant code in 2011[1].

2. Whether or not the view in question should be updated prior to
   responding to the user, i.e., the pre-2.0 semantics.

Both of these concerns represent consistency/availability tradeoffs, but
they're addressing rather different aspects of that continuum. As such,
the "stale" mechanism limits flexibility.

For example, it's quite likely that a user would want to retrieve
"stale" view responses from the fastest available shards - the
"available/available" choice - and this choice is not available with the
existing "stale" mechanism. A similar argument could be made for the
"consistent/consistent" choice.

This patch introduces two new view API keywords - "stable" and "update"
- to address concerns #1 and #2, respectively. The semantics of the
"stale" mechanism is implemented in terms of these new keywords.

COUCHDB-3063

[1]: apache/couchdb-fabric@93923fda51c714c015b8621e41f3c425bfb3e61a

2 years agoFix sorted=false feature 50/head
Robert Newson [Fri, 15 Jul 2016 10:53:16 +0000 (11:53 +0100)] 
Fix sorted=false feature

1. Enable the sorted=false parameter to map views
2. Enhance view_cb to tolerate rows before meta
3. Enhance view_cb to only send meta if no row has been sent

COUCHDB-3060

2 years agoMerge remote branch 'cloudant:2847-list_when_no_rows'
ILYA Khlopotov [Mon, 20 Jun 2016 16:22:06 +0000 (09:22 -0700)] 
Merge remote branch 'cloudant:2847-list_when_no_rows'

This closes #49

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoSend empty string from _list if no result 49/head
ILYA Khlopotov [Fri, 17 Jun 2016 23:09:50 +0000 (16:09 -0700)] 
Send empty string from _list if no result

There is a corner case when list function does not return any Chunk.
In this case we would want to return empty string to the client.

COUCHDB-2847

2 years agoMerge remote branch 'cloudant:make-decode-in-parse_params-optional'
Eric Avdey [Mon, 13 Jun 2016 18:49:28 +0000 (15:49 -0300)] 
Merge remote branch 'cloudant:make-decode-in-parse_params-optional'

This closes #48

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoAllow json decode in parse_params to be optional 48/head
Eric Avdey [Mon, 13 Jun 2016 16:28:17 +0000 (13:28 -0300)] 
Allow json decode in parse_params to be optional

This allows explicitly indicate if ifunction parse_params
should decode passed parameter's value instead of trying
to guess it by value's term type.

It makes it possible to use this function both with GET
and POST queries.

2 years agoMerge remote branch 'cloudant:fix-some-type-errors'
ILYA Khlopotov [Wed, 25 May 2016 12:52:09 +0000 (05:52 -0700)] 
Merge remote branch 'cloudant:fix-some-type-errors'

This closes #46

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agogen_event: handle_call suppose to return `{ok, Reply, State}` 46/head
ILYA Khlopotov [Wed, 25 May 2016 01:34:25 +0000 (18:34 -0700)] 
gen_event: handle_call suppose to return `{ok, Reply, State}`

2 years agoFix match of a result from couch_mrview_util:get_view
ILYA Khlopotov [Wed, 25 May 2016 01:33:29 +0000 (18:33 -0700)] 
Fix match of a result from couch_mrview_util:get_view

2 years agoMerge remote branch 'github/pr/44'
Eric Avdey [Thu, 28 Apr 2016 17:12:50 +0000 (14:12 -0300)] 
Merge remote branch 'github/pr/44'

This closes #44

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoUse couch_file:delete/3 in views cleanup 44/head
Eric Avdey [Wed, 20 Apr 2016 17:55:52 +0000 (14:55 -0300)] 
Use couch_file:delete/3 in views cleanup

2 years agoMerge remote branch 'cloudant:3005-configurable_queue_size'
ILYA Khlopotov [Thu, 28 Apr 2016 00:37:36 +0000 (17:37 -0700)] 
Merge remote branch 'cloudant:3005-configurable_queue_size'

This closes #45

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoMake view updater couch_work_queue configurable 45/head
ILYA Khlopotov [Tue, 26 Apr 2016 20:55:11 +0000 (13:55 -0700)] 
Make view updater couch_work_queue configurable

For performance reasons in some cases there is a need to put a cap
on a queue size.

COUCHDB-3005

2 years agoMerge remote branch 'cloudant:3002-use-ioq-for-view_updades'
ILYA Khlopotov [Mon, 25 Apr 2016 16:25:56 +0000 (09:25 -0700)] 
Merge remote branch 'cloudant:3002-use-ioq-for-view_updades'

This closes #43

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoUse ioq to separately prioritise view updates 43/head
ILYA Khlopotov [Thu, 21 Apr 2016 19:45:34 +0000 (12:45 -0700)] 
Use ioq to separately prioritise view updates

COUCHDB-3002

2 years agoRender update_seq if number or binary 42/head
Robert Newson [Sun, 17 Apr 2016 18:21:20 +0000 (19:21 +0100)] 
Render update_seq if number or binary

COUCHDB-2849

3 years agoRefactor to add an interface for view_state of #mrheader
Eric Avdey [Fri, 15 Jan 2016 20:12:55 +0000 (16:12 -0400)] 
Refactor to add an interface for view_state of #mrheader

The goal of this refactoring is to make it easier to understand
and maintain view_state data structure of #mrheader.

Unlike record #mrview in #mrst, the data structure that represents
view_states in #mrheader is a tuple (of tuples) and its definition
and application spreads across all couch_mrview_util.erl module.
This makes it hard to follow and understand how it used
or troubleshoot mrview in case of the problems.

This change introduces an interface for generation and accessing
view_state and also separates generation of reduction closures
from mrview's `reduce`, `reduce_to_count` and `fold_reduce` functions
as they rely on view_state's structure.

Note that this refactoring also  removes explicit set of generic
ordering function on collation option "raw" as it is a default
of couch_btree:open on missing option for `less` function.

3 years agoRemove duplicated monitor set on index opening 37/head
Eric Avdey [Fri, 8 Jan 2016 19:24:57 +0000 (15:24 -0400)] 
Remove duplicated monitor set on index opening

When mrview index is opening it adds monitor on couch_file server
of the index file. This is not necessary because couch_mrview_util's
init_state called before already does that, so we are ending up
with duplicated monitor reference.

3 years agoAccept rewrites as string function 36/head
Alexander Shorin [Tue, 10 Nov 2015 17:55:02 +0000 (20:55 +0300)] 
Accept rewrites as string function

COUCHDB-2874

3 years agoRewrite ddoc validation routines
Alexander Shorin [Tue, 10 Nov 2015 17:44:25 +0000 (20:44 +0300)] 
Rewrite ddoc validation routines

While it solve the own problem well, it contains few design issues that
makes unable to keep it for further updates:
1. It's type-centric validation. However, our ddocs have quite complex
structure and validation logic, so it eventually have to write special
clause for most of the validated fields turning it into field-centric.
2. It mixes logic of type checking and relation checking.

Here we turn it into rule based validation where each rule is a path of
field-type pairs while all relation checks are moved into own functions.

Moreover, we can now exactly say the path for the field that caused
issues.

3 years agoReduce duplicated code 34/head
Alexander Shorin [Thu, 22 Oct 2015 20:22:58 +0000 (23:22 +0300)] 
Reduce duplicated code

3 years agoMerge default update response headers with custom ones
Alexander Shorin [Thu, 22 Oct 2015 20:21:17 +0000 (23:21 +0300)] 
Merge default update response headers with custom ones

COUCHDB-1447

3 years agoDon't set ETag header with value `undefined` 35/head
Klaus Trainer [Wed, 4 Nov 2015 22:53:36 +0000 (23:53 +0100)] 
Don't set ETag header with value `undefined`

COUCHDB-2650

3 years agoCheck POST requests for valid json header
Mayya Sharipova [Wed, 2 Sep 2015 20:14:51 +0000 (16:14 -0400)] 
Check POST requests for valid json header

validate that all POST requests with json body must have also have valid
json header: {"Content-Type": "application/json"}
This ensures a basic protection against CSRF

This closes #25

JIRA: COUCHDB-2775

Signed-off-by: Alexander Shorin <kxepal@apache.org>
3 years agoUse couch_server:delete_file on view cleanup 33/head
ILYA Khlopotov [Tue, 6 Oct 2015 15:08:17 +0000 (08:08 -0700)] 
Use couch_server:delete_file on view cleanup

3 years agoUpdate .travis
Alexander Shorin [Thu, 1 Oct 2015 16:45:07 +0000 (19:45 +0300)] 
Update .travis

3 years agoFix http eunit test 32/head
Nick Vatamaniuc [Mon, 28 Sep 2015 14:31:55 +0000 (10:31 -0400)] 
Fix http eunit test

 COUCHDB-2824

3 years agoMerge remote-tracking branch 'github/pr/29'
Alexander Shorin [Fri, 25 Sep 2015 18:14:42 +0000 (21:14 +0300)] 
Merge remote-tracking branch 'github/pr/29'

3 years agoImprove validation of group and group_level view parameters. 29/head
Nick Vatamaniuc [Fri, 25 Sep 2015 17:44:10 +0000 (13:44 -0400)] 
Improve validation of group and group_level view parameters.

Jira: COUCH-2824

Parameters group and group_level currently were
overriding each other such that last one in the list "won".

Currently behavior has changed such that :

  * group_level overrides group parameter if both are set
  * but if group=false and group_level>0, throw 400

That happens regardless of the order of those arguments, or
how many times each one was specified in the parameter list.

3 years agoMerge remote-tracking branch 'cloudant/2825-crypto-deprecations'
Robert Newson [Fri, 25 Sep 2015 11:07:55 +0000 (12:07 +0100)] 
Merge remote-tracking branch 'cloudant/2825-crypto-deprecations'

3 years agoFix validation of query design documents 30/head
Nick Vatamaniuc [Thu, 24 Sep 2015 15:07:25 +0000 (11:07 -0400)] 
Fix validation of query design documents

Jira: COUCHDB-2818

If language is "query" then map functions will be objects.

3 years agoFix crypto deprecations 31/head
Robert Newson [Wed, 23 Sep 2015 18:32:08 +0000 (19:32 +0100)] 
Fix crypto deprecations

COUCHDB-2825

3 years agofix unused variable warning
Robert Newson [Mon, 21 Sep 2015 18:54:48 +0000 (19:54 +0100)] 
fix unused variable warning

3 years agoImprove design document validation 28/head
Nick Vatamaniuc [Mon, 21 Sep 2015 18:07:03 +0000 (14:07 -0400)] 
Improve design document validation

Jira: COUCHDB-2818

Validates top level values:

  - These should be object: "options", "filters", "lists",
    "shows", "updates", "views"

  - "rewrites" is an array

  - "language" and "validate_doc_update" are strings

Values in "filters", "lists", "shows", "updates" should be strings.
They are mappings from function names to function contents.

Values in "options" can be anything (currently there are 2 boolean
options, but they are not checked specifically).

Views are special:

  - "lib" is special: its value will be an object that
    contains mapping to different libraries. The contents of
    that object is not validated.

  - If any other object has "map" or "reduce" value, it should
    be a string.

Also try to produce helpful messages for user so they know where
the problem is.

Some examples of responses:

```
$ http -phb PUT $DB1/db2/_design/des1 views:='{"v1":"nope"}'
HTTP/1.1 400 Bad Request
{
    "error": "invalid_design_doc", "reason": "View v1 must be an object"
}

$ http -phb PUT $DB1/db2/_design/des1 lists:='{"l1":true}'
HTTP/1.1 400 Bad Request
{
    "error": "invalid_design_doc", "reason": "`l1` in lists is not a string"
}

$ http -phb PUT $DB1/db2/_design/des1 views:='{"v1": {"map":1}}'
HTTP/1.1 400 Bad Request
{
    "error": "invalid_design_doc", "reason": "`map` in v1 must be a string"
}
```

3 years agoFix tests 27/head
Klaus Trainer [Sat, 12 Sep 2015 18:54:04 +0000 (20:54 +0200)] 
Fix tests

3 years agoIntegrate with Travis CI
Klaus Trainer [Sat, 12 Sep 2015 19:01:35 +0000 (21:01 +0200)] 
Integrate with Travis CI

3 years agoAlways throw validation error 26/head
Robert Newson [Mon, 7 Sep 2015 12:14:54 +0000 (13:14 +0100)] 
Always throw validation error

COUCHDB-2772

3 years agoEtag's require quotes
Robert Newson [Tue, 25 Aug 2015 15:39:02 +0000 (16:39 +0100)] 
Etag's require quotes

3 years agoUse closure funs to specify transformer functions 23/head
ILYA Khlopotov [Wed, 5 Aug 2015 22:39:42 +0000 (15:39 -0700)] 
Use closure funs to specify transformer functions

3 years agoAdd call to couch_index_plugin:index_update/4
ILYA Khlopotov [Fri, 19 Jun 2015 18:58:51 +0000 (11:58 -0700)] 
Add call to couch_index_plugin:index_update/4

3 years agoMerge branch '2724-chunked-buffering'
Adam Kocoloski [Wed, 22 Jul 2015 21:09:25 +0000 (17:09 -0400)] 
Merge branch '2724-chunked-buffering'

3 years agoBuffer rows to reduce number of chunks 2724-chunked-buffering 22/head
Adam Kocoloski [Mon, 20 Jul 2015 20:10:24 +0000 (16:10 -0400)] 
Buffer rows to reduce number of chunks

This patch reduces the number of chunks in an HTTP chunked response body
by coalescing multiple rows into a single transmission. The default
value is chosen to fill a standard Ethernet frame and can be configured
by setting

    [httpd]
    chunked_response_buffer = 1490

Setting the buffer size to 0 restores the original behavior of sending
each row in a separate chunk. Note that the same setting is several
streaming responses (e.g. _changes, _all_docs, _views).

COUCHDB-2724

3 years agoAvoid gratuitous list flattening
Adam Kocoloski [Mon, 20 Jul 2015 19:53:18 +0000 (15:53 -0400)] 
Avoid gratuitous list flattening

Mochiweb and gen_tcp are perfectly happy with iolists.

3 years agoProtect against div by zero 21/head
Robert Newson [Wed, 8 Jul 2015 20:33:17 +0000 (21:33 +0100)] 
Protect against div by zero

COUCHDB-2742

3 years agoMerge branch '537-whitelist-builtin-reduce-funs'
Adam Kocoloski [Wed, 1 Jul 2015 13:21:55 +0000 (09:21 -0400)] 
Merge branch '537-whitelist-builtin-reduce-funs'

3 years agoAdd tests for design document validations 537-whitelist-builtin-reduce-funs 20/head
Adam Kocoloski [Wed, 1 Jul 2015 01:27:41 +0000 (21:27 -0400)] 
Add tests for design document validations

COUCHDB-537

3 years agoValidate named reduce function against whitelist
Adam Kocoloski [Wed, 1 Jul 2015 00:55:05 +0000 (20:55 -0400)] 
Validate named reduce function against whitelist

COUCHDB-537

3 years agoMerge branch '1805-respect-collation-setting-reduce-group'
Adam Kocoloski [Tue, 30 Jun 2015 15:39:23 +0000 (11:39 -0400)] 
Merge branch '1805-respect-collation-setting-reduce-group'

COUCHDB-1805

3 years agoUse proper collation fun for reduce grouping 1805-respect-collation-setting-reduce-group 19/head
Adam Kocoloski [Sat, 27 Jun 2015 00:34:28 +0000 (20:34 -0400)] 
Use proper collation fun for reduce grouping

We had been using raw collation for grouping keys in a MR view
regardless of the overall collation setting for the view. This patch
defers the construction of the grouping function to the btree code,
where we have access to the correct sorting function.

COUCHDB-1805

3 years agoAdd a failing test for reduce key grouping
Adam Kocoloski [Tue, 30 Jun 2015 01:42:40 +0000 (21:42 -0400)] 
Add a failing test for reduce key grouping

I needed to refactor a few things to support multiple ddocs in the
collation test module.

COUCHDB-1805

3 years agoRework to support equivalent-but-not-equal keys
Adam Kocoloski [Mon, 29 Jun 2015 21:41:32 +0000 (17:41 -0400)] 
Rework to support equivalent-but-not-equal keys

The range collation test would fail when presented with a set of keys
that compare equal according to ICU but not according to Erlang's =:=
operator.

Other todos here include testing the raw collator and ensuring that all
tests use the correct collator (most of the other ones are also
technically incorrect but we just don't see it with the choices of data
involved). Taking care of this incrementally rather than rewriting the
whole module.

3 years agoUse the ?assertEquiv macro for better reporting
Adam Kocoloski [Mon, 29 Jun 2015 20:33:53 +0000 (16:33 -0400)] 
Use the ?assertEquiv macro for better reporting

Also dynamically compute the value for the `total` field to allow us to
add additional test data over time.

3 years agoUse chttpd provided functions 17/head
ILYA Khlopotov [Tue, 7 Apr 2015 14:59:00 +0000 (07:59 -0700)] 
Use chttpd provided functions

couch_mrview_show's usage of couch_chttp:send_external_response
brakes CORS support. Since couch_httpd's version of send_external_response
doesn't have support for CORS compared to chttpd's version.

Other couch_http's functions are switched to corresponding chttpd's
versions as well.

COUCHDB-2656

3 years agoRemove handlers for outdated mrview parameters
Alexander Shorin [Fri, 19 Sep 2014 13:23:25 +0000 (17:23 +0400)] 
Remove handlers for outdated mrview parameters

The `list` was introduced by COUCHDB-404 and becomes eventually
replaced by list functions since 0.10 release.

The `count` was suppressed by `limit` since 0.9 release.

This closes #5

3 years agoadd license
Robert Kowalski [Sat, 14 Mar 2015 18:51:59 +0000 (19:51 +0100)] 
add license

3 years agoMerge remote-tracking branch 'iilyak/1145-_local_docs-handler'
Alexander Shorin [Fri, 30 Jan 2015 07:31:23 +0000 (10:31 +0300)] 
Merge remote-tracking branch 'iilyak/1145-_local_docs-handler'

This closes #13

COUCHDB-1145

3 years agoUse ADMIN_CTX macro from couch_db.hrl
Alexander Shorin [Mon, 26 Jan 2015 04:16:16 +0000 (07:16 +0300)] 
Use ADMIN_CTX macro from couch_db.hrl

4 years agoFix typo in metric name
Alexander Shorin [Mon, 19 Jan 2015 17:42:34 +0000 (20:42 +0300)] 
Fix typo in metric name

4 years agoFix indentation 13/head
ILYA Khlopotov [Wed, 31 Dec 2014 20:29:11 +0000 (12:29 -0800)] 
Fix indentation

COUCHDB-1145

4 years agoForbid access to _local_docs for non-system dbs
ILYA Khlopotov [Wed, 31 Dec 2014 19:32:58 +0000 (11:32 -0800)] 
Forbid access to _local_docs for non-system dbs

COUCHDB-1145

4 years agoMake _local_docs accessible by admin only
ILYA Khlopotov [Wed, 31 Dec 2014 18:45:25 +0000 (10:45 -0800)] 
Make _local_docs accessible by admin only

COUCHDB-1145

4 years agoMove some logic into is_public_fields_configured function
ILYA Khlopotov [Wed, 31 Dec 2014 18:42:02 +0000 (10:42 -0800)] 
Move some logic into is_public_fields_configured function

COUCHDB-1145

4 years agoAdd _design_docs handler
ILYA Khlopotov [Thu, 18 Dec 2014 19:32:18 +0000 (11:32 -0800)] 
Add _design_docs handler

COUCHDB-1145

4 years agoAdd couch_mrview_http:handle_local_docs_req
ILYA Khlopotov [Tue, 16 Dec 2014 20:41:05 +0000 (12:41 -0800)] 
Add couch_mrview_http:handle_local_docs_req

COUCHDB-1145

4 years agoPass namespace parameter in extra field of #mrargs{}
ILYA Khlopotov [Tue, 16 Dec 2014 20:38:13 +0000 (12:38 -0800)] 
Pass namespace parameter in extra field of #mrargs{}

COUCHDB-1145

4 years agoAdd namespace option to all_docs_req
ILYA Khlopotov [Mon, 15 Dec 2014 23:28:04 +0000 (15:28 -0800)] 
Add namespace option to all_docs_req

COUCHDB-1145