couchdb-fabric.git
22 months agoMerge branch 'couchdb-2992' master
Nick Vatamaniuc [Thu, 16 Mar 2017 02:39:31 +0000 (22:39 -0400)] 
Merge branch 'couchdb-2992'

Closes #91

22 months agoAllow limiting maximum document body size 91/head
Nick Vatamaniuc [Tue, 14 Mar 2017 06:59:31 +0000 (02:59 -0400)] 
Allow limiting maximum document body size

Update doc function to check and validate document body sizes

Main implementation is in PR:

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

COUCHDB-2992

22 months agoMerge remote-tracking branch 'cloudant/couchdb-3302'
Nick Vatamaniuc [Wed, 22 Feb 2017 02:22:54 +0000 (21:22 -0500)] 
Merge remote-tracking branch 'cloudant/couchdb-3302'

Closes #89

22 months agoPrevent attachment upload from timing out during update_docs fabric call 89/head
Nick Vatamaniuc [Tue, 21 Feb 2017 22:46:57 +0000 (17:46 -0500)] 
Prevent attachment upload from timing out during update_docs fabric call

Currently if an attachment was large enough or the connection was slow enough
such that it took more than fabric.request_timeout = 60000 milliseconds, the
fabric request would time out during attachment data transfer from coordinator
node to other nodes and the whole request would fail.

This was most evident when replicating database with large attachments.

The fix is to periodically send `attachment_chunk_received` to coordinator to
prevent the timeout.

COUCHDB-3302

23 months agoUse RealReplyCount to distinguish worker replies and invalid docs 88/head
Tony Sun [Fri, 10 Feb 2017 19:23:07 +0000 (11:23 -0800)] 
Use RealReplyCount to distinguish worker replies and invalid docs

We use {ok, []} in couch_db:open_doc_revs_int/3 as a return value
when the document does not exist and open_revs=all. This leads to an
incorrect all_workers_died error. We use ReplyCount and RealReplyCount
to distinguish between when no workers were actually used in a reply
versus when the document does not exist

COUCHDB-3113

23 months agoAdd Else Clause For Embed Doc
Tony Sun [Wed, 1 Feb 2017 04:47:13 +0000 (20:47 -0800)] 
Add Else Clause For Embed Doc

When open_doc or open_revs return an error, we set the doc value
to be an error message. This way we account for errors rather than
transform_row throwing a function_clause.

COUCHDB-3109

23 months agoReturn error when workers crash 86/head
Tony Sun [Wed, 25 Jan 2017 21:47:00 +0000 (13:47 -0800)] 
Return error when workers crash

Currently, when one worker survives in fabric_open_revs, we return that
as the response. However, when all workers crash, we still return
{ok, []}. This changes the response to an error.

COUCHDB-3113

23 months agoAdd admin ctx on open ddoc in group_info 85/head
Eric Avdey [Tue, 24 Jan 2017 17:25:41 +0000 (13:25 -0400)] 
Add admin ctx on open ddoc in group_info

23 months agoIn open_revs, do not count errors in quorum threshold calculation
Nick Vatamaniuc [Thu, 12 Jan 2017 18:50:20 +0000 (13:50 -0500)] 
In open_revs, do not count errors in quorum threshold calculation

Previously quorum check looked just at the number of replies and decided quorum
was met even if it only received errors. For example, if 2 nodes are in
maintance mode it might receive this sequence of replies:

  `rexi_EXIT, rexi_EXIT, ok`

In that case after the first two it would decide quorum (r=2) was met, return
what it had so far ([]) and kill the remaining worker, who was about to return
a valid revision.

The fix is to keep track of error replies and subtract them when deciding if
quorum was met.

COUCHDB-3271

23 months agoFix open_revs fabric eunit test
Nick Vatamaniuc [Thu, 12 Jan 2017 18:17:52 +0000 (13:17 -0500)] 
Fix open_revs fabric eunit test

In check_workers_error_skipped last worker should be w3 not w2.

COUCHDB-3271

2 years agoHandle no_pass message when limit is 0 83/head
Robert Newson [Mon, 9 Jan 2017 12:30:02 +0000 (12:30 +0000)] 
Handle no_pass message when limit is 0

A view query that uses both a filter and a limit value can appear to
'hang' because the workers continue to run even after the number of
requested items have been returned, as workers that find no more
matches return 'no_pass' messages not 'change' messages, and thus the
short-circuiting code is never activated.

COUCHDB-3269

2 years agoMerge remote-tracking branch 'willholley/3264-alldocs-keys-conflicts'
Robert Newson [Tue, 3 Jan 2017 13:22:41 +0000 (13:22 +0000)] 
Merge remote-tracking branch 'willholley/3264-alldocs-keys-conflicts'

2 years agoInclude conflicts parameter in doc_options 81/head
Will Holley [Tue, 3 Jan 2017 09:54:30 +0000 (09:54 +0000)] 
Include conflicts parameter in doc_options

When a keys array is passed to _all_docs, fabric translates this
to individual open_doc calls. The conflicts=true query parameter is
specified as a view-level option and is not, by default, parsed as
an option that should be passed to open_doc.

As a workaround, explicitly copy the view-level conflict parameter into
the document options before open_doc is called.

An alternative approach would be to address this when the query
parameters are parsed, setting conflicts=true in both #mrargs and
detail of fabric, I elected to make the change here instead.

Fixes #COUCHDB-3264

2 years agoMerge remote branch 'cloudant:77984-fixup'
ILYA Khlopotov [Thu, 17 Nov 2016 17:49:24 +0000 (09:49 -0800)] 
Merge remote branch 'cloudant:77984-fixup'

This closes #80

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
2 years agoUse upgraded #mrargs{} instead of old one 80/head
ILYA Khlopotov [Thu, 17 Nov 2016 17:44:31 +0000 (09:44 -0800)] 
Use upgraded #mrargs{} instead of old one

2 years agoMerge remote branch 'cloudant:fix-typespecs'
ILYA Khlopotov [Wed, 16 Nov 2016 22:06:06 +0000 (14:06 -0800)] 
Merge remote branch 'cloudant:fix-typespecs'

This closes #79

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
2 years agoAdd `{error, Reason}` to typespecs 79/head
ILYA Khlopotov [Wed, 16 Nov 2016 21:57:29 +0000 (13:57 -0800)] 
Add `{error, Reason}` to typespecs

`fabric:design_docs/1` and `all_docs/5` can return `{error, Reason}`

2 years agoMerge remote branch 'cloudant:77984-upgrade-mrargs-record-phase2'
ILYA Khlopotov [Tue, 15 Nov 2016 00:21:11 +0000 (16:21 -0800)] 
Merge remote branch 'cloudant:77984-upgrade-mrargs-record-phase2'

This closes #78

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
2 years agoRevert "Revert "Merge remote-tracking branch 'banjiewen/stale-stable-update'"" 78/head
ILYA Khlopotov [Mon, 14 Nov 2016 21:17:12 +0000 (13:17 -0800)] 
Revert "Revert "Merge remote-tracking branch 'banjiewen/stale-stable-update'""

This reverts commit a8e0e9549bb2a1181538ae433f1de78abadc41d5.

Note: Re-aplying previously reverted merge

2 years agoUpgrade #mrargs{} record
ILYA Khlopotov [Mon, 14 Nov 2016 21:17:09 +0000 (13:17 -0800)] 
Upgrade #mrargs{} record

2 years agoMerge remote branch 'cloudant:77984-upgrade-mrargs-record-phase1'
ILYA Khlopotov [Tue, 15 Nov 2016 00:02:33 +0000 (16:02 -0800)] 
Merge remote branch 'cloudant:77984-upgrade-mrargs-record-phase1'

This closes #77

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
2 years agoCompatibility clause for the record upgrade 77/head
ILYA Khlopotov [Mon, 14 Nov 2016 21:13:11 +0000 (13:13 -0800)] 
Compatibility clause for the record upgrade

2 years agoRevert "Merge remote-tracking branch 'banjiewen/stale-stable-update'"
ILYA Khlopotov [Mon, 14 Nov 2016 21:10:39 +0000 (13:10 -0800)] 
Revert "Merge remote-tracking branch 'banjiewen/stale-stable-update'"

This reverts commit 508122c52731a9eac3e83f8d727f2355f019fe1f, reversing
changes made to d68a00fdeba9113bd1a3dd41d8e546b05bb2e533.

2 years agoMerge remote-tracking branch 'cloudant/3232-all-docs-ctx'
Robert Newson [Fri, 11 Nov 2016 23:29:05 +0000 (18:29 -0500)] 
Merge remote-tracking branch 'cloudant/3232-all-docs-ctx'

2 years agoMerge branch 'COUCHDB-3234-open-shard-timeout-counter'
Paul J. Davis [Fri, 11 Nov 2016 19:15:09 +0000 (13:15 -0600)] 
Merge branch 'COUCHDB-3234-open-shard-timeout-counter'

2 years agoTrack open_shard timeouts with a counter 74/head
Paul J. Davis [Fri, 11 Nov 2016 17:34:11 +0000 (11:34 -0600)] 
Track open_shard timeouts with a counter

The open_shard RPC endpoint is used to grab security docs. There are
fairly aggressive timeouts on these requests so that when a node is too
busy it'll try the next shard. Rather than log everytime these fail
(which can be substantial under load) lets just use a counter that can
be graphed and alerted on.

COUCHDB-3234

2 years agoPass user_ctx down to fabric_rpc 73/head
Robert Newson [Fri, 11 Nov 2016 04:45:14 +0000 (23:45 -0500)] 
Pass user_ctx down to fabric_rpc

The Options array in fabric_view_all_docs contains the {user_ctx, _}
tuple but we omitted to pass it down to the open_doc command. This
caused several incorrect behaviours for the _users database which has
some special properties for privacy reasons.

COUCHDB-3232

2 years agoAdd optional `fields` to change feed selectors 55/head
Nick Vatamaniuc [Thu, 2 Jun 2016 21:16:33 +0000 (17:16 -0400)] 
Add optional `fields` to change feed selectors

When using selectors with `include_docs=true` can specify an optional fields
array in the POST request JSON body.

Each element in the array can be a json field (or even a key path
specified as field1.field2...). Resulting documents will contain only the
specified document fields.

For example:
```
http://.../d1/_changes?filter=_selector&include_docs=true

{
    "selector": {"z" : {"$gte" : 1} }, "fields": ["field1", "field2"]
}
```
Will first select only document with "z" value >= 1, then will return only field1 and field2 in documents.

```{ "field1": "field1value", "field2": "field2value"}```

(This is a companion pr. Main pr is in couch repo)

Jira: COUCHDB-2988

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

2 years agoFix function clause introduced by fix for COUCHDB-3150
Robert Newson [Wed, 5 Oct 2016 22:35:52 +0000 (23:35 +0100)] 
Fix function clause introduced by fix for COUCHDB-3150

2 years agoMerge branch '3178-fix-fabric-rpc-filtered-changes'
Paul J. Davis [Tue, 4 Oct 2016 21:27:12 +0000 (16:27 -0500)] 
Merge branch '3178-fix-fabric-rpc-filtered-changes'

2 years agoSend a message when filtering a changes row 72/head
Paul J. Davis [Tue, 4 Oct 2016 20:12:38 +0000 (15:12 -0500)] 
Send a message when filtering a changes row

We managed to miss this change during the great merge as it was a
confusing mess in the cloudant/fabric repository. Its obvious in
hindsight once you see that we have a
`fabric_view_changes:handle_message/3` clause to handle the message.

COUCHDB-3178

2 years agoFix compiler warning 71/head
Jay Doane [Thu, 29 Sep 2016 21:36:43 +0000 (14:36 -0700)] 
Fix compiler warning

2 years agoMerge remote-tracking branch 'cloudant/COUCHDB-3150-update-all-shards-stale-update...
Paul J. Davis [Wed, 28 Sep 2016 17:27:10 +0000 (12:27 -0500)] 
Merge remote-tracking branch 'cloudant/COUCHDB-3150-update-all-shards-stale-update-after'

2 years agoUpdate all shards with stale=update_after 70/head
brkolla [Wed, 21 Sep 2016 18:29:15 +0000 (14:29 -0400)] 
Update all shards with stale=update_after
Trigger an update for all the shards. Will send a message to trigger
an update to shards that won't participate in the response due to not
being a ushard.

COUCHDB-3150

2 years agoAvoid throwing exception when deleting db in db updater listener 69/head
Nick Vatamaniuc [Thu, 15 Sep 2016 15:16:19 +0000 (11:16 -0400)] 
Avoid throwing exception when deleting db in db updater listener

Handle db deletion explicitly. Previously handle_db_event callback returned
`{stop, St}`. That return value was not handled by the caller, instead it
resulted in it being used as reason in an erlang:error, which then ended up in
the log.

Jira: COUCHDB-3149

2 years agoMerge remote-tracking branch 'will/all_or_nothing_error'
Robert Newson [Thu, 8 Sep 2016 18:05:24 +0000 (19:05 +0100)] 
Merge remote-tracking branch 'will/all_or_nothing_error'

2 years agoEnd continuous changes feeds cleanly if database is deleted 68/head
Robert Newson [Wed, 7 Sep 2016 17:56:14 +0000 (18:56 +0100)] 
End continuous changes feeds cleanly if database is deleted

COUCHDB-3132

2 years agoclarify error when all_or_nothing attempted 67/head
Will Holley [Wed, 7 Sep 2016 16:10:05 +0000 (17:10 +0100)] 
clarify error when all_or_nothing attempted

change the error message so that it doesn't imply
that all_or_nothing is a feature that will be
implemented in the future.

2 years agoMerge remote-tracking branch 'cloudant/2779-view-cleanup-cluster-aware'
Robert Newson [Thu, 11 Aug 2016 11:27:19 +0000 (12:27 +0100)] 
Merge remote-tracking branch 'cloudant/2779-view-cleanup-cluster-aware'

2 years agoImplement clustered compaction functions 66/head
Robert Newson [Thu, 11 Aug 2016 09:49:26 +0000 (10:49 +0100)] 
Implement clustered compaction functions

COUCHDB-3099

2 years agoMerge remote branch 'cloudant:71693-fix-filter-out-not-found'
Eric Avdey [Tue, 9 Aug 2016 18:36:53 +0000 (15:36 -0300)] 
Merge remote branch 'cloudant:71693-fix-filter-out-not-found'

This closes #65

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoFix reply filter for open_revs 65/head
Eric Avdey [Tue, 9 Aug 2016 14:01:51 +0000 (11:01 -0300)] 
Fix reply filter for open_revs

In general, in an absence of latest attribute, we expect
one reply per passed in revision which could be either
doc or not found.

This fix's making sure that we are removing not_found's
only for the revisions that also have {ok, Doc} reply.

COUCHDB-3097

2 years agoReplace "stale" with "stable" when picking shards 64/head
Benjamin Anderson [Sun, 17 Jul 2016 21:46:54 +0000 (14:46 -0700)] 
Replace "stale" with "stable" when picking shards

COUCHDB-3063

2 years agoMerge remote branch 'cloudant:69654-fix-view-info-duplicates'
Eric Avdey [Tue, 12 Jul 2016 18:23:09 +0000 (15:23 -0300)] 
Merge remote branch 'cloudant:69654-fix-view-info-duplicates'

This closes #61

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoIgnore already received replies for same shards 61/head
Eric Avdey [Fri, 8 Jul 2016 18:54:47 +0000 (15:54 -0300)] 
Ignore already received replies for same shards

It is possible to get a reply for same shard
from different node sent before its collector
get stopped in remove_overlapping_shards.

This running condition leads to a possibility
of same info to be aggregated multiple times.

2 years agofix compilation warnings of unused variables
Robert Newson [Tue, 12 Jul 2016 14:04:23 +0000 (15:04 +0100)] 
fix compilation warnings of unused variables

2 years agoEnd the listener if any shard is deleted 63/head
Robert Newson [Tue, 12 Jul 2016 11:06:24 +0000 (12:06 +0100)] 
End the listener if any shard is deleted

If a database is deleted and recreated the underlying shards have a
new name. Since we're watching the old names, we will never again see
an updated event. So, we stop this process if any watched shard is
deleted and it's someone elses job to recreate the listener for the
new shards.

COUCHDB-3054

2 years agoMerge remote branch 'cloudant:44287-use-correct-sequence-for-shard-replacement'
ILYA Khlopotov [Mon, 11 Jul 2016 19:43:39 +0000 (12:43 -0700)] 
Merge remote branch 'cloudant:44287-use-correct-sequence-for-shard-replacement'

This closes #62

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoUse the correct sequence for shard replacement 62/head
Paul J. Davis [Wed, 11 Feb 2015 03:49:40 +0000 (21:49 -0600)] 
Use the correct sequence for shard replacement

The call to unpack the since sequence for _changes incorrectly filtered
the value for any shard that didn't exist. This means that any shard
that was moved ended up requiring a complete rescan which is a bug. This
just sets the update sequence to the range of the shard being replaced
rather than zero.

COUCHDB-3055

2 years agoMerge remote branch 'cloudant:fix_some_specs'
ILYA Khlopotov [Mon, 27 Jun 2016 23:21:27 +0000 (16:21 -0700)] 
Merge remote branch 'cloudant:fix_some_specs'

This closes #60

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoImprove fabric:all_docs spec 60/head
ILYA Khlopotov [Wed, 22 Jun 2016 17:35:07 +0000 (10:35 -0700)] 
Improve fabric:all_docs spec

- fabric:all_docs supports options passed as proplist
- fabric:all_docs return value is controled by a callback therefore it
  should be `{ok, any()}`

2 years agofabric:update_docs supports json_obj()
ILYA Khlopotov [Wed, 22 Jun 2016 17:34:52 +0000 (10:34 -0700)] 
fabric:update_docs supports json_obj()

2 years agoEmit error row for a null doc id in POSTs to _all_docs 3039-docid-nulls-in-all-docs-post 59/head
Nick Vatamaniuc [Fri, 17 Jun 2016 18:04:39 +0000 (14:04 -0400)] 
Emit error row for a null doc id in POSTs to _all_docs

This is compatible behavior with CouchDB 1.x

Jira: COUCHDB-3039
BugzID: 68486

2 years agoSupport update_seq=true in reduce views
Robert Newson [Wed, 22 Jun 2016 12:34:14 +0000 (13:34 +0100)] 
Support update_seq=true in reduce views

COUCHDB-2991

2 years agoSupport update_seq=true in _all_docs
Robert Newson [Tue, 21 Jun 2016 20:14:07 +0000 (21:14 +0100)] 
Support update_seq=true in _all_docs

2 years agoPass security object in fake db
Robert Newson [Tue, 21 Jun 2016 15:00:08 +0000 (16:00 +0100)] 
Pass security object in fake db

Users can be granted admin access to the special _users and
_replicator databases so we need to pass the security object to the
authorization functions.

COUCHDB-2991

2 years agoMerge remote branch 'cloudant:fix-doc-open-reply'
Eric Avdey [Wed, 15 Jun 2016 12:26:31 +0000 (09:26 -0300)] 
Merge remote branch 'cloudant:fix-doc-open-reply'

This closes #58

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoFix match in fabric_doc_open_revs reply 58/head
Eric Avdey [Tue, 14 Jun 2016 16:10:04 +0000 (13:10 -0300)] 
Fix match in fabric_doc_open_revs reply

Message handler in fabric_doc_open_revs returns tagged with 'ok'
list of the replies and not expected {ok, Reply} tuple. This makes
reply to go through 'Else' clause and skip filter_reply function.

2 years agoMerge remote branch 'cloudant:68151-fix-rexi_DOWN-handler'
ILYA Khlopotov [Mon, 13 Jun 2016 18:20:06 +0000 (11:20 -0700)] 
Merge remote branch 'cloudant:68151-fix-rexi_DOWN-handler'

This closes #57

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoFix rexi_DOWN and rexi_EXIT handlers 57/head
ILYA Khlopotov [Mon, 13 Jun 2016 16:19:03 +0000 (09:19 -0700)] 
Fix rexi_DOWN and rexi_EXIT handlers

In the cases when we receive rexi_DOWN or rexi_EXIT we call
handle_message with {ok, []}. This crashes lists:min/1. Since it expects
a list with at least one element.

COUCHDB-3037

2 years agoMerge branch '3036-fix-fabric-db-update-listener-rexi-down'
Paul J. Davis [Fri, 10 Jun 2016 20:41:37 +0000 (15:41 -0500)] 
Merge branch '3036-fix-fabric-db-update-listener-rexi-down'

2 years agoFix fabric_db_update_listener rexi_DOWN handling 56/head
Paul J. Davis [Fri, 10 Jun 2016 17:52:42 +0000 (12:52 -0500)] 
Fix fabric_db_update_listener rexi_DOWN handling

A recent change that fixed the list comprehension ended up uncovering
the fact that we don't handle rexi_DOWN errors properly. This patch just
tracks the shards that are still listening and uses
`fabric_view:is_progress_possible/1` to know if we are still able to
continue listening for changes.

Fixes COUCHDB-3036

2 years agoMerge remote branch 'cloudant:2730-fix-compilation-warnings'
ILYA Khlopotov [Sun, 5 Jun 2016 15:46:10 +0000 (08:46 -0700)] 
Merge remote branch 'cloudant:2730-fix-compilation-warnings'

This closes #54

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoFix compilation warnings 54/head
ILYA Khlopotov [Thu, 2 Jun 2016 17:43:03 +0000 (10:43 -0700)] 
Fix compilation warnings

COUCHDB-2730

2 years agoMerge remote branch 'cloudant:67266-filter-out-not-found'
ILYA Khlopotov [Thu, 2 Jun 2016 17:14:51 +0000 (10:14 -0700)] 
Merge remote branch 'cloudant:67266-filter-out-not-found'

This closes #53

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoFilter out not_found replies when #doc{} is found 53/head
ILYA Khlopotov [Thu, 2 Jun 2016 16:20:39 +0000 (09:20 -0700)] 
Filter out not_found replies when #doc{} is found

There are places in the codebase which assume that the return from
open_revs is always a list with one element in it. Fix the regression
introduced in 9a1d0c5 by filtering out not_found replies when any of the
returns contains #doc{}.

COUCHDB-3026

2 years agoMerge remote branch 'cloudant:use_meck_wait'
ILYA Khlopotov [Tue, 24 May 2016 23:14:47 +0000 (16:14 -0700)] 
Merge remote branch 'cloudant:use_meck_wait'

This closes #52

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoUse meck:wait to fix race condition 52/head
ILYA Khlopotov [Tue, 24 May 2016 22:52:25 +0000 (15:52 -0700)] 
Use meck:wait to fix race condition

fabric:update_docs is running in the context of a `read_repair` which is an
independent process started using `erlang:spawn/1`. This leads to a race
when we try to use `meck:history(fabric)`. Use of `meck:wait` ensures that
we call `meck:history` after `fabric:update_docs` has been called.

2 years agoMerge branch '2863-fix-fabric-doc-open-revs'
Paul J. Davis [Tue, 24 May 2016 16:57:48 +0000 (11:57 -0500)] 
Merge branch '2863-fix-fabric-doc-open-revs'

2 years agoMerge remote branch 'cloudant:fix-spec-for-get_all_security'
ILYA Khlopotov [Thu, 19 May 2016 12:04:59 +0000 (05:04 -0700)] 
Merge remote branch 'cloudant:fix-spec-for-get_all_security'

This closes #51

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoFix return type in get_all_security 51/head
ILYA Khlopotov [Wed, 18 May 2016 23:39:09 +0000 (16:39 -0700)] 
Fix return type in get_all_security

2 years agoMerge remote branch 'cloudant:43260-create-target-shard-if-missing'
ILYA Khlopotov [Wed, 18 May 2016 14:48:29 +0000 (07:48 -0700)] 
Merge remote branch 'cloudant:43260-create-target-shard-if-missing'

This closes #50

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoUse create_if_missing option of couch_db:open_int 50/head
ILYA Khlopotov [Tue, 17 May 2016 23:57:16 +0000 (16:57 -0700)] 
Use create_if_missing option of couch_db:open_int

2 years agoFix fabric_doc_open_revs 47/head
Paul J. Davis [Thu, 21 Apr 2016 20:42:27 +0000 (15:42 -0500)] 
Fix fabric_doc_open_revs

When a user specified multiple revisions on a single branch to
fabric_doc_open_revs it would throw a function clause exception in
lists:zipwith/3. This was due to a bad assumption that there would only
ever be exactly one revision for every input revision.

Due to the possibility of having zero or more revisions for a given
revision when using latest=true this code had to be changed fairly
significantly.

COUCHDB-2863

2 years agoMerge remote branch 'cloudant:update-get_doc_count-spec'
ILYA Khlopotov [Tue, 3 May 2016 15:29:50 +0000 (08:29 -0700)] 
Merge remote branch 'cloudant:update-get_doc_count-spec'

This closes #49

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoImprove fabric:get_doc_count spec 49/head
ILYA Khlopotov [Tue, 3 May 2016 13:57:49 +0000 (06:57 -0700)] 
Improve fabric:get_doc_count spec

2 years agoMerge remote branch 'cloudant:fix-db_update_listener'
ILYA Khlopotov [Tue, 3 May 2016 13:18:28 +0000 (06:18 -0700)] 
Merge remote branch 'cloudant:fix-db_update_listener'

This closes #48

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agostart_update_notifiers returns list of #worker{} 48/head
ILYA Khlopotov [Tue, 3 May 2016 01:01:28 +0000 (18:01 -0700)] 
start_update_notifiers returns list of #worker{}

start_update_notifiers returns list of #workers{}. However we expect
`{Node, Reference}`.

2 years agoMerge remote branch 'github/pr/45'
ILYA Khlopotov [Tue, 19 Apr 2016 21:49:51 +0000 (14:49 -0700)] 
Merge remote branch 'github/pr/45'

This closes #45

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoUse couch_db:dbname_suffix in path_ends_with 45/head
ILYA Khlopotov [Fri, 8 Apr 2016 17:18:42 +0000 (10:18 -0700)] 
Use couch_db:dbname_suffix in path_ends_with

Replace couch_db:normalize_dbname with couch_db:dbname_suffix since the
semantic of normalize_dbname has been changed. couch_db:normalize_dbname
would return all components of the path with shard info removed from it.
couch_db:dbname_suffix on the other hand would return the last component
of the path. It would also ensure that shard's suffix is removed from
the result.

COUCHDB-2983

2 years agoHonor update_seq=true for map view requests 46/head
Robert Newson [Sun, 17 Apr 2016 18:18:16 +0000 (19:18 +0100)] 
Honor update_seq=true for map view requests

COUCHDB-2849

2 years agoUse ICU to compare POSTed view keys when necessary 43/head
Benjamin Anderson [Thu, 24 Mar 2016 06:09:23 +0000 (23:09 -0700)] 
Use ICU to compare POSTed view keys when necessary

It's possible for user-supplied view keys to compare equal under ICU
collation but not under Erlang's =:=. Since dict uses =:= for equality
this will result in runtime errors unless we fall back to ICU when
necessary and appropriate.

COUCHDB-2932

2 years agoSupport raw collation in map results
Benjamin Anderson [Thu, 24 Mar 2016 06:03:54 +0000 (23:03 -0700)] 
Support raw collation in map results

COUCHDB-2900

2 years agoSupport raw collation in reduce results
Benjamin Anderson [Wed, 16 Mar 2016 05:17:41 +0000 (22:17 -0700)] 
Support raw collation in reduce results

Also simplify find_next_key/3 and avoid generating a new fun for every
streamed key.

COUCHDB-2900

2 years agoAdd collation to view result collector record
Benjamin Anderson [Wed, 16 Mar 2016 05:12:42 +0000 (22:12 -0700)] 
Add collation to view result collector record

There's no reference to the #mrview when results are being streamed to
the user, so we need a place to store the collation specification while
results are collected.

COUCHDB-2900

2 years agoExtent fetch ddoc logic for view filtered changes feeds 40/head
Eric Avdey [Mon, 29 Feb 2016 20:07:09 +0000 (16:07 -0400)] 
Extent fetch ddoc logic for view filtered changes feeds

2 years agoAvoid spamming logs with write_quorum errors
Mike Wallace [Thu, 3 Mar 2016 17:13:48 +0000 (17:13 +0000)] 
Avoid spamming logs with write_quorum errors

The three metrics in fabric_doc_update:force_reply/3 were
introduced to replace the write_quorum log message however the
log line was not removed. This commit removes the log message.

Close COUCHDB-2958

This closes #41

2 years ago Merge remote branch 'github/pr/39'
ILYA Khlopotov [Wed, 2 Mar 2016 20:36:37 +0000 (12:36 -0800)] 
Merge remote branch 'github/pr/39'

    - https://github.com/apache/couchdb-fabric/pull/39

    This closes #39

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoRemove configurable replicator db name 39/head
Nick Vatamaniuc [Fri, 26 Feb 2016 21:11:39 +0000 (16:11 -0500)] 
Remove configurable replicator db name

JIRA: COUCHDB-2954

2 years agoMerge branch '2938-use-ddoc-cache-in-filtered-changes'
Russell Branca [Wed, 10 Feb 2016 22:31:07 +0000 (22:31 +0000)] 
Merge branch '2938-use-ddoc-cache-in-filtered-changes'

2 years agoSupport fetch ddoc logic for filtered changes feeds 2938-use-ddoc-cache-in-filtered-changes 37/head
Russell Branca [Thu, 21 Jan 2016 22:55:13 +0000 (22:55 +0000)] 
Support fetch ddoc logic for filtered changes feeds

2 years agoReturn forbidden error if encountered on any shard
Mike Wallace [Tue, 9 Feb 2016 14:31:55 +0000 (14:31 +0000)] 
Return forbidden error if encountered on any shard

This commit fixes an issue which caused HTTP 500 errors to be
returned when an authorized user attempted to access a database
that they did not have permission to access, when cassim is
disabled.

Instead of returning an internal server error once all shards
have failed to open we add a receive clause so that we throw
a forbidden error if one is encountered on any shard. This is the
same approach we already take for unauthorized errors.

Closes COUCHDB-2948

This closes #38

2 years agoAdd owner of shard to last_seq of changes response
Benjamin Bastian [Wed, 20 Jan 2016 00:29:34 +0000 (16:29 -0800)] 
Add owner of shard to last_seq of changes response

Prior to this commit, there was a bug where the response of a changes
query would include epoch information for every change, but not for the
last sequence. Subsequent shard changes queries would rewind from zero
if the last_seq field was used in the clustered changes query and any
shard had previously been moved.

3 years agoFix incorrect size values for view index information 34/head
Alexander Shorin [Tue, 27 Oct 2015 13:55:42 +0000 (16:55 +0300)] 
Fix incorrect size values for view index information

We need to filter overlapping shards to prevent summarizing
all sizes from all the shards, since we actually need the
value from the one.

This bug was introduced in ba27f81.

3 years agoUpdate .travis.yml
Alexander Shorin [Wed, 7 Oct 2015 17:57:02 +0000 (20:57 +0300)] 
Update .travis.yml

3 years agoFix eunit tests. 32/head
Nick Vatamaniuc [Fri, 2 Oct 2015 18:47:10 +0000 (14:47 -0400)] 
Fix eunit tests.

 Mock couch_log alongside couch_stats.

3 years agofix assertions: first arg is 'expected'
Robert Newson [Tue, 22 Sep 2015 13:18:07 +0000 (14:18 +0100)] 
fix assertions: first arg is 'expected'

3 years agoDon't create dbs doc if shard files fail for enametoolong reason 31/head
Robert Newson [Tue, 22 Sep 2015 12:10:23 +0000 (13:10 +0100)] 
Don't create dbs doc if shard files fail for enametoolong reason

COUCHDB-2821

3 years agoMerge remote-tracking branch 'smithsz/2819-db-create-check-already-exists'
Robert Newson [Tue, 22 Sep 2015 12:56:19 +0000 (13:56 +0100)] 
Merge remote-tracking branch 'smithsz/2819-db-create-check-already-exists'