couchdb-fabric.git
5 years agoAdd unsorted_meta callback for delayed meta fix-unsorted-views 100/head
Russell Branca [Fri, 15 Jul 2016 00:22:22 +0000 (00:22 +0000)] 
Add unsorted_meta callback for delayed meta

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

5 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

5 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

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

5 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>
5 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()}`

5 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()

6 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

6 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

6 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

6 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

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

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

6 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'

6 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

6 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>
6 years agoFix compilation warnings 54/head
ILYA Khlopotov [Thu, 2 Jun 2016 17:43:03 +0000 (10:43 -0700)] 
Fix compilation warnings

COUCHDB-2730

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

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

6 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'

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

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

6 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

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

6 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>
6 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}`.

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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

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

6 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'

6 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

6 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

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

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

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

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

6 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'

6 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

6 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'

6 years agoCheck if a DB exists prior to creating 30/head
Sam Smith [Mon, 21 Sep 2015 15:05:16 +0000 (16:05 +0100)] 
Check if a DB exists prior to creating

COUCHDB-2819

6 years agoAdded counter metric for fabric-worker-timeout.
Bryan Green [Sat, 8 Aug 2015 00:06:14 +0000 (19:06 -0500)] 
Added counter metric for fabric-worker-timeout.

This is being done as a good indicator for when mspot is
having issues.  An alert threshold will be set in
centinela.

BugzID: 50369

6 years agoRevert "add clusterwide compaction for dbs"
Robert Newson [Sat, 12 Sep 2015 18:30:58 +0000 (19:30 +0100)] 
Revert "add clusterwide compaction for dbs"

This reverts commit 140bcfacbb220bc3b47697fdd7b8b306eb6d7330.

6 years agoadd clusterwide compaction for dbs
Robert Kowalski [Fri, 21 Aug 2015 12:16:34 +0000 (14:16 +0200)] 
add clusterwide compaction for dbs

PRs:
https://github.com/apache/couchdb-fabric/pull/27
https://github.com/apache/couchdb-chttpd/pull/62

COUCHDB-2492

PR: #27
PR-URL: https://github.com/apache/couchdb-fabric/pull/27
Reviewed-By: Robert Newson <rnewson@apache.org>
6 years agoUse BigCouch/Cloudant seq format
Robert Newson [Mon, 24 Aug 2015 11:11:58 +0000 (12:11 +0100)] 
Use BigCouch/Cloudant seq format

Let's ease 2.0 transition by not introducing a new sequence format,
it's not even necessary now.

6 years agoIntegrate with Travis CI 29/head
Alexander Shorin [Mon, 24 Aug 2015 11:30:01 +0000 (14:30 +0300)] 
Integrate with Travis CI

6 years agoFix type specs
Klaus Trainer [Wed, 19 Aug 2015 09:52:46 +0000 (11:52 +0200)] 
Fix type specs

6 years agofabric:cleanup_index_files should check mrview/ directories 25/head
Robert Newson [Thu, 13 Aug 2015 12:59:00 +0000 (13:59 +0100)] 
fabric:cleanup_index_files should check mrview/ directories

COUCHDB-2773

6 years agoUse `couch_db:validate_dbname/1` 24/head
ILYA Khlopotov [Fri, 31 Jul 2015 18:41:48 +0000 (11:41 -0700)] 
Use `couch_db:validate_dbname/1`

6 years agoMerge branch '2724-chunked-buffering'
Adam Kocoloski [Wed, 22 Jul 2015 16:31:12 +0000 (12:31 -0400)] 
Merge branch '2724-chunked-buffering'

6 years agoRestrict views in the authentication DB to admins
Mike Wallace [Wed, 15 Jul 2015 09:54:05 +0000 (10:54 +0100)] 
Restrict views in the authentication DB to admins

This commit teaches fabric to restrict access to views in the
authentication DB to administrators by calling through to
couch_db_users:after_doc_read/2 after the design doc is read.

COUCHDB-2738

This closes #23

6 years agoMove is_*_db funs and helpers to fabric_util
Mike Wallace [Wed, 15 Jul 2015 09:50:21 +0000 (10:50 +0100)] 
Move is_*_db funs and helpers to fabric_util

This commit moves the is_*_db/1 funs and their helpers from
fabric_doc_update to fabric_util and exports them so they
can be re-used elsewhere in fabric.

COUCHDB-2738

7 years agoExecute a callback at end of each traversal 2724-chunked-buffering 22/head 96/head
Adam Kocoloski [Wed, 24 Jun 2015 18:05:20 +0000 (14:05 -0400)] 
Execute a callback at end of each traversal

We add this notification before entering a (potentially long) wait for
new DB updates so that the client can choose to finalize any processing
it might have been doing on earlier updates. The specific use case in
chttpd is to flush the client's internal buffer in a timely manner.

COUCHDB-2724

7 years agoRemove meck twig:log/3
Alexander Shorin [Wed, 17 Jun 2015 09:24:36 +0000 (12:24 +0300)] 
Remove meck twig:log/3

7 years agoUse couch_db:normalize_dbname 21/head
ILYA Khlopotov [Mon, 15 Jun 2015 12:54:08 +0000 (05:54 -0700)] 
Use couch_db:normalize_dbname

COUCHDB-2715

7 years agoRevert "Module-wide s/proplists:get_value/couch_util:get_value/"
Alexander Shorin [Thu, 11 Jun 2015 01:18:51 +0000 (04:18 +0300)] 
Revert "Module-wide s/proplists:get_value/couch_util:get_value/"

Behaviour of `get_value/2,3` function of couch_util and proplists
modules is completely different when searched key exists and is an
atom, but there is no paired value for it: proplists function
implicitly assumes that a value is `true` while couch_util returns
`undefined` instead.

Such replacement breaks any logic that depends on `true` or
`undefined` result of the function call, so we need to be
careful next time.

This reverts commit 19c273ac54e8f1bec81be3b74c443ecafa01e599.

7 years agoModule-wide s/proplists:get_value/couch_util:get_value/ merge-diff-from-cloudant-fork 20/head
Mike Wallace [Fri, 5 Jun 2015 16:01:13 +0000 (17:01 +0100)] 
Module-wide s/proplists:get_value/couch_util:get_value/

7 years agoexport dbname/1
Robert Newson [Thu, 9 Apr 2015 22:07:19 +0000 (23:07 +0100)] 
export dbname/1

BugzID: 45853

This is a cherry-pick of:

https://github.com/cloudant/fabric/commit/818dd09e9ea645e866fc62fd1a4302ce73b2422a

7 years agoAdd ability to gracefully terminate existing changes feeds
Robert Newson [Sun, 29 Mar 2015 12:38:38 +0000 (13:38 +0100)] 
Add ability to gracefully terminate existing changes feeds

Calling fabric:end_changes() will cause all current changes
feeds to gracefully exit without preventing new changes requests from
starting (unlike maintenance_mode).

BugzID: 45762

This is a cherry-pick of:

https://github.com/cloudant/fabric/commit/1b45cede8f11e209f28e3d06b9fda4cbdcd719cc

Conflicts:
src/fabric.erl
src/fabric_view_changes.erl

7 years agoProvide an access to a document info
Eric Avdey [Tue, 11 Nov 2014 00:12:42 +0000 (20:12 -0400)] 
Provide an access to a document info

The functions `get_doc_info/3` and `get_full_doc_info/3` were
added to API to provide an access to the records `#doc_info{}`
and `#full_doc_info{}` accordingly.

The functions are re-using `fabric_open_doc` coordinator
and consequently are the subject of the same read quorum rules
as `open_doc/3` function. However the info functions do not trigger
read repair on a not fully complete quorum.

Function `get_full_doc_info/3` accepts an option `deleted` to
allow to provide an information for a deleted document,
similar to `open_doc/3`.

FogBugz: 12933

This is a cherry-pick of:

https://github.com/cloudant/fabric/commit/c85569287ad8f86122b47775adc2ab9218db0322

Conflicts:
src/fabric_rpc.erl

7 years agouse the right config section for clustered authentication db
Robert Newson [Tue, 19 May 2015 11:53:07 +0000 (12:53 +0100)] 
use the right config section for clustered authentication db

7 years agoMerge remote-tracking branch 'iilyak/2526-pending-updates-info'
Alexander Shorin [Tue, 12 May 2015 19:52:39 +0000 (22:52 +0300)] 
Merge remote-tracking branch 'iilyak/2526-pending-updates-info'

This closes #9

COUCHDB-2526

7 years agoFix typo
Russell Branca [Fri, 24 Apr 2015 00:21:02 +0000 (00:21 +0000)] 
Fix typo

7 years agoHandle case in fake_db where there's no user context
Robert Newson [Thu, 9 Apr 2015 16:50:54 +0000 (17:50 +0100)] 
Handle case in fake_db where there's no user context

7 years agoCall the correct before_doc_update arity 2643-fix-arity
Robert Newson [Tue, 31 Mar 2015 13:04:19 +0000 (14:04 +0100)] 
Call the correct before_doc_update arity

bug introduced in COUCHDB-510

fixes COUCHDB-2630 COUCHDB-2632 COUCHDB-2643

7 years agoRename variables for clarification of intend 9/head
ILYA Khlopotov [Tue, 23 Dec 2014 15:54:02 +0000 (07:54 -0800)] 
Rename variables for clarification of intend

COUCHDB-2526

7 years agoAdd updates_pending field to get_view_group_info
ILYA Khlopotov [Mon, 22 Dec 2014 21:57:38 +0000 (13:57 -0800)] 
Add updates_pending field to get_view_group_info

We also change the beheviour of this function to wait
response from all shards.

COUCHDB-2526

7 years agoadd license file
Robert Kowalski [Sat, 28 Feb 2015 22:16:59 +0000 (23:16 +0100)] 
add license file

7 years agoreadme: change to couchdb project
Robert Kowalski [Sat, 28 Feb 2015 22:18:46 +0000 (23:18 +0100)] 
readme: change to couchdb project

7 years agoremove compile warning 16/head
Robert Kowalski [Sat, 28 Feb 2015 22:07:20 +0000 (23:07 +0100)] 
remove compile warning

make `Options` optional :)

7 years agoUse list of system database names
Alexander Shorin [Wed, 25 Feb 2015 19:03:21 +0000 (22:03 +0300)] 
Use list of system database names

This closes #15

COUCHDB-2619
COUCHDB-2620

7 years agoRespect doc_options during _all_docs serialization
Will Holley [Fri, 6 Feb 2015 17:52:31 +0000 (17:52 +0000)] 
Respect doc_options during _all_docs serialization

When full documents are returned as part of an _all_docs response,
respect doc_options (e.g. attachments=true) during JSON serialization.

This closes #13

COUCHDB-2568

Signed-off-by: Alexander Shorin <kxepal@apache.org>
7 years agoFix waterfall of `rexi_server error:badarg` errors
Alexander Shorin [Thu, 5 Feb 2015 13:05:20 +0000 (16:05 +0300)] 
Fix waterfall of `rexi_server error:badarg` errors

7 years agoRespect doc_options during _changes serialization
Will Holley [Mon, 2 Feb 2015 21:02:27 +0000 (21:02 +0000)] 
Respect doc_options during _changes serialization

When including full documents in the changes feed response, respect
doc_options (e.g. attachments=true) during JSON serialization.

This closes #12

COUCHDB-2522

Signed-off-by: Alexander Shorin <kxepal@apache.org>
7 years agoRespect conflicts=true when collecting clustered changes
Will Holley [Sun, 1 Feb 2015 21:34:05 +0000 (21:34 +0000)] 
Respect conflicts=true when collecting clustered changes

This correctly reads the conflicts parameter from #changes_args.
Previously we were attempting to look for a conflicts property in
Options which was never set (so always evaluated to false).

Fixes COUCHDB-2518

This closes #11

Signed-off-by: Alexander Shorin <kxepal@apache.org>
7 years agoHandle empty list of id/revs in fabric_doc_missing_revs:go
Will Holley [Sat, 31 Jan 2015 20:20:02 +0000 (20:20 +0000)] 
Handle empty list of id/revs in fabric_doc_missing_revs:go

When AllIdsRevs is an empty list the result will always be an empty
response. Handle this explicitly given there is no work to do
(attempting to delegate to the shards previously resulted in a timeout).

This closes #10

COUCHDB-2531

Signed-off-by: Alexander Shorin <kxepal@apache.org>
7 years agoMerge remote-tracking branch 'iilyak/1145-_local_docs-handler'
Alexander Shorin [Fri, 30 Jan 2015 06:45:56 +0000 (09:45 +0300)] 
Merge remote-tracking branch 'iilyak/1145-_local_docs-handler'

This closes #8

COUCHDB-1145

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

7 years agoFix incomplete spec of fabric:get_view_group_info
ILYA Khlopotov [Mon, 22 Dec 2014 21:56:56 +0000 (13:56 -0800)] 
Fix incomplete spec of fabric:get_view_group_info

COUCHDB-2526

7 years agoDon't do manual filtering of _design docs 8/head
ILYA Khlopotov [Fri, 19 Dec 2014 16:36:05 +0000 (08:36 -0800)] 
Don't do manual filtering of _design docs

Since namespace support was added we can rely on it instead

COUCHDB-1145

7 years agoMerge branch '2517-open_revs=all-function_clause'
Paul J. Davis [Tue, 16 Dec 2014 20:58:43 +0000 (14:58 -0600)] 
Merge branch '2517-open_revs=all-function_clause'

Fixes #7

7 years agoExit early when there is a quorum but list of docs is empty
ILYA Khlopotov [Mon, 8 Dec 2014 15:52:12 +0000 (07:52 -0800)] 
Exit early when there is a quorum but list of docs is empty

There is no point to go through repair stage since this set of
conditions meens that the doc with given id doesn't exists.
Besides not going through repair process fixes the case when
we request open_revs=all for non existent document

COUCHDB-2517

7 years agoMerge branch '2510-add-system-db-handlers'
Paul J. Davis [Fri, 12 Dec 2014 20:35:08 +0000 (14:35 -0600)] 
Merge branch '2510-add-system-db-handlers'

Fixes #6