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


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


Signed-off-by: Alexander Shorin <>
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


Signed-off-by: Alexander Shorin <>
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 <>
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


Signed-off-by: Alexander Shorin <>
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


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


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


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

7 years agoAdd system db handlers to fabric_doc_update 2510-add-system-db-handlers 6/head 94/head
Paul J. Davis [Fri, 12 Dec 2014 02:13:57 +0000 (20:13 -0600)] 
Add system db handlers to fabric_doc_update

This hard codes the before_doc_write functions for replicator and user
databases like they are in couch_server. This is mostly motivated by the
fact that couch_users_db:before_doc_update/1 adds random salt values to
user documents when a password is changed. The replicator databases are
included at this level for consistency with couch_server.


7 years agoFix compilation warning
Alexander Shorin [Fri, 10 Oct 2014 15:56:56 +0000 (19:56 +0400)] 
Fix compilation warning

7 years agoDon't flatten iolist
Robert Newson [Mon, 22 Sep 2014 13:18:58 +0000 (14:18 +0100)] 
Don't flatten iolist

7 years agoReturn unauthorized error if encountered on any shard
Robert Newson [Tue, 30 Sep 2014 16:24:59 +0000 (17:24 +0100)] 
Return unauthorized error if encountered on any shard

We had a mismatch here that caused us to return an unpleasant 500
status code (after discarding lots of unauthorized events from each

The mismatch was introduced in "Teach fabric_util:get_db/2 about maintenance

I also simplified the open_shard function and tuple syntax for further
clarity in this critical section.

7 years agoUse couch_log instead of ?LOG_*
Alexander Shorin [Wed, 24 Sep 2014 20:26:32 +0000 (00:26 +0400)] 
Use couch_log instead of ?LOG_*

7 years agoRestore write_quorum_errors metric collection
Robert Newson [Mon, 15 Sep 2014 13:37:41 +0000 (14:37 +0100)] 
Restore write_quorum_errors metric collection

7 years agoDon't receive foreign rexi replies
Robert Newson [Fri, 12 Sep 2014 08:55:38 +0000 (09:55 +0100)] 
Don't receive foreign rexi replies

7 years agoTeach fabric_util:get_db/2 about maintenance mode 2325-teach-fabric-get_db-about-maintenance-mode
Mike Wallace [Wed, 10 Sep 2014 11:14:30 +0000 (12:14 +0100)] 
Teach fabric_util:get_db/2 about maintenance mode

If the node servicing a request does not have a shard for the db
involved then fabric_util:get_db/2 can return a shard from a node
which is in maintenance mode. If that node is a replacement node
that has not yet been brought into the cluster then the security
object will be empty.

Because fabric:get_security/2 calls fabric_util:get_db/2 and is in
the code path for authorizing requests at the HTTP layer, this can
result in live nodes returning 403s.

This commit replaces an rpc:call/4 with a rexi:cast/4 and adds
a new rpc endpoint in fabric_rpc for opening single shards. This
uses set_io_priority which will reply with a rexi_EXIT if
maintenance mode is set.

Closes COUCHDB-2325

7 years agoMove maintenance_mode to the couchdb section
Mike Wallace [Wed, 10 Sep 2014 10:02:21 +0000 (11:02 +0100)] 
Move maintenance_mode to the couchdb section

7 years agoAllow clients to pass a db record to query_view
Paul J. Davis [Tue, 9 Sep 2014 23:06:26 +0000 (18:06 -0500)] 
Allow clients to pass a db record to query_view

The recent updates to use couch_mrview prevented the use of a #db{}
record in concjunction with a binary GroupId because the ddoc_cache
doesn't extract the name from a db record and instead uses it as the key

7 years agoExpose new size values windsor-merge 102/head
Robert Newson [Fri, 22 Aug 2014 18:26:45 +0000 (19:26 +0100)] 
Expose new size values

7 years agoPass #changes_args.db_open_options to couch_db:open/2
Paul J. Davis [Fri, 22 Aug 2014 10:05:40 +0000 (05:05 -0500)] 
Pass #changes_args.db_open_options to couch_db:open/2

7 years agoUpdate fabric to use couch_stats
Paul J. Davis [Thu, 21 Aug 2014 06:22:16 +0000 (01:22 -0500)] 
Update fabric to use couch_stats

7 years agoAdd a no-options adapter to all_docs.
Paul J. Davis [Thu, 14 Aug 2014 18:56:04 +0000 (13:56 -0500)] 
Add a no-options adapter to all_docs.

7 years agoFix use of the rexi:stream2 API
Paul J. Davis [Thu, 14 Aug 2014 18:12:15 +0000 (13:12 -0500)] 
Fix use of the rexi:stream2 API

Bit of a mixup during the merge on this one as it included both the
switch to stream2 as well as the switch to using couch_mrview.

7 years agoFix merge of new changes behaviors
Paul J. Davis [Wed, 13 Aug 2014 21:25:40 +0000 (16:25 -0500)] 
Fix merge of new changes behaviors

7 years agosquashme! stream_last
Robert Newson [Fri, 8 Aug 2014 09:17:51 +0000 (10:17 +0100)] 
squashme! stream_last

7 years agosquashme! use stream2
Robert Newson [Thu, 7 Aug 2014 21:19:16 +0000 (22:19 +0100)] 
squashme! use stream2

7 years agoConsistently log fabric worker timeouts
Mike Wallace [Sat, 11 Jan 2014 22:11:20 +0000 (22:11 +0000)] 
Consistently log fabric worker timeouts

Write a log line for each worker that did not return a response
when a fabric request times out. The format of the log line is:

    fabric_worker_timeout ENDPOINT,NODE,SHARD_NAME

This is intented to be easily consumable by downstream tools
(e.g., Splunk).

BugzID: 26984

7 years agoSet non-interactive default for set_security
Benjamin Bastian [Thu, 13 Mar 2014 02:50:52 +0000 (22:50 -0400)] 
Set non-interactive default for set_security

Prior to this commit, fabric:set_security would default to interactive
IO priority. This would cause all nodes to set the security header
except shards on any nodes which were in MM. Subsequent calls to
fabric:get_security would cause inconsistent security properties to be
applied to the request. This patch sets a non-interactive default for
fabric:set_security, which will cause security updates to be applied to
all nodes regardless of MM by default.

BugzID: 28847

7 years agoClear worker references for get_shard_replacements
Paul J. Davis [Wed, 12 Mar 2014 06:25:35 +0000 (02:25 -0400)] 
Clear worker references for get_shard_replacements

This function relies on record equality. If a request passes workers
that have references defined it would return all copies of the shard
range incorrectly.

BugzId: 28992

7 years agoFix fabric_db_update_listener code upgrades
Paul J. Davis [Fri, 31 Jan 2014 00:40:04 +0000 (18:40 -0600)] 
Fix fabric_db_update_listener code upgrades

Changes procesess waiting idle for db update messages will never upgrade
their code. This just adds a timeout before recursing through the module
exports table to load new code.

BugzId: 27660

7 years agoInclude epoch node in seqs and replacement logic
Adam Kocoloski [Fri, 17 Jan 2014 01:32:48 +0000 (17:32 -0800)] 
Include epoch node in seqs and replacement logic

The {Seq, UUID, Node} triplet uniquely identifies an update in a
cluster.  Including the node that originally accepted the update in
sequences allows us to defend against byzantine cases of shards moving
back and forth between the nodes in a cluster.

This patch updates the sequence generation to include the full triplet
in each element of the _changes sequence.  It also uses the epoch node
instead of the node currently hosting the shard when determining the
safe replacement sequence.

BugzID: 27193

7 years agoMove attachment code into couch_att
Brian Mitchell [Thu, 12 Dec 2013 04:11:48 +0000 (23:11 -0500)] 
Move attachment code into couch_att

This is an attempt to isolate the attachment record and
some related code. This will allow seamless upgrades
over time.

7 years agoAvoid badarith error during cluster upgrade
Adam Kocoloski [Mon, 6 Jan 2014 17:02:18 +0000 (12:02 -0500)] 
Avoid badarith error during cluster upgrade

BugzID: 26631

7 years agoMake _changes?descending=true aware of maint. mode
Adam Kocoloski [Thu, 2 Jan 2014 14:18:37 +0000 (09:18 -0500)] 
Make _changes?descending=true aware of maint. mode

The _changes coordinator was using a one-off thing to get the start
sequence for a database which did not provide any error handling at all.
This patch replaces that one-off with a call to get_db_info/1, which
does include all the normal error handling.

A future enhancement could teach the coordinator to understand a
"sequence" like eof that would cause all the workers to automatically
seek to the end, but I wanted to stay conservative here in order to land
this for the next release.

BugzID: 25944

7 years agoFix logging of errors in _all_docs open_doc calls
Paul J. Davis [Fri, 13 Dec 2013 19:56:44 +0000 (13:56 -0600)] 
Fix logging of errors in _all_docs open_doc calls

Our exception handling accidentally captured the successful return
value. Using try/of/catch we can exit from the of clause without

BugzId: 26162

7 years agoDon't attempt to replace replacement shards
Paul J. Davis [Thu, 12 Dec 2013 18:58:35 +0000 (12:58 -0600)] 
Don't attempt to replace replacement shards

The old test was looking for {_, _} tuple but that doesn't account for
old since sequences. This just switches to using a negative selection.
The only bad behavior was that we were making lots of log messages about
rewinding from 0 in known conditions.

BugzId: 26125

7 years agoOnly attempt replacement when we have replacements
Paul J. Davis [Thu, 12 Dec 2013 18:51:46 +0000 (12:51 -0600)] 
Only attempt replacement when we have replacements

We weren't checking if we were even provided replacements before using
them. This just adds a guard so we don't end up with a badmatch error on
the `lists:keytake/3`.

BugzId: 26124

7 years agoThrow errors when starting changes streams
Paul J. Davis [Thu, 12 Dec 2013 18:45:10 +0000 (12:45 -0600)] 
Throw errors when starting changes streams

Previously we were calling the user supplied callback on these errors
which caused a badmatch in keep_sending_changes. This just throws the
error and lets chttpd handle formatting it for the user.

BugzId: 26122

7 years agoLog errors when doc reads fail for _all_docs
Paul J. Davis [Thu, 12 Dec 2013 15:25:39 +0000 (09:25 -0600)] 
Log errors when doc reads fail for _all_docs

This makes sure that we log any errors while opening a doc during an
_all_docs request. It also passes the failed DbName and DocId to the
user supplied callback function.

BugzId: 24580

7 years agoBe defensive when calcualting pending_count
Paul J. Davis [Tue, 10 Dec 2013 17:35:22 +0000 (11:35 -0600)] 
Be defensive when calcualting pending_count

Its theoretically possible that during the upgrade we end up with a
mixed set of RPC workers. This makes sure that we don't crash the
coordinator with a badarith error.

BugzId: 24236

7 years agoCollect pending counts and report sum at end
Adam Kocoloski [Thu, 17 Oct 2013 20:33:14 +0000 (16:33 -0400)] 
Collect pending counts and report sum at end

BugzID: 24236

7 years agoReport number of pending changes in shard
Adam Kocoloski [Thu, 17 Oct 2013 18:17:12 +0000 (14:17 -0400)] 
Report number of pending changes in shard

Also refactor the _changes accumulator into a record.

BugzID: 24236

7 years agoRefactor payload to simplify coordinator
Adam Kocoloski [Thu, 17 Oct 2013 18:03:47 +0000 (14:03 -0400)] 
Refactor payload to simplify coordinator

Two things we're doing here:

1) We're unwrapping {doc, {error, Reason}} on the RPC side.
2) We're already suppressing the doc field on the RPC side so we don't
have to duplicate the work on the coordinator.

7 years ago[2/2] Use proplist instead of #change record
Adam Kocoloski [Thu, 17 Oct 2013 17:27:58 +0000 (13:27 -0400)] 
[2/2] Use proplist instead of #change record

7 years agoAdjust replacement rewind exclusion
Paul J. Davis [Fri, 6 Dec 2013 20:44:44 +0000 (14:44 -0600)] 
Adjust replacement rewind exclusion

We're wanting to avoid attempting to use existing replacement
information for down shards. The is_integer guard didn't work because
the sequences are {UUID, Seq} tuples so we pattern match on that tuple
shape instead.

BugzId: 22698

7 years ago[squash] add deprecation info
Adam Kocoloski [Mon, 25 Nov 2013 20:31:47 +0000 (15:31 -0500)] 
[squash] add deprecation info

7 years agoUse smarter replacements for stream_start failures
Adam Kocoloski [Sat, 23 Nov 2013 03:03:22 +0000 (22:03 -0500)] 
Use smarter replacements for stream_start failures

This patch enhances the StartFun to search the original list of workers
for the sequence from which the worker being replaced had started.

BugzID: 22698

7 years agoUse smarter seqs when original shard is down/gone
Adam Kocoloski [Sun, 17 Nov 2013 23:16:07 +0000 (18:16 -0500)] 
Use smarter seqs when original shard is down/gone

If a shard that contributes to a sequence a) is on a down node or b) is
no longer part of the shard set we can provide enough detail to the
replacement workers to allow them to choose a smarter replacement

This patch does not cover the case where the shard that originally
contributed to the sequence is alive but crashes before initializing the
stream to the coordinator.  In that case we're still firing up
replacement workers and asking them to stream from zero.  The
stream_start semantics make reworking that bit a tad trickier.

BugzID: 22698

7 years agoCalculate safe worker seq on shard replacement
Adam Kocoloski [Sun, 17 Nov 2013 17:01:05 +0000 (12:01 -0500)] 
Calculate safe worker seq on shard replacement

When a shard is being replaced in the changes feed the RPC workers for
the other shard copies can leverage epoch and checkpoint information to
start from a sequence greater than zero.  This commit (and an associated
one in mem3) make that possible, though we still need to teach the
coordinator to share the fact that the worker is being summoned to
replace another copy that previously contributed to the feed.

BugzID: 22698

7 years agoReport errors opening documents during _all_docs
Adam Kocoloski [Sat, 26 Oct 2013 02:59:23 +0000 (22:59 -0400)] 
Report errors opening documents during _all_docs

All errors are currently ignored in the receive statements and
eventually we timeout.  This patch causes fabric to report the error and
terminate quickly instead of waiting.

BugzID: 24580

7 years agoSwitch from ddoc to id+rev protocol for views
Brian Mitchell [Fri, 25 Oct 2013 15:44:00 +0000 (11:44 -0400)] 
Switch from ddoc to id+rev protocol for views

7 years agoHandle fabric upgrade
Brian Mitchell [Thu, 24 Oct 2013 14:12:58 +0000 (10:12 -0400)] 
Handle fabric upgrade

We still need to handle direct document passing for older
clients. The new Id+Rev protocol will be a part of a
future upgrade.

7 years agoPass document id & rev rather than the whole document
Brian Mitchell [Mon, 21 Oct 2013 17:14:40 +0000 (13:14 -0400)] 
Pass document id & rev rather than the whole document

This uses the ddoc_cache support for revisions. It should
reduce bandwidth overhead of copying documents around.

7 years agoFix inclusion of "doc":"undefined" in changes feed
Paul J. Davis [Tue, 22 Oct 2013 05:02:46 +0000 (00:02 -0500)] 
Fix inclusion of "doc":"undefined" in changes feed

We were reusing the wrong variable after removing the default values.

BugzId: 24356

7 years agoMake all timeouts configurable
Robert Newson [Mon, 21 Oct 2013 17:05:11 +0000 (18:05 +0100)] 
Make all timeouts configurable

BugzID: 24302

7 years agoReplace read_repair logs with a metric
Paul J. Davis [Thu, 17 Oct 2013 20:35:39 +0000 (15:35 -0500)] 
Replace read_repair logs with a metric

Successful read repair notices aren't overly informative. To reduce log
spam we'll just switch to using a metric and only log when we don't have
a successful response.

BugzId: 24262

7 years ago[1/2] Use proplist instead of #change record
Adam Kocoloski [Thu, 17 Oct 2013 15:45:08 +0000 (11:45 -0400)] 
[1/2] Use proplist instead of #change record

This commit lays the groundwork by translating the record into a
proplist.  A follow-on commit will cause the RPC workers to send the
proplist instead of the record.

It also converts the 'complete' tuple into a tagged proplist.

BugzID: 24236

7 years agoProvide replacement shards in changes feeds
Paul J. Davis [Thu, 12 Sep 2013 17:25:33 +0000 (12:25 -0500)] 
Provide replacement shards in changes feeds

BugzId: 20423

7 years agoProvide replacement shards in reduce views
Paul J. Davis [Thu, 12 Sep 2013 15:22:16 +0000 (10:22 -0500)] 
Provide replacement shards in reduce views

BugzId: 20423

7 years agoProvide replacement shards in map views
Paul J. Davis [Thu, 12 Sep 2013 15:22:00 +0000 (10:22 -0500)] 
Provide replacement shards in map views

BugzId: 20423

7 years agoAdd utility function to find shard replacements
Paul J. Davis [Thu, 12 Sep 2013 18:30:40 +0000 (13:30 -0500)] 
Add utility function to find shard replacements

Streaming RPC coordinators can use this function to generate a list of
shard replacements that is suitable to be passed to

BugzId: 20423

7 years agoAllow shard replacements in stream_start
Paul J. Davis [Thu, 12 Sep 2013 15:23:48 +0000 (10:23 -0500)] 
Allow shard replacements in stream_start

This adds fabric_util:stream_start/4 which accepts a start function and
a proplist of replacement shards keyed by range. If a worker exits due
to maintenance mode and prevents progress from being made, the list of
replacement shards is searched for any replacements for the range. If
any are found the start function is called for each possible
replacement. The start function takes the possible replacement and
should return the new worker.

BugzId: 20423

7 years agoFix `fabric:get_db_info/1`
Paul J. Davis [Fri, 4 Oct 2013 21:34:11 +0000 (16:34 -0500)] 
Fix `fabric:get_db_info/1`

We weren't properly removing shards that had an error as well as
returning errors to functions that don't expect them.

7 years agoSet io_priority properly for all requests
Paul J. Davis [Fri, 4 Oct 2013 21:35:13 +0000 (16:35 -0500)] 
Set io_priority properly for all requests

Notably, changes wasn't calling set_io_priority so was not affected by

7 years agoUpdate _changes coordinator to use new RPC APIs
Paul J. Davis [Wed, 4 Sep 2013 20:59:39 +0000 (15:59 -0500)] 
Update _changes coordinator to use new RPC APIs

BugzId: 21755

7 years agoRemove test for old reduce view behavior
Paul J. Davis [Wed, 4 Sep 2013 21:23:02 +0000 (16:23 -0500)] 
Remove test for old reduce view behavior

This test is no longer valid because its checking that a complete
message removes other workers from the same range which no longer
happens. This is because fabric_util:stream_start/2 now removes all
workers and returns us a single complete shard ring.

BugzId: 21755

7 years agoUpdate reduce view coordinator to use new RPC APIs
Paul J. Davis [Wed, 4 Sep 2013 21:00:01 +0000 (16:00 -0500)] 
Update reduce view coordinator to use new RPC APIs

BugzId: 21755

7 years agoUpdate map view coordinator to use new RPC APIs
Paul J. Davis [Fri, 6 Sep 2013 12:26:52 +0000 (07:26 -0500)] 
Update map view coordinator to use new RPC APIs

BugzId: 21755

7 years agoUpdate _all_docs coordinator to use new RPC APIs
Paul J. Davis [Wed, 4 Sep 2013 22:28:57 +0000 (17:28 -0500)] 
Update _all_docs coordinator to use new RPC APIs

BugzId: 21755

7 years agoImplement fabric_view:handle_worker_exit/3
Paul J. Davis [Wed, 11 Sep 2013 01:58:38 +0000 (20:58 -0500)] 
Implement fabric_view:handle_worker_exit/3

This is a simple utility function that we can use to cancel a streaming
response when a worker dies. By the time we get here we know that
progress is no longer possible so we report the error and abort the

7 years agoImplement fabric_view:check_down_shards/2
Paul J. Davis [Wed, 11 Sep 2013 01:56:27 +0000 (20:56 -0500)] 
Implement fabric_view:check_down_shards/2

This replaces fabric_view:remove_down_shards/2 with a check to see if a
rexi_DOWN message affects any of the worker shards. This is because we
monitor all the shards but are only handling messages from a single ring
which may not have included a node in the initial shards list.

We no longer need to remove shards on down nodes because once our stream
handling functions run as soon as we see a shard on a downed node we
know that progress is no longer possible under our current behavior.

7 years agoImplement fabric_util:stream_start/2
Paul J. Davis [Fri, 6 Sep 2013 12:26:32 +0000 (07:26 -0500)] 
Implement fabric_util:stream_start/2

This is a utility function that handles gathering the start of a rexi
stream. It will return a single full hash ring of shards or an error.

BugzId: 21755

7 years agoAdd fabric_dict:fetch_keys/1
Paul J. Davis [Fri, 4 Oct 2013 18:16:03 +0000 (13:16 -0500)] 
Add fabric_dict:fetch_keys/1

7 years agoAdd fabric_dict:is_key/2
Paul J. Davis [Wed, 4 Sep 2013 20:58:42 +0000 (15:58 -0500)] 
Add fabric_dict:is_key/2

BugzId: 21755

7 years agoUse the dollar_endonly option to prevent newlines
Adam Kocoloski [Wed, 16 Oct 2013 17:56:35 +0000 (13:56 -0400)] 
Use the dollar_endonly option to prevent newlines

BugzID: 24203

7 years agoAllow options to all database functions
Paul J. Davis [Mon, 30 Sep 2013 18:52:05 +0000 (13:52 -0500)] 
Allow options to all database functions

This is the first of two commits. The second needs to be in a second

BugzId: 23787

7 years agoAllow to omit seq from some rows in _changes response
Adam Kocoloski [Wed, 2 Oct 2013 01:41:52 +0000 (21:41 -0400)] 
Allow to omit seq from some rows in _changes response

This is a hack to improve the throughput of _changes on databases with
large Q values.  The record-based approach for sharing config options is
a pain to extend so we're going to be dirty and use the pdict here.

BugzID: 23637

7 years agoHandle duplicate docs in bulk update
Benjamin Bastian [Fri, 23 Aug 2013 18:41:48 +0000 (11:41 -0700)] 
Handle duplicate docs in bulk update

Previous to this commit, fabric assumed that all docs in a bulk update
request were unique. In the case that they were not unique, fabric would
error and return a stack trace to the user. This commit makes fabric
identify docs in a bulk update by a ref rather than their id.

This commit is based on work done by Bob Dionne.

BugzID: 12540

7 years agoUpgrade continuous changes feeds to new code
Robert Newson [Tue, 17 Sep 2013 22:33:30 +0000 (23:33 +0100)] 
Upgrade continuous changes feeds to new code

BugzID: 23154

7 years agoRemove (not that successful) downgrade trick
Robert Newson [Tue, 17 Sep 2013 12:31:13 +0000 (13:31 +0100)] 
Remove (not that successful) downgrade trick

7 years agoFix hot upgrade for new since values
Robert Newson [Mon, 16 Sep 2013 21:17:49 +0000 (22:17 +0100)] 
Fix hot upgrade for new since values

7 years agoInclude uuid in since values
Robert Newson [Wed, 11 Sep 2013 15:26:34 +0000 (16:26 +0100)] 
Include uuid in since values

BugzID: 21658

7 years agoHandle bad_request message from worker
Mike Wallace [Wed, 21 Aug 2013 12:51:58 +0000 (13:51 +0100)] 
Handle bad_request message from worker

fabric_doc_update handles bad_request messages that can be sent
by its workers if they fail to parse a multipart/related document.

BugzID: 22593

7 years agoFix changes shard replacement
Paul J. Davis [Fri, 6 Sep 2013 11:17:44 +0000 (06:17 -0500)] 
Fix changes shard replacement

We were unwittingly falling victim to list comprehensions swallowing
exceptions again. The result this time was that anytime we needed to
replace a changes shard we were adding the entire shard map. This means
that any time we were resetting the feed its possible we could have
reset the feed for all shard ranges depending on the rexi worker race.

BugzId: 22808

7 years agoFix invalid reference in edoc
Adam Kocoloski [Fri, 30 Aug 2013 17:01:02 +0000 (13:01 -0400)] 
Fix invalid reference in edoc

BugzID: 10870

7 years agoDowngrade new style since values unintentionally released into the wild
Robert Newson [Wed, 14 Aug 2013 21:05:47 +0000 (22:05 +0100)] 
Downgrade new style since values unintentionally released into the wild

7 years agoRevert "Revert "Revert uuid in changes feeds temporarily""
Robert Newson [Wed, 14 Aug 2013 16:28:28 +0000 (17:28 +0100)] 
Revert "Revert "Revert uuid in changes feeds temporarily""

This reverts commit 92190f71fecf4a22102154231a2de09ad910616c.

7 years agoRevert "Merge pull request #99 from cloudant/fix-fencepost"
Robert Newson [Wed, 14 Aug 2013 16:28:11 +0000 (17:28 +0100)] 
Revert "Merge pull request #99 from cloudant/fix-fencepost"

This reverts commit 1cf3128d139ebd4e1d6055cdcfbdede43febe1be, reversing
changes made to 82223b0e44c83fb60e93f7653a3bebd22ea98bfe.

7 years agoGracefully terminate continuous changes feeds
Robert Newson [Mon, 12 Aug 2013 01:12:28 +0000 (02:12 +0100)] 
Gracefully terminate continuous changes feeds

When maintenance_mode is set to "true" or "nolb", end all active continuous
changes feeds gracefully with a last_seq chunk and clean TCP

BugzID: 21618

7 years agoValidate epochs
Robert Newson [Sat, 10 Aug 2013 18:19:04 +0000 (19:19 +0100)] 
Validate epochs

7 years agoAdd negative test for fencepost
Robert Newson [Sat, 10 Aug 2013 18:11:29 +0000 (19:11 +0100)] 
Add negative test for fencepost

7 years agoSeparate is_owner logic from owner_of
Robert Newson [Sat, 10 Aug 2013 18:05:49 +0000 (19:05 +0100)] 
Separate is_owner logic from owner_of