couchdb-couch.git
5 years agoMerge remote branch 'cloudant:74046-authentication_db-should-be-sysdb' test-branch 259/head
ILYA Khlopotov [Tue, 20 Sep 2016 19:51:07 +0000 (12:51 -0700)] 
Merge remote branch 'cloudant:74046-authentication_db-should-be-sysdb'

This closes #198

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
5 years agoMake sure clustered authentication_db is sys_db 198/head
ILYA Khlopotov [Tue, 13 Sep 2016 18:42:47 +0000 (11:42 -0700)] 
Make sure clustered authentication_db is sys_db

Fixes the case when the following are configured to something other than _users
 - chttpd_auth.authentication_db
 - couch_httpd_auth.authentication_db

Introduce "couchdb.users_db_suffix" config key

Remove distinction between clustered and local users databases
configuration. We remove following configuration options and replace
them with "couchdb.users_db_suffix":

- chttpd_auth.authentication_db
- couch_httpd_auth.authentication_db

COUCHDB-2731

5 years agoMerge remote branch 'cloudant:define_couch_version'
ILYA Khlopotov [Tue, 20 Sep 2016 17:03:36 +0000 (10:03 -0700)] 
Merge remote branch 'cloudant:define_couch_version'

This closes #199

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
5 years agoDefine COUCHDB_VERSION macro 199/head
ILYA Khlopotov [Fri, 16 Sep 2016 20:13:08 +0000 (13:13 -0700)] 
Define COUCHDB_VERSION macro

5 years agoRemove rebar.config
ILYA Khlopotov [Fri, 16 Sep 2016 20:11:56 +0000 (13:11 -0700)] 
Remove rebar.config

5 years agoRevert "Get couch version from environment not git"
ILYA Khlopotov [Fri, 16 Sep 2016 20:38:53 +0000 (13:38 -0700)] 
Revert "Get couch version from environment not git"

This reverts commit c613dabf635ca3a5d6de2240d00b80c334dc8f43.

5 years agoRevert "get version from environment in cross-platform way"
ILYA Khlopotov [Fri, 16 Sep 2016 20:38:40 +0000 (13:38 -0700)] 
Revert "get version from environment in cross-platform way"

This reverts commit 7d0cfb5f9d1f0fcdc607b46f31ae33cbf65115df.

5 years agoPartial revert Fix Windows version string determ.."
ILYA Khlopotov [Fri, 16 Sep 2016 20:36:34 +0000 (13:36 -0700)] 
Partial revert Fix Windows version string determ.."

This partially reverts commit 70b61f08618c34f4604bebc2ad2b8d71f90cca5e.

5 years agoMerge branch 'fix-windows-version' of https://github.com/wohali/couchdb-couch
Joan Touzet [Mon, 12 Sep 2016 19:52:51 +0000 (15:52 -0400)] 
Merge branch 'fix-windows-version' of https://github.com/wohali/couchdb-couch

5 years agoFix Windows version string determination 197/head
Joan Touzet [Mon, 12 Sep 2016 19:28:31 +0000 (15:28 -0400)] 
Fix Windows version string determination

For some reason, the COUCHD_VERSION string on Windows is getting
suffixed whitespace. We fix this by string:strip(Version0, right) on the
variable before use.

5 years agoget version from environment in cross-platform way
Robert Newson [Mon, 12 Sep 2016 09:28:51 +0000 (10:28 +0100)] 
get version from environment in cross-platform way

5 years agoGet couch version from environment not git
Robert Newson [Sun, 11 Sep 2016 11:47:51 +0000 (12:47 +0100)] 
Get couch version from environment not git

5 years agoMerge branch '3140-disable-queue-as-fifo-test' of https://github.com/wohali/couchdb...
Joan Touzet [Sun, 11 Sep 2016 08:54:27 +0000 (04:54 -0400)] 
Merge branch '3140-disable-queue-as-fifo-test' of https://github.com/wohali/couchdb-couch

5 years agoDisable should_process_waiting_queue_as_fifo test 196/head
Joan Touzet [Sun, 11 Sep 2016 06:24:40 +0000 (02:24 -0400)] 
Disable should_process_waiting_queue_as_fifo test

COUCHDB-3140

This PR disables the problematic queue-as-fifo test. As written, any
call in a test to spawn_client/1 returns immediately, and does not
guarantee that the call to couch_query_servers:get_ddoc_process/2
returns before control flow proceeds to the next line in the eunit test.
As it turns out, on Windows, the call to spawn_client for ddoc5 succeeds
prior to the ddoc4 call in this test, thus always failing.

Insertion of a timer:sleep/1 call between the spawn_client/1 calls seems
to solve the problem, but even this is "lucky" behaviour. Semantically
the way this test is written, with spawn_client/1 using spawn/1 to spin
off the actual get_ddoc_process/2 call, there is no guarantee that the
couch_proc_manager FIFO queue is being populated correctly.

Further, if the get_ddoc_process/2 call takes longer than the defined
timeout (5000 ms) this test will always fail, as no provision is made to
keep trying for an os_process after that time. Again we are "lucky" that
the test runs fast enough that this is not a problem, but relying on a
performant BEAM VM for test success in any regard is equally
problematic.

For this reason I am completely commenting out this test until the
harness can be fixed. I believe the impact to couchdb is minimal.

(It also suggests we may want to rethink how requests for os processes
are queued and issued at some point in the future; this approach seems
sub-optimal, especially if strict FIFO ordering is an expectation of the
system.)

/cc @eiri @rnewson @janl

5 years agoFix unused variables warning
Robert Newson [Sat, 10 Sep 2016 09:03:54 +0000 (10:03 +0100)] 
Fix unused variables warning

UserCtx was available here in the past so we could upgrade password
hashes when authenticating. In the clustered case we found this to be
messy as multiple attempts to upgrade the same document would occur
close together. For 2.0, we elected to remove this upgrade-on-auth
path.

5 years agooption to disable runtime code evaluation
Randall Leeds [Sun, 24 Apr 2016 00:49:34 +0000 (17:49 -0700)] 
option to disable runtime code evaluation

5 years agoMerge remote branch 'cloudant:3114-fix-docid-validation'
Eric Avdey [Thu, 1 Sep 2016 14:10:27 +0000 (11:10 -0300)] 
Merge remote branch 'cloudant:3114-fix-docid-validation'

This closes #193

Signed-off-by: Eric Avdey <eiri@eiri.ca>
5 years agoFix validation for ddoc name 193/head
Eric Avdey [Thu, 1 Sep 2016 12:51:14 +0000 (09:51 -0300)] 
Fix validation for ddoc name

5 years agofeat: allow couchspawnkillable to live in directories with spaces
Jan Lehnardt [Wed, 31 Aug 2016 19:39:13 +0000 (21:39 +0200)] 
feat: allow couchspawnkillable to live in directories with spaces

5 years agoMerge remote branch 'cloudant:3102-fix-config_subscription'
ILYA Khlopotov [Tue, 23 Aug 2016 21:59:27 +0000 (14:59 -0700)] 
Merge remote branch 'cloudant:3102-fix-config_subscription'

This closes #192

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
5 years agoUse `define` to avoid repeating yourself 192/head
ILYA Khlopotov [Tue, 23 Aug 2016 20:15:57 +0000 (13:15 -0700)] 
Use `define` to avoid repeating yourself

COUCHDB-3102

5 years agoUpdate handle_config_terminate API
ILYA Khlopotov [Wed, 17 Aug 2016 18:24:08 +0000 (11:24 -0700)] 
Update handle_config_terminate API

COUCHDB-3102

5 years agoMerge remote branch 'cloudant:66640-simplify-proc_manager'
Eric Avdey [Tue, 16 Aug 2016 15:08:56 +0000 (12:08 -0300)] 
Merge remote branch 'cloudant:66640-simplify-proc_manager'

This closes #191

Signed-off-by: Eric Avdey <eiri@eiri.ca>
5 years agoAdd tests for process pool 191/head
Eric Avdey [Mon, 15 Aug 2016 16:45:20 +0000 (13:45 -0300)] 
Add tests for process pool

This adds tests for re-use of procs,
proper waiters dequeue and idle pool reduction

5 years agoSimplify proc manager assignment logic
Eric Avdey [Thu, 11 Aug 2016 20:45:32 +0000 (17:45 -0300)] 
Simplify proc manager assignment logic

This changes how proc manager handles proc assignment.
Instead of doing this in three different places:
get_proc call handler, return_proc/2 with maybe_assign_proc
and flush_waiters/2, proc manager now just places
all the incoming requests in the waiting queue
and then flushes it.

As a result all the logic kept in one place which makes
it more obvious that we are treating proc management
as a processing of a single FIFO queue
with "soft" and "hard" upper limits.

Consequently this is fixing a bug in maybe_assign_proc
where it was possible to assign a client a process
that wasn't aware of it.

COUCHDB-3095

5 years agoMerge remote branch 'cloudant:3080-fix-validate_dbname'
ILYA Khlopotov [Wed, 10 Aug 2016 19:35:58 +0000 (12:35 -0700)] 
Merge remote branch 'cloudant:3080-fix-validate_dbname'

This closes #188

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
5 years agoFix the case when DbName contains path to db file 188/head
ILYA Khlopotov [Mon, 25 Jul 2016 22:23:30 +0000 (15:23 -0700)] 
Fix the case when DbName contains path to db file

In the case when DbName contains the file name we need to remove .couch
extension in order to match ?DBNAME_REGEX.

COUCHDB-3080

5 years agoFactor out maybe_remove_extension/1 function
ILYA Khlopotov [Mon, 25 Jul 2016 22:22:04 +0000 (15:22 -0700)] 
Factor out maybe_remove_extension/1 function

COUCHDB-3080

5 years agoupdate tests for COUCHDB-3084
Robert Newson [Thu, 4 Aug 2016 09:57:37 +0000 (10:57 +0100)] 
update tests for COUCHDB-3084

5 years agoDon't set "authenticated" if party_mode_handler sets user context 189/head
Robert Newson [Wed, 27 Jul 2016 19:07:23 +0000 (20:07 +0100)] 
Don't set "authenticated" if party_mode_handler sets user context

Patch suggested by Ilya.

COUCHDB-3084

5 years agoStart couch_log for tests
Paul J. Davis [Fri, 22 Jul 2016 12:45:59 +0000 (07:45 -0500)] 
Start couch_log for tests

Now that there's a supervision tree involved we have to start the app to
use it.

5 years agoMerge remote branch 'cloudant:70457-use-couch_epi-decide'
ILYA Khlopotov [Mon, 18 Jul 2016 19:12:44 +0000 (12:12 -0700)] 
Merge remote branch 'cloudant:70457-use-couch_epi-decide'

This closes #187

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
5 years agoName test cases 187/head
ILYA Khlopotov [Mon, 18 Jul 2016 18:52:01 +0000 (11:52 -0700)] 
Name test cases

COUCHDB-3066

5 years agoUse couch_epi:decide for validate_dbname
ILYA Khlopotov [Mon, 18 Jul 2016 18:49:51 +0000 (11:49 -0700)] 
Use couch_epi:decide for validate_dbname

COUCHDB-3066

5 years agotest: use global test timeout macro, should fix test on slow ci vms
Jan Lehnardt [Sat, 16 Jul 2016 10:21:08 +0000 (12:21 +0200)] 
test: use global test timeout macro, should fix test on slow ci vms

5 years agoFix Windows-specific definition
Joan Touzet [Thu, 14 Jul 2016 05:57:27 +0000 (01:57 -0400)] 
Fix Windows-specific definition

5 years agoremove unneded include
Joan Touzet [Thu, 14 Jul 2016 02:39:28 +0000 (22:39 -0400)] 
remove unneded include

5 years agoMerge branch '3040-skip-os-daemon-tests' of https://github.com/wohali/couchdb-couch
Joan Touzet [Wed, 13 Jul 2016 19:58:02 +0000 (15:58 -0400)] 
Merge branch '3040-skip-os-daemon-tests' of https://github.com/wohali/couchdb-couch

5 years agoSkip couchdb_os_daemons_tests on Windows 184/head
Joan Touzet [Wed, 13 Jul 2016 07:52:03 +0000 (03:52 -0400)] 
Skip couchdb_os_daemons_tests on Windows

5 years agoMerge branch '3057-add-couch-js-sleep-test-suite-helper'
Paul J. Davis [Tue, 12 Jul 2016 21:09:03 +0000 (16:09 -0500)] 
Merge branch '3057-add-couch-js-sleep-test-suite-helper'

5 years agoAdd sleep as a test suite function 183/head
Paul J. Davis [Tue, 12 Jul 2016 20:13:47 +0000 (15:13 -0500)] 
Add sleep as a test suite function

This adds a class of test suite functions that are only available when a
command line switch is passed to couchjs. This so that the JavaScript
test suite has access to some helpful additional functions that aren't
part of the JavaScript language.

This particular change only adds a single `sleep` function which takes a
single argument as the number of milliseconds to sleep.

COUCHDB-3057

5 years agoMerge remote branch 'cloudant:remove_upgrade_password_hash'
ILYA Khlopotov [Wed, 6 Jul 2016 21:14:30 +0000 (14:14 -0700)] 
Merge remote branch 'cloudant:remove_upgrade_password_hash'

This closes #182

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
5 years agoRemove maybe_upgrade_password_hash 182/head
ILYA Khlopotov [Wed, 6 Jul 2016 20:51:03 +0000 (13:51 -0700)] 
Remove maybe_upgrade_password_hash

Starting from 411c130ea63c3423d7ea71743095dfb446680da6 we accidentially
upgrading user's password to pbkdf.
Removing upgrade code.

5 years agoMerge remote branch 'cloudant:changes-tests-refactoring'
Eric Avdey [Wed, 6 Jul 2016 14:36:47 +0000 (11:36 -0300)] 
Merge remote branch 'cloudant:changes-tests-refactoring'

This closes #180

Signed-off-by: Eric Avdey <eiri@eiri.ca>
5 years agoFix typo in a test label 180/head
Eric Avdey [Fri, 24 Jun 2016 14:57:42 +0000 (11:57 -0300)] 
Fix typo in a test label

5 years agoMonitor changes consumer in the tests
Eric Avdey [Fri, 24 Jun 2016 14:57:13 +0000 (11:57 -0300)] 
Monitor changes consumer in the tests

5 years agoMerge remote branch 'cloudant:64790-fix-changes-view-filter-for-clustered-access'
Eric Avdey [Wed, 6 Jul 2016 14:25:11 +0000 (11:25 -0300)] 
Merge remote branch 'cloudant:64790-fix-changes-view-filter-for-clustered-access'

This closes #181

Signed-off-by: Eric Avdey <eiri@eiri.ca>
6 years agoAdd fast_view filter to changes clustered access 181/head
Eric Avdey [Fri, 24 Jun 2016 16:32:37 +0000 (13:32 -0300)] 
Add fast_view filter to changes clustered access

A changes feed can be filtered using view's btree
instead of a database btree, a feature known as fast_view.
This feature not implemented on a clustered interface,
however view filter automatically marked as fast_view
when ddoc has option seq_indexed enabled, which leads to
a crash of filtered replication.

This change allows fast_view filter to be processed
as a regular view filter when used on a clustered
interface.

6 years agoAdd the tests for _view filtered changes
Eric Avdey [Fri, 24 Jun 2016 16:31:05 +0000 (13:31 -0300)] 
Add the tests for _view filtered changes

6 years agoMerge remote branch 'cloudant:fix_some_specs'
ILYA Khlopotov [Thu, 23 Jun 2016 17:51:39 +0000 (10:51 -0700)] 
Merge remote branch 'cloudant:fix_some_specs'

This closes #179

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
6 years agoRemove dead code 179/head
ILYA Khlopotov [Wed, 22 Jun 2016 17:30:33 +0000 (10:30 -0700)] 
Remove dead code

{error, Reason} handling has been removed since teach_ddoc function
never returns it.

6 years agoFix some dialyzer warnings
ILYA Khlopotov [Wed, 22 Jun 2016 17:30:19 +0000 (10:30 -0700)] 
Fix some dialyzer warnings

6 years agoFix couch_key_tree:merge_extend arg types
ILYA Khlopotov [Wed, 22 Jun 2016 17:29:47 +0000 (10:29 -0700)] 
Fix couch_key_tree:merge_extend arg types

6 years agoDead code elimination
ILYA Khlopotov [Wed, 22 Jun 2016 17:29:11 +0000 (10:29 -0700)] 
Dead code elimination

6 years agoRemove race condition-prone upgrade_on_auth code
Robert Newson [Tue, 21 Jun 2016 12:03:29 +0000 (13:03 +0100)] 
Remove race condition-prone upgrade_on_auth code

Hashes are still upgraded on next password change

COUCHDB-2991

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

This closes #178

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
6 years agoAdd test suite for _list functionality 178/head
ILYA Khlopotov [Fri, 17 Jun 2016 23:23:04 +0000 (16:23 -0700)] 
Add test suite for _list functionality

COUCHDB-2847

6 years agoMerge remote branch 'cloudant:fix-some-type-errors'
ILYA Khlopotov [Wed, 25 May 2016 17:39:15 +0000 (10:39 -0700)] 
Merge remote branch 'cloudant:fix-some-type-errors'

This closes #176

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
6 years agocouch_proc_manager:remove_proc expects #proc_int{} record 176/head
ILYA Khlopotov [Wed, 25 May 2016 00:35:40 +0000 (17:35 -0700)] 
couch_proc_manager:remove_proc expects #proc_int{} record

6 years agogen_server: handle_call suppose to return `{reply, Res, State}`
ILYA Khlopotov [Wed, 25 May 2016 00:34:50 +0000 (17:34 -0700)] 
gen_server: handle_call suppose to return `{reply, Res, State}`

6 years agocouch_file:process_info can return `undefined`
ILYA Khlopotov [Wed, 25 May 2016 00:33:57 +0000 (17:33 -0700)] 
couch_file:process_info can return `undefined`

6 years agoget_user_creds can receive nil as first arg
ILYA Khlopotov [Wed, 25 May 2016 00:33:16 +0000 (17:33 -0700)] 
get_user_creds can receive nil as first arg

6 years agoMerge remote branch 'github/pr/175'
Eric Avdey [Tue, 24 May 2016 17:11:22 +0000 (14:11 -0300)] 
Merge remote branch 'github/pr/175'

This closes #175

Signed-off-by: Eric Avdey <eiri@eiri.ca>
6 years agoSet default_security for oauth tests to everyone 175/head
Eric Avdey [Thu, 19 May 2016 14:22:52 +0000 (11:22 -0300)] 
Set default_security for oauth tests to everyone

6 years agoMerge remote branch 'cloudant:create_db_if_missing'
ILYA Khlopotov [Wed, 18 May 2016 14:46:46 +0000 (07:46 -0700)] 
Merge remote branch 'cloudant:create_db_if_missing'

This closes #174

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
6 years agoSupport create_if_missing option in couch_db:open 174/head
ILYA Khlopotov [Tue, 17 May 2016 23:44:13 +0000 (16:44 -0700)] 
Support create_if_missing option in couch_db:open

6 years agoMerge remote branch 'github/pr/173'
Eric Avdey [Tue, 17 May 2016 21:16:10 +0000 (18:16 -0300)] 
Merge remote branch 'github/pr/173'

This closes #173

Signed-off-by: Eric Avdey <eiri@eiri.ca>
6 years agoAdd stats counters for exceed_eof and exceed_limit 173/head
Eric Avdey [Mon, 16 May 2016 19:47:36 +0000 (16:47 -0300)] 
Add stats counters for exceed_eof and exceed_limit

6 years agoImplement config parameter max_pread_size
Eric Avdey [Mon, 16 May 2016 16:55:52 +0000 (13:55 -0300)] 
Implement config parameter max_pread_size

6 years agoRaise exception on attempt of reading beyound end of file
Eric Avdey [Mon, 16 May 2016 13:15:38 +0000 (10:15 -0300)] 
Raise exception on attempt of reading beyound end of file

6 years agoMerge remote-tracking branch 'cloudant/2863-fix-couch-key-tree-get-key-leafs-2'
Robert Newson [Mon, 16 May 2016 17:43:59 +0000 (18:43 +0100)] 
Merge remote-tracking branch 'cloudant/2863-fix-couch-key-tree-get-key-leafs-2'

6 years agoFix couch_key_tree:get_key_leafs/2 167/head
Paul J. Davis [Thu, 21 Apr 2016 20:28:54 +0000 (15:28 -0500)] 
Fix couch_key_tree:get_key_leafs/2

This is a fix for a long standing bug when retrieving all leaf keys for
a given set of keys. Before this patch we would incorrectly return some
keys as missing if they happened to be deeper on a branch for a key that
was found if they weren't themselves a leaf key.

COUCHDB-2863

6 years agoMerge remote-tracking branch 'cloudant/2863-export-couch-key-tree-merge-2'
Robert Newson [Mon, 16 May 2016 09:28:37 +0000 (10:28 +0100)] 
Merge remote-tracking branch 'cloudant/2863-export-couch-key-tree-merge-2'

6 years agoAdd admin_local - halfway between the two schemes 172/head
Robert Newson [Sun, 15 May 2016 19:32:45 +0000 (20:32 +0100)] 
Add admin_local - halfway between the two schemes

COUCHDB-3016

6 years agoAllow customisation of default security object 171/head
Robert Newson [Tue, 10 May 2016 19:59:38 +0000 (20:59 +0100)] 
Allow customisation of default security object

COUCHDB-3016

6 years agoMerge remote branch 'github/pr/169'
Eric Avdey [Tue, 3 May 2016 19:04:19 +0000 (16:04 -0300)] 
Merge remote branch 'github/pr/169'

This closes #169

Signed-off-by: Eric Avdey <eiri@eiri.ca>
6 years agoRaise an exception on corrupt binary decompression 169/head
Eric Avdey [Tue, 3 May 2016 17:58:51 +0000 (14:58 -0300)] 
Raise an exception on corrupt binary decompression

6 years agoAdd tests for couch_compress module
Eric Avdey [Tue, 3 May 2016 16:36:52 +0000 (13:36 -0300)] 
Add tests for couch_compress module

6 years agoMerge remote branch 'github/pr/161'
Eric Avdey [Thu, 28 Apr 2016 16:19:42 +0000 (13:19 -0300)] 
Merge remote branch 'github/pr/161'

This closes #161

Signed-off-by: Eric Avdey <eiri@eiri.ca>
6 years agoAllow to specify context of file deletion 161/head
Eric Avdey [Tue, 26 Apr 2016 13:58:55 +0000 (10:58 -0300)] 
Allow to specify context of file deletion

Function couch_file:delete/2,3 called on the files both during a user initiated
database deletion and database and view compaction. We want the config
parameter `enable_database_recovery` to be respected for the former,
but not the latter.

To achive that the third attribute in `couch_file:delete/3` changed from
async deletion flag to options list. It might consist tuple {context, Context}
where Context can take value `compaction` (default) or `delete`.

6 years agoExtend `enable_database_recovery` behaviour to views directories
Eric Avdey [Mon, 25 Apr 2016 18:02:42 +0000 (15:02 -0300)] 
Extend `enable_database_recovery` behaviour to views directories

If config option `enable_database_recovery` set to true then during database
deletion all its ddoc's directories that hold view files will be renamed
in the same fashion as database file, i.e. with added timestamp and
suffix "deleted"

6 years agoAdd `delete_after_rename` config parameter
Eric Avdey [Fri, 22 Apr 2016 17:36:45 +0000 (14:36 -0300)] 
Add `delete_after_rename` config parameter

This config parameter allows to specify if the compaction files
must to be deleted right after compaction finished
or we want to pospond this until the database restart.

If latter, the files will be kept in ".delete" directory
renamed to random uuids to avoid collision and cleaned up
during a database start in `couch_file:init_delete_dir/1` call.

6 years agoRename option `rename_on_delete` to `enable_database_recovery`
Eric Avdey [Fri, 22 Apr 2016 16:51:38 +0000 (13:51 -0300)] 
Rename option `rename_on_delete` to `enable_database_recovery`

Since internally we always rename files before deletion due to
performance optimization, this option got changed to avoid confusion
and clearify the intent.

6 years agoExplicitly update mtime of the renamed files
Eric Avdey [Fri, 22 Apr 2016 14:15:01 +0000 (11:15 -0300)] 
Explicitly update mtime of the renamed files

6 years agoMove all functions related to file deletion in `couch_file` module
Eric Avdey [Fri, 22 Apr 2016 14:09:59 +0000 (11:09 -0300)] 
Move all functions related to file deletion in `couch_file` module

6 years agoMake couch_server:delete_file response to match couch_file:delete
Eric Avdey [Wed, 20 Apr 2016 15:01:01 +0000 (12:01 -0300)] 
Make couch_server:delete_file response to match couch_file:delete

Function `couch_server:delete_file` returns tuples with either `deleted`
or `{renamed, Filename}` tags. We don't use this format for anything
and it contradicts general notion of `couch_file:delete` to keep response
in-line with erlang's module `file` symantics.

6 years agoMerge remote branch 'cloudant:1425-fix-character-advancement'
ILYA Khlopotov [Thu, 28 Apr 2016 15:35:30 +0000 (08:35 -0700)] 
Merge remote branch 'cloudant:1425-fix-character-advancement'

This closes #168

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
6 years agoUndo our character advancement when we fixup 168/head
ILYA Khlopotov [Wed, 27 Apr 2016 00:35:03 +0000 (17:35 -0700)] 
Undo our character advancement when we fixup

We should undo our character advancement after we finish fixup.

COUCHDB-1425

6 years agoExport couch_key_tree:merge/2 166/head
Paul J. Davis [Thu, 21 Apr 2016 20:38:25 +0000 (15:38 -0500)] 
Export couch_key_tree:merge/2

This is needed by fabric_doc_open_revs to fix COUCHDB-2863.

COUCHDB-2863

6 years agoMerge remote branch 'cloudant:3001-use-ioq-for-prompt'
ILYA Khlopotov [Thu, 21 Apr 2016 19:03:14 +0000 (12:03 -0700)] 
Merge remote branch 'cloudant:3001-use-ioq-for-prompt'

This closes #165

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
6 years agoUse ioq to separately prioritise prompt requests 165/head
ILYA Khlopotov [Thu, 21 Apr 2016 18:52:07 +0000 (11:52 -0700)] 
Use ioq to separately prioritise prompt requests

COUCHDB-3001

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

This closes #160

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
6 years agoChange normalize_dbname semantic add dbname_suffix 160/head
ILYA Khlopotov [Fri, 8 Apr 2016 17:47:24 +0000 (10:47 -0700)] 
Change normalize_dbname semantic add dbname_suffix

normalize_dbname used to return last componenent of the shard path. But
it was doing so only if argument was passed as a binary. We change the
semantic of normalize_dbname so it does following:

  1. expects either type binary or list
  2. expect any kind of database name
     - plain database name
     - plain database name with '.couch' extension
     - shard name with suffix (creation time)
     - shard name with suffix (creation time) and .couch extension
  3. always returns a binary containing all components of a database name
  4. removes information about shard
  5. removes shard's suffix

For cases we need last component of the path (old behaviour) we
intoroduce dbname_suffix/1

COUCHDB-2983

6 years agoMerge remote-tracking branch 'cloudant/couchdb-2834'
Robert Newson [Tue, 19 Apr 2016 10:16:16 +0000 (11:16 +0100)] 
Merge remote-tracking branch 'cloudant/couchdb-2834'

6 years agoWhen reading attachments, avoid closing connections too early 164/head
Nick Vatamaniuc [Tue, 19 Apr 2016 04:59:30 +0000 (00:59 -0400)] 
When reading attachments, avoid closing connections too early

Signal mochiweb to not send connection:close headers
in order for the socket to be reused.

Before this commit, this signaling was done too late.

COUCHDB-2834

6 years agoheaders specified in a JS rewrite can come back as binaries.
Jan Lehnardt [Mon, 18 Apr 2016 09:48:22 +0000 (11:48 +0200)] 
headers specified in a JS rewrite can come back as binaries.

fixes rewrites_js JS test.

6 years agoImplement Mango selectors for change feeds 162/head
Nick Vatamaniuc [Thu, 14 Apr 2016 21:29:00 +0000 (17:29 -0400)] 
Implement Mango selectors for change feeds

API is modeled after _doc_ids filter for change feeds.

User POSTs to {db}/_changes with `filter=_selector`.
Document body should have a "selector" field, with
a Mango selector object as value.

For example:
```
http http://.../d1/_changes?filter=_selector
{
  "selector": {"z" : {"$gte" : 1} }
}
```

Jira: COUCHDB-2988

6 years agoCreate md5 etag for _local docs local-docs-2978 159/head 257/head
Garren Smith [Thu, 7 Apr 2016 14:06:31 +0000 (16:06 +0200)] 
Create md5 etag for _local docs

This makes a unique ETAG for _local docs, so that they are cached
correctly, and fetched again when the document changes.

fixes COUCHDB-2978

6 years agoRevert "Merge remote branch 'github/pr/158'"
ILYA Khlopotov [Thu, 7 Apr 2016 17:50:54 +0000 (10:50 -0700)] 
Revert "Merge remote branch 'github/pr/158'"

This reverts commit 05b40a8ef7e544b1313018d000f0c6d3d6255f1a, reversing
changes made to c256ef5d098dce5b9624e117dab912205334c327.

6 years agoMerge remote branch 'github/pr/158'
ILYA Khlopotov [Thu, 7 Apr 2016 16:35:26 +0000 (09:35 -0700)] 
Merge remote branch 'github/pr/158'

This closes #158

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>