[couchdb] 05/08: Update legacy views

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feature-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 0451f30b32a32eac1e1c7376ad0f3bb32e097241
Author: Paul J. Davis 
AuthorDate: Fri Sep 18 11:05:00 2020 -0500

Update legacy views
---
 src/couch_views/include/couch_views.hrl   |   4 +
 src/couch_views/src/couch_views_fdb.erl   | 179 --
 src/couch_views/src/couch_views_indexer.erl   |   8 +-
 src/couch_views/test/couch_views_upgrade_test.erl | 400 ++
 4 files changed, 550 insertions(+), 41 deletions(-)

diff --git a/src/couch_views/include/couch_views.hrl 
b/src/couch_views/include/couch_views.hrl
index 3882191..92b8f46 100644
--- a/src/couch_views/include/couch_views.hrl
+++ b/src/couch_views/include/couch_views.hrl
@@ -10,6 +10,9 @@
 % License for the specific language governing permissions and limitations under
 % the License.
 
+% Current implementation version
+-define(CURRENT_VIEW_IMPL_VERSION, 1).
+
 % Index info/data subspaces
 -define(VIEW_INFO, 0).
 -define(VIEW_DATA, 1).
@@ -21,6 +24,7 @@
 -define(VIEW_KV_SIZE, 2).
 -define(VIEW_BUILD_STATUS, 3).
 -define(VIEW_CREATION_VS, 4).
+-define(VIEW_IMPL_VERSION, 5).
 
 % Data keys
 -define(VIEW_ID_RANGE, 0).
diff --git a/src/couch_views/src/couch_views_fdb.erl 
b/src/couch_views/src/couch_views_fdb.erl
index 3116e61..f22277d 100644
--- a/src/couch_views/src/couch_views_fdb.erl
+++ b/src/couch_views/src/couch_views_fdb.erl
@@ -13,6 +13,8 @@
 -module(couch_views_fdb).
 
 -export([
+get_view_state/2,
+
 new_interactive_index/3,
 new_creation_vs/3,
 get_creation_vs/2,
@@ -50,52 +52,89 @@
 -include_lib("fabric/include/fabric2.hrl").
 
 
-new_interactive_index(Db, Mrst, VS) ->
-couch_views_fdb:new_creation_vs(Db, Mrst, VS),
-couch_views_fdb:set_build_status(Db, Mrst, ?INDEX_BUILDING).
+get_view_state(Db, #mrst{} = Mrst) ->
+get_view_state(Db, Mrst#mrst.sig);
+
+get_view_state(Db, Sig) when is_binary(Sig) ->
+#{
+tx := Tx
+} = Db,
+
+VersionF = erlfdb:get(Tx, version_key(Db, Sig)),
+ViewSeqF = erlfdb:get(Tx, seq_key(Db, Sig)),
+ViewVSF = erlfdb:get(Tx, creation_vs_key(Db, Sig)),
+BuildStatusF = erlfdb:get(Tx, build_status_key(Db, Sig)),
+
+Version = case erlfdb:wait(VersionF) of
+not_found -> not_found;
+VsnVal -> element(1, erlfdb_tuple:unpack(VsnVal))
+end,
+
+ViewSeq = case erlfdb:wait(ViewSeqF) of
+not_found -> <<>>;
+SeqVal -> SeqVal
+end,
+
+ViewVS = case erlfdb:wait(ViewVSF) of
+not_found -> not_found;
+VSVal -> element(1, erlfdb_tuple:unpack(VSVal))
+end,
+
+State = #{
+version => Version,
+view_seq => ViewSeq,
+view_vs => ViewVS,
+build_status => erlfdb:wait(BuildStatusF)
+},
+
+maybe_upgrade_view(Db, Sig, State).
+
+
+new_interactive_index(Db, #mrst{} = Mrst, VS) ->
+new_interactive_index(Db, Mrst#mrst.sig, VS);
+
+new_interactive_index(Db, Sig, VS) ->
+set_version(Db, Sig),
+new_creation_vs(Db, Sig, VS),
+set_build_status(Db, Sig, ?INDEX_BUILDING).
 
 
 %Interactive View Creation Versionstamp
 %(, ?DB_VIEWS, ?VIEW_INFO, ?VIEW_CREATION_VS, Sig) = VS
 
 new_creation_vs(TxDb, #mrst{} = Mrst, VS) ->
+new_creation_vs(TxDb, Mrst#mrst.sig, VS);
+
+new_creation_vs(TxDb, Sig, VS) ->
 #{
 tx := Tx
 } = TxDb,
-Key = creation_vs_key(TxDb, Mrst#mrst.sig),
+Key = creation_vs_key(TxDb, Sig),
 Value = erlfdb_tuple:pack_vs({VS}),
 ok = erlfdb:set_versionstamped_value(Tx, Key, Value).
 
 
-get_creation_vs(TxDb, #mrst{} = Mrst) ->
-get_creation_vs(TxDb, Mrst#mrst.sig);
-
-get_creation_vs(TxDb, Sig) ->
+get_creation_vs(TxDb, MrstOrSig) ->
 #{
-tx := Tx
-} = TxDb,
-Key = creation_vs_key(TxDb, Sig),
-case erlfdb:wait(erlfdb:get(Tx, Key)) of
-not_found ->
-not_found;
-EK ->
-{VS} = erlfdb_tuple:unpack(EK),
-VS
-end.
+view_vs := ViewVS
+} = get_view_state(TxDb, MrstOrSig),
+ViewVS.
 
 
 %Interactive View Build Status
 %(, ?DB_VIEWS, ?VIEW_INFO, ?VIEW_BUILD_STATUS, Sig) = INDEX_BUILDING | 
INDEX_READY
 
-get_build_status(TxDb, #mrst{sig = Sig}) ->
+get_build_status(TxDb, MrstOrSig) ->
 #{
-tx := Tx
-} = TxDb,
-Key = build_status_key(TxDb, Sig),
-erlfdb:wait(erlfdb:get(Tx, Key)).
+build_status := BuildStatus
+} = get_view_state(TxDb, MrstOrSig),
+BuildStatus.
+
 
+set_build_status(TxDb, #mrst{} = Mrst, State) ->
+set_build_status(TxDb, Mrst#mrst.sig, State);
 
-set_build_status(TxDb, #mrst{sig = Sig}, State) ->
+set_build_status(TxDb, Sig, State) ->
 #{
 tx := Tx
 } = TxDb,
@@ -108,24 +147,18 @@ set_build_status(TxDb, #mrst{sig = Sig}, State) ->
 % (, ?DB_VIEWS, Sig, ?VIEW_UPDATE_SEQ) = Sequence
 
 
-get_update_seq(TxDb, #mrst{sig = Sig}) ->
+get_update_se

[couchdb] 03/08: Views on ebtree

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feature-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 0d49a1121afc118fe0b9d355c26dfffcd01a14b7
Author: Paul J. Davis 
AuthorDate: Fri Jul 24 10:59:05 2020 -0500

Views on ebtree
---
 rel/overlay/etc/default.ini   |   6 +
 src/couch_views/include/couch_views.hrl   |   5 +
 src/couch_views/src/couch_views.erl   |  55 +-
 src/couch_views/src/couch_views_fdb.erl   | 629 +-
 src/couch_views/src/couch_views_indexer.erl   |  56 +-
 src/couch_views/src/couch_views_reader.erl| 115 ++--
 src/couch_views/src/couch_views_updater.erl   |  13 +-
 src/couch_views/src/couch_views_util.erl  |  35 ++
 src/couch_views/test/couch_views_cleanup_test.erl |   2 +-
 src/couch_views/test/couch_views_indexer_test.erl |  52 +-
 src/couch_views/test/couch_views_size_test.erl|  25 +-
 src/couch_views/test/couch_views_updater_test.erl |   2 +-
 src/mango/src/mango_cursor_view.erl   |  14 +-
 src/mango/src/mango_idx_view.erl  |   7 +-
 src/mango/src/mango_idx_view.hrl  |  13 +
 15 files changed, 600 insertions(+), 429 deletions(-)

diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index abcf0bd..addacab 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -337,6 +337,12 @@ iterations = 10 ; iterations for password hashing
 ; The maximum allowed value size emitted from a view for a document (in bytes)
 ;value_size_limit = 64000
 ;
+; The order of B+Tree nodes used by the id btree
+;id_btree_node_size = 100
+;
+; The order of B+Tree nodes used by view btrees
+;view_btree_node_size = 100
+;
 ; Batch size sensing parameters
 ; batch_initial_size = 100 ; Initial batch size in number of documents
 ; batch_search_increment = 500 ; Size change when searching for the threshold
diff --git a/src/couch_views/include/couch_views.hrl 
b/src/couch_views/include/couch_views.hrl
index 3d0110f..3882191 100644
--- a/src/couch_views/include/couch_views.hrl
+++ b/src/couch_views/include/couch_views.hrl
@@ -13,6 +13,7 @@
 % Index info/data subspaces
 -define(VIEW_INFO, 0).
 -define(VIEW_DATA, 1).
+-define(VIEW_TREES, 3).
 
 % Index info keys
 -define(VIEW_UPDATE_SEQ, 0).
@@ -25,6 +26,10 @@
 -define(VIEW_ID_RANGE, 0).
 -define(VIEW_MAP_RANGE, 1).
 
+% Tree keys
+-define(VIEW_ID_TREE, 0).
+-define(VIEW_ROW_TREES, 1).
+
 % jobs api
 -define(INDEX_JOB_TYPE, <<"views">>).
 
diff --git a/src/couch_views/src/couch_views.erl 
b/src/couch_views/src/couch_views.erl
index d9ba0c1..525866e 100644
--- a/src/couch_views/src/couch_views.erl
+++ b/src/couch_views/src/couch_views.erl
@@ -48,11 +48,7 @@ query(Db, DDoc, ViewName, Callback, Acc0, Args0) ->
 Args1 = to_mrargs(Args0),
 Args2 = couch_mrview_util:set_view_type(Args1, ViewName, Views),
 Args3 = couch_mrview_util:validate_args(Args2),
-ok = check_range(Args3),
-case is_reduce_view(Args3) of
-true -> throw(not_implemented);
-false -> ok
-end,
+ok = check_range(Mrst, ViewName, Args3),
 
 try
 fabric2_fdb:transactional(Db, fun(TxDb) ->
@@ -100,9 +96,10 @@ get_info(Db, DDoc) ->
 {ok, Mrst} = couch_views_util:ddoc_to_mrst(DbName, DDoc),
 Sig = fabric2_util:to_hex(Mrst#mrst.sig),
 {UpdateSeq, DataSize, Status} = fabric2_fdb:transactional(Db, fun(TxDb) ->
-Seq = couch_views_fdb:get_update_seq(TxDb, Mrst),
-DataSize = get_total_view_size(TxDb, Mrst),
-JobStatus = case couch_views_jobs:job_state(TxDb, Mrst) of
+Mrst1 = couch_views_fdb:set_trees(TxDb, Mrst),
+Seq = couch_views_fdb:get_update_seq(TxDb, Mrst1),
+DataSize = get_total_view_size(TxDb, Mrst1),
+JobStatus = case couch_views_jobs:job_state(TxDb, Mrst1) of
 {ok, pending} -> true;
 {ok, running} -> true;
 {ok, finished} -> false;
@@ -124,10 +121,9 @@ get_info(Db, DDoc) ->
 
 
 get_total_view_size(TxDb, Mrst) ->
-ViewIds = [View#mrview.id_num || View <- Mrst#mrst.views],
-lists:foldl(fun (ViewId, Total) ->
-Total + couch_views_fdb:get_kv_size(TxDb, Mrst, ViewId)
-end, 0, ViewIds).
+lists:foldl(fun(View, Total) ->
+Total + couch_views_fdb:get_kv_size(TxDb, View)
+end, 0, Mrst#mrst.views).
 
 
 read_view(Db, Mrst, ViewName, Callback, Acc0, Args) ->
@@ -185,16 +181,29 @@ to_mrargs(#{} = Args) ->
 end, #mrargs{}, Args).
 
 
-check_range(#mrargs{start_key = undefined}) ->
+check_range(Mrst, ViewName, Args) ->
+#mrst{
+language = Lang,
+views = Views
+} = Mrst,
+View = case couch_mrview_util:extract_view(Lang, Args, ViewName, Views) of
+{map, V, _} -> V;
+{red, {_, _, V}, _} -> V
+end,
+Cmp = couch_views_util:collate_fun(View),
+check_range(Args, Cmp).
+
+
+check_range(#mrargs{start_key = undefined}, _C

[couchdb] 01/08: Calculate external JSON size of a view row

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feature-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 2bb9b4f2a1da4d6552d9b228aa39e4f218e4ae92
Author: Paul J. Davis 
AuthorDate: Fri Jul 24 10:58:53 2020 -0500

Calculate external JSON size of a view row
---
 src/couch/src/couch_ejson_size.erl | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/couch/src/couch_ejson_size.erl 
b/src/couch/src/couch_ejson_size.erl
index f550568..76e3924 100644
--- a/src/couch/src/couch_ejson_size.erl
+++ b/src/couch/src/couch_ejson_size.erl
@@ -15,6 +15,11 @@
 -export([encoded_size/1]).
 
 
+%% View rows
+
+encoded_size({EJson, DocId}) when is_binary(DocId) ->
+encoded_size(EJson) + encoded_size(DocId);
+
 %% Compound objects
 
 encoded_size({[]}) ->



[couchdb] 02/08: Export fabric2_fdb:chunkify_binary/1,2

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feature-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 96e0bcdba55bfc50864b1a74eb41fbf1b76d1bde
Author: Paul J. Davis 
AuthorDate: Thu Aug 6 12:34:29 2020 -0500

Export fabric2_fdb:chunkify_binary/1,2
---
 src/fabric/src/fabric2_fdb.erl | 33 ++---
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/fabric/src/fabric2_fdb.erl b/src/fabric/src/fabric2_fdb.erl
index 52303ce..36fa451 100644
--- a/src/fabric/src/fabric2_fdb.erl
+++ b/src/fabric/src/fabric2_fdb.erl
@@ -77,6 +77,9 @@
 
 get_approximate_tx_size/1,
 
+chunkify_binary/1,
+chunkify_binary/2,
+
 debug_cluster/0,
 debug_cluster/2
 ]).
@@ -1176,6 +1179,21 @@ get_approximate_tx_size(#{} = TxDb) ->
 erlfdb:wait(erlfdb:get_approximate_size(Tx)).
 
 
+chunkify_binary(Data) ->
+chunkify_binary(Data, binary_chunk_size()).
+
+
+chunkify_binary(Data, Size) ->
+case Data of
+<<>> ->
+[];
+<> ->
+[Head | chunkify_binary(Rest, Size)];
+<<_/binary>> when size(Data) < Size ->
+[Data]
+end.
+
+
 debug_cluster() ->
 debug_cluster(<<>>, <<16#FE, 16#FF, 16#FF>>).
 
@@ -1677,21 +1695,6 @@ sum_rem_rev_sizes(RevInfos) ->
 end, 0, RevInfos).
 
 
-chunkify_binary(Data) ->
-chunkify_data(Data, binary_chunk_size()).
-
-
-chunkify_data(Data, Size) ->
-case Data of
-<<>> ->
-[];
-<> ->
-[Head | chunkify_data(Rest, Size)];
-<<_/binary>> when size(Data) < Size ->
-[Data]
-end.
-
-
 get_fold_acc(Db, RangePrefix, UserCallback, UserAcc, Options)
 when is_map(Db) orelse Db =:= undefined ->
 



[couchdb] branch feature-ebtree-views updated (06b3542 -> 7130276)

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a change to branch feature-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 discard 06b3542  Reimplement db wide view size tracking
 discard e8d19ad  Use ebtree caching API
 discard 2313602  Optimize filtering deletions
 discard f7b0218  Fixup tests
 discard 786614d  Update to use new ebtree multi functions
 discard 4da3ab8  Measure view build stats
 discard c1656bf  Fix mango end key generation
 discard ebe009e  Add test suite for reduce views
 discard ea0fb19  Use ebtree for reduce functions
 discard 75283e2  Views on ebtree
 discard d1f762f  Export fabric2_fdb:chunkify_binary/1,2
 discard 9a178e1  Calculate external JSON size of a view row
 discard acdcc90  Merge branch 'master' into prototype/fdb-layer
 add 0399200  Fix license file
 add 4f7d1d9  allow configurability of JWT claims that require a value
 add 4398d3b  Merge pull request #2888 from apache/jwtf-iss-configurability
 add 850cc12  make jwtf_keystore compatible with erlang 19
 add 143ad31  Merge pull request #2899 from apache/jwtf-erlang-19
 add e245aa0  make jwtf_keystore compatible with erlang 19 for real this 
time
 add 474cb72  Merge pull request #2900 from apache/jwtf-erlang-19-2
 add 08a0c6b  Port rev_stemming into elixir
 add 4e64f5b  move compact and replicate functions into CouchTestCase 
shared module
 add 0be139a  2906 couchjs sm version (#2911)
 add ab93b15  feat(auth): Allow a custom JWT claim for roles
 add 10fae61  Report if FIPS mode is enabled
 add 887d740  Merge pull request #2929 from apache/report-fips-feature
 add a7803fb  In replicator, when rescheduling, pick only pending jobs 
which are not running
 add 6659dbb  Make restricted partition search parameters return bad request
 add 34baa46  fix: send CSP header to make Fauxotn work fully
 add 074789f  Upgrade Credo to 1.4.0
 add 4240391  Allow drilldown for search to always be specified as list of 
lists
 add 22dbde2  Merge pull request #2958 from 
bessbd/allow-drilldown-list-of-lists
 add c155bd5  Tests already ported to elixir
 add 5c49e0f  Skip tests as temporary views are not supported
 add c6940d8  Port reader_acl test into elixir test suite
 add eaf6e74  Port view_update_seq.js into elixir
 add 0eedd8b  fix: set gen_server:call() timeout to infinity on ioq bypass
 add 23b4aa7  Port view_collation_raw.js to elixir
 add ce22cbc  Port view_compaction test to elixir
 add fc6dbee  New cname for couchdb-vm2, see INFRA-20435 (#2982)
 add 909357e  port view_sandboxing.js into elixir
 add b518f01  port update_documents.js into elixir
 add 6944605  Port view multi_key tests into elixir
 add a817e60  fix: finish_cluster failure due to missing uuid
 add f011a66  added $keyMapMatch Mango operator
 add f43f78a  Windows: provide full path to epmd
 add e0cbe1c  Remove wrongly commited file from #2955 (#3070)
 add 57e3501  Unlink index pid and swallow EXIT message if present
 add c66694f  Merge pull request #3068 from apache/couch_index_server_crash
 add 7c9094c  Validate shard specific query params on db create request
 add 5004f99  Don't crash couch_index_server if the db isn't known yet
 add 7d9f115  Merge pull request #3075 from apache/couch_index_server_crash2
 add 11e8d0d  fixup: Build couch_js for redhat linux
 add 3091c93  Merge pull request #3056 from 
apache/build-couchjs-for-redhat-linux
 add bdfb129  Handle jiffy returning an iolist when encoding atts_since 
query string
 add 7dbd0ad  bypass partition query limit for mango
 add 3004513  update dev/run formatting to adhere to python format checks
 add ac69520  Merge pull request #3105 from apache/fix-partition-query-limit
 add c14569c  fix bookmark passing with text indexes
 add 0c3c4b6  Merge pull request #3116 from apache/fix-explain-text-indexes
 add 253d64a  Allow to continue to cleanup search index even if there is 
invalid ddoc
 add 27eefab  Merge pull request #3118 from 
apache/dreyfus-cleanup-with-invalid-ddoc
 add a57b717  Tag elixir tests into meaningful groups
 add d72a5f5  return a clean error if pem_decode fails
 add 29a5dea  Merge pull request #3125 from 
apache/improve_jwtf_keystore_error_handling
 add e7822a5  Make COPY doc return only one "ok"
 add 881f52f  Add option to delay responses until the end
 add c625517  Merge pull request #3129 from apache/delay_response_until_end
 add e4d577b  Handle malformed URLs when stripping URL creds in 
couch_replicator
 add 45ddc93  Introduce .asf.yaml file (#3020)
 add a94e693  add remonitor code to DOWN message (#3144)
 add 1c6a738  Fix buffer_response=true (#3145)
 add ac33e85  Port view_conflicts.js, view_errors.js and 
view_include_docs.js into elixir·
 add 168d635  fix race condition (#3150)
 add 6169104  Drop

[couchdb] 08/08: Measure view build stats

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feature-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 713027646750147c1f84b43e0d33a8fa2e5ecfc5
Author: Paul J. Davis 
AuthorDate: Thu Aug 13 11:58:45 2020 -0500

Measure view build stats
---
 src/couch_views/src/couch_views_indexer.erl | 69 ++---
 1 file changed, 64 insertions(+), 5 deletions(-)

diff --git a/src/couch_views/src/couch_views_indexer.erl 
b/src/couch_views/src/couch_views_indexer.erl
index 858a988..0d2554b 100644
--- a/src/couch_views/src/couch_views_indexer.erl
+++ b/src/couch_views/src/couch_views_indexer.erl
@@ -178,12 +178,15 @@ add_error(Error, Reason, Data) ->
 update(#{} = Db, Mrst0, State0) ->
 Limit = couch_views_batch:start(Mrst0),
 {Mrst1, State1} = try
-do_update(Db, Mrst0, State0#{limit => Limit})
+time_span(do_update, fun() ->
+do_update(Db, Mrst0, State0#{limit => Limit})
+end)
 catch
 error:{erlfdb_error, Error} when ?IS_RECOVERABLE_ERROR(Error) ->
 couch_views_batch:failure(Mrst0),
 update(Db, Mrst0, State0)
 end,
+stat_dump(),
 case State1 of
 finished ->
 couch_eval:release_map_context(Mrst1#mrst.qserver);
@@ -205,7 +208,9 @@ do_update(Db, Mrst0, State0) ->
 State1 = get_update_start_state(TxDb, Mrst0, State0),
 Mrst1 = couch_views_fdb:set_trees(TxDb, Mrst0),
 
-{ok, State2} = fold_changes(State1),
+{ok, State2} = time_span(fold_changes, fun() ->
+fold_changes(State1)
+end),
 
 #{
 count := Count,
@@ -217,10 +222,19 @@ do_update(Db, Mrst0, State0) ->
 design_opts := DesignOpts
 } = State2,
 
-DocAcc1 = fetch_docs(TxDb, DesignOpts, DocAcc),
+stat_incr(changes_read, length(DocAcc)),
 
-{Mrst2, MappedDocs} = map_docs(Mrst0, DocAcc1),
-TotalKVs = write_docs(TxDb, Mrst1, MappedDocs, State2),
+DocAcc1 = time_span(fetch_docs, fun() ->
+fetch_docs(TxDb, DesignOpts, DocAcc)
+end),
+
+{Mrst2, MappedDocs} = time_span(map_docs, fun() ->
+map_docs(Mrst1, DocAcc1)
+end),
+
+TotalKVs = time_span(write_docs, fun() ->
+write_docs(TxDb, Mrst2, MappedDocs, State2)
+end),
 
 ChangesDone = ChangesDone0 + length(DocAcc),
 
@@ -599,6 +613,51 @@ fail_job(Job, Data, Error, Reason) ->
 exit(normal).
 
 
+time_span(Id, Fun) ->
+Start = erlang:system_time(microsecond),
+try
+Fun()
+after
+Diff = erlang:system_time(microsecond) - Start,
+stat_store(Id, Diff / 100)
+end.
+
+
+stat_incr(Id, Count) ->
+case get('$view_stats') of
+#{Id := OldCount} ->
+stat_store(Id, OldCount + Count);
+_ ->
+stat_store(Id, Count)
+end.
+
+
+stat_store(Id, Value) ->
+NewStats = case get('$view_stats') of
+#{} = Stats ->
+maps:put(Id, Value, Stats);
+undefined ->
+#{Id => Value}
+end,
+put('$view_stats', NewStats).
+
+
+stat_dump() ->
+case get('$view_stats') of
+#{} = Stats ->
+KVs = lists:sort(maps:to_list(Stats)),
+Strs = lists:foldl(fun({Id, Value}, Acc) ->
+Str = io_lib:format("~s:~w", [Id, Value]),
+[Str | Acc]
+end, [], KVs),
+Msg = "XKCD VIEW STATS: " ++ string:join(lists:reverse(Strs),  " 
"),
+couch_log:error(Msg, []),
+put('$view_stats', #{});
+_ ->
+ok
+end.
+
+
 retry_limit() ->
 config:get_integer("couch_views", "retry_limit", 3).
 



[couchdb] 07/08: Add test suite for reduce views

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feature-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 975233c50d8c110c8b46dade767f269966866fc0
Author: Paul J. Davis 
AuthorDate: Wed Aug 5 12:47:37 2020 -0500

Add test suite for reduce views
---
 src/couch_views/test/couch_views_red_test.erl | 764 ++
 1 file changed, 764 insertions(+)

diff --git a/src/couch_views/test/couch_views_red_test.erl 
b/src/couch_views/test/couch_views_red_test.erl
new file mode 100644
index 000..875e90b
--- /dev/null
+++ b/src/couch_views/test/couch_views_red_test.erl
@@ -0,0 +1,764 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_views_red_test).
+
+-include_lib("couch/include/couch_eunit.hrl").
+-include_lib("couch/include/couch_db.hrl").
+-include("couch_views.hrl").
+
+
+-define(TDEF(A), {atom_to_list(A), fun A/1}).
+-define(TDEFI(A), {atom_to_list(A), fun A/0}).
+
+
+with(Tests) ->
+fun(ArgsTuple) ->
+lists:map(fun({Name, Fun}) ->
+{Name, ?_test(Fun(ArgsTuple))}
+end, Tests)
+end.
+
+
+-define(NUM_DOCS, 2000).
+
+
+reduce_views_shraed_db_test_() ->
+{
+"Reduce views",
+{
+setup,
+fun setup_shared_db/0,
+fun teardown_shared_db/1,
+with([
+?TDEF(should_reduce),
+?TDEF(should_reduce_rev),
+?TDEF(should_reduce_start_key),
+?TDEF(should_reduce_start_key_rev),
+?TDEF(should_reduce_end_key),
+?TDEF(should_reduce_end_key_rev),
+?TDEF(should_reduce_inclusive_end_false),
+?TDEF(should_reduce_inclusive_end_false_rev),
+?TDEF(should_reduce_start_and_end_key),
+?TDEF(should_reduce_start_and_end_key_rev),
+?TDEF(should_reduce_empty_range),
+?TDEF(should_reduce_empty_range_rev),
+?TDEF(should_reduce_grouped),
+?TDEF(should_reduce_grouped_rev),
+?TDEF(should_reduce_grouped_start_key),
+?TDEF(should_reduce_grouped_start_key_rev),
+?TDEF(should_reduce_grouped_end_key),
+?TDEF(should_reduce_grouped_end_key_rev),
+?TDEF(should_reduce_grouped_inclusive_end_false),
+?TDEF(should_reduce_grouped_inclusive_end_false_rev),
+?TDEF(should_reduce_grouped_start_and_end_key),
+?TDEF(should_reduce_grouped_start_and_end_key_rev),
+?TDEF(should_reduce_grouped_empty_range),
+?TDEF(should_reduce_grouped_empty_range_rev),
+
+?TDEF(should_reduce_array_keys),
+?TDEF(should_reduce_grouped_array_keys),
+?TDEF(should_reduce_group_1_array_keys),
+?TDEF(should_reduce_group_1_array_keys_start_key),
+?TDEF(should_reduce_group_1_array_keys_start_key_rev),
+?TDEF(should_reduce_group_1_array_keys_end_key),
+?TDEF(should_reduce_group_1_array_keys_end_key_rev),
+?TDEF(should_reduce_group_1_array_keys_inclusive_end_false),
+
?TDEF(should_reduce_group_1_array_keys_inclusive_end_false_rev),
+?TDEF(should_reduce_group_1_array_keys_start_and_end_key),
+?TDEF(should_reduce_group_1_array_keys_start_and_end_key_rev),
+?TDEF(should_reduce_group_1_array_keys_sub_array_select),
+?TDEF(should_reduce_group_1_array_keys_sub_array_select_rev),
+
?TDEF(should_reduce_group_1_array_keys_sub_array_inclusive_end),
+?TDEF(should_reduce_group_1_array_keys_empty_range),
+?TDEF(should_reduce_group_1_array_keys_empty_range_rev)
+])
+}
+}.
+
+
+reduce_views_individual_test_() ->
+{
+"Reduce views",
+{
+setup,
+fun setup_individual/0,
+fun teardown_individual/1,
+[
+?TDEFI(should_collate_group_keys)
+]
+}
+}.
+
+
+setup_shared_db() ->
+Ctx = test_util:start_couch([
+fabric,
+couch_jobs,
+couch_js,
+couch_views
+]),
+{ok, Db} = fabric2_db:create(?tempdb(), [{user_ctx, ?ADMIN_USER}]),
+fabric2_db:update_docs(Db, [create_ddoc()]),
+make_doc

[couchdb] 04/08: Reimplement db wide view size tracking

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feature-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit f9899059a8206f984fd53bea64bc0380e7fc3fd9
Author: Paul J. Davis 
AuthorDate: Thu Sep 3 12:05:45 2020 -0500

Reimplement db wide view size tracking
---
 src/couch_views/src/couch_views_fdb.erl|  45 +-
 src/couch_views/test/couch_views_size_test.erl | 829 +
 2 files changed, 349 insertions(+), 525 deletions(-)

diff --git a/src/couch_views/src/couch_views_fdb.erl 
b/src/couch_views/src/couch_views_fdb.erl
index b00bc6c..3116e61 100644
--- a/src/couch_views/src/couch_views_fdb.erl
+++ b/src/couch_views/src/couch_views_fdb.erl
@@ -221,15 +221,19 @@ update_views(TxDb, Mrst, Docs) ->
 tx := Tx
 } = TxDb,
 
-% Collect update information
+% Get initial KV size
+OldKVSize = lists:foldl(fun(View, SizeAcc) ->
+{_, Size, _} = ebtree:full_reduce(Tx, View#mrview.btree),
+SizeAcc + Size
+end, 0, Mrst#mrst.views),
 
+% Collect update information
 #{
 ids := IdMap,
 views := ViewMaps,
 delete_ref := DeleteRef
 } = gather_update_info(Tx, Mrst, Docs),
 
-% Generate a list of Keys to delete and Rows to insert from a map
 UpdateBTree = fun(BTree, Map) ->
 {ToRemove, ToInsert} = maps:fold(fun(Key, Value, {Keys, Rows}) ->
 case Value of
@@ -257,7 +261,15 @@ update_views(TxDb, Mrst, Docs) ->
 
 ViewMap = maps:get(ViewId, ViewMaps, #{}),
 UpdateBTree(BTree, ViewMap)
-end, Mrst#mrst.views).
+end, Mrst#mrst.views),
+
+% Get new KV size after update
+NewKVSize = lists:foldl(fun(View, SizeAcc) ->
+{_, Size, _} = ebtree:full_reduce(Tx, View#mrview.btree),
+SizeAcc + Size
+end, 0, Mrst#mrst.views),
+
+update_kv_size(TxDb, Mrst#mrst.sig, OldKVSize, NewKVSize).
 
 
 list_signatures(Db) ->
@@ -278,6 +290,11 @@ clear_index(Db, Signature) ->
 db_prefix := DbPrefix
 } = Db,
 
+% Get view size to remove from global counter
+SizeTuple = {?DB_VIEWS, ?VIEW_INFO, ?VIEW_KV_SIZE, Signature},
+SizeKey = erlfdb_tuple:pack(SizeTuple, DbPrefix),
+ViewSize = ?bin2uint(erlfdb:wait(erlfdb:get(Tx, SizeKey))),
+
 % Clear index info keys
 Keys = [
 {?DB_VIEWS, ?VIEW_INFO, ?VIEW_UPDATE_SEQ, Signature},
@@ -297,7 +314,12 @@ clear_index(Db, Signature) ->
 % Clear tree data
 TreeTuple = {?DB_VIEWS, ?VIEW_TREES, Signature},
 TreePrefix = erlfdb_tuple:pack(TreeTuple, DbPrefix),
-erlfdb:clear_range_startswith(Tx, TreePrefix).
+erlfdb:clear_range_startswith(Tx, TreePrefix),
+
+% Decrement db wide view size counter
+DbSizeTuple = {?DB_STATS, <<"sizes">>, <<"views">>},
+DbSizeKey = erlfdb_tuple:pack(DbSizeTuple, DbPrefix),
+erlfdb:add(Tx, DbSizeKey, -ViewSize).
 
 
 open_id_tree(TxDb, Sig) ->
@@ -516,6 +538,21 @@ gather_update_info(Tx, Mrst, Docs) ->
 end, InfoAcc1, Docs).
 
 
+update_kv_size(TxDb, Sig, OldSize, NewSize) ->
+#{
+tx := Tx,
+db_prefix := DbPrefix
+} = TxDb,
+
+ViewTuple = {?DB_VIEWS, ?VIEW_INFO, ?VIEW_KV_SIZE, Sig},
+ViewKey = erlfdb_tuple:pack(ViewTuple, DbPrefix),
+erlfdb:set(Tx, ViewKey, ?uint2bin(NewSize)),
+
+DbTuple = {?DB_STATS, <<"sizes">>, <<"views">>},
+DbKey = erlfdb_tuple:pack(DbTuple, DbPrefix),
+erlfdb:add(Tx, DbKey, NewSize - OldSize).
+
+
 dedupe_rows(View, KVs0) ->
 CollateFun = couch_views_util:collate_fun(View),
 KVs1 = lists:sort(fun({KeyA, ValA}, {KeyB, ValB}) ->
diff --git a/src/couch_views/test/couch_views_size_test.erl 
b/src/couch_views/test/couch_views_size_test.erl
index cc2fe39..16537a3 100644
--- a/src/couch_views/test/couch_views_size_test.erl
+++ b/src/couch_views/test/couch_views_size_test.erl
@@ -16,162 +16,38 @@
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch_mrview/include/couch_mrview.hrl").
--include_lib("fabric/include/fabric2.hrl").
 -include_lib("couch_views/include/couch_views.hrl").
+-include_lib("fabric/test/fabric2_test.hrl").
 
-% N.B., we should move to couch_ejson_size instead
-% of erlang:external_size
-%
-% to calculate view size:
-% total = 0
-% for (fdb_k, fdb_v) in VIEW_MAP_RANGE:
-%   {EncUserKey, EncUserval} = erlfdb_tuple:unpack(fdb_v),
-%   UserKey = couch_views_encoding:decode(EncUserKey),
-%   UserVal = couch_views_encoding:decode(EncUserVal),
-%   total += erlang:external_size(UserKey),
-%   total += erlang:external_size(UserVal)
-%
-% Our goal in checking the size calculations is that we cover
-% as much of the possible key mutation space as possible while
-% not relying on fuzzing out the edge cases. Conceptually we have
-% two sets of keys E and U. E is keys as currently exist in the
-% view, and U is the new set of keys corresponding to an update.
-%
-% Both sets E and U have the same possible set of state

[couchdb] 06/08: Use ebtree for reduce functions

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feature-ebtree-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 8ae350ea9b0dc7bbc1e36f3e16d8464083dbb9a5
Author: Paul J. Davis 
AuthorDate: Wed Jul 29 10:34:48 2020 -0500

Use ebtree for reduce functions
---
 src/couch_views/src/couch_views.erl|   6 --
 src/couch_views/src/couch_views_fdb.erl| 141 ++
 src/couch_views/src/couch_views_reader.erl | 153 -
 3 files changed, 271 insertions(+), 29 deletions(-)

diff --git a/src/couch_views/src/couch_views.erl 
b/src/couch_views/src/couch_views.erl
index 525866e..8a05302 100644
--- a/src/couch_views/src/couch_views.erl
+++ b/src/couch_views/src/couch_views.erl
@@ -161,12 +161,6 @@ maybe_update_view(TxDb, Mrst, false, _Args) ->
 end.
 
 
-is_reduce_view(#mrargs{view_type = ViewType}) ->
-ViewType =:= red;
-is_reduce_view({Reduce, _, _}) ->
-Reduce =:= red.
-
-
 to_mrargs(#mrargs{} = Args) ->
 Args;
 
diff --git a/src/couch_views/src/couch_views_fdb.erl 
b/src/couch_views/src/couch_views_fdb.erl
index f22277d..b9b941a 100644
--- a/src/couch_views/src/couch_views_fdb.erl
+++ b/src/couch_views/src/couch_views_fdb.erl
@@ -30,6 +30,7 @@
 get_kv_size/2,
 
 fold_map_idx/5,
+fold_red_idx/6,
 
 update_views/3,
 
@@ -177,7 +178,7 @@ get_row_count(TxDb, View) ->
 #{
 tx := Tx
 } = TxDb,
-{Count, _} = ebtree:full_reduce(Tx, View#mrview.btree),
+{Count, _, _} = ebtree:full_reduce(Tx, View#mrview.btree),
 Count.
 
 
@@ -185,7 +186,7 @@ get_kv_size(TxDb, View) ->
 #{
 tx := Tx
 } = TxDb,
-{_, TotalSize} = ebtree:full_reduce(Tx, View#mrview.btree),
+{_, TotalSize, _} = ebtree:full_reduce(Tx, View#mrview.btree),
 TotalSize.
 
 
@@ -249,6 +250,74 @@ fold_map_idx(TxDb, View, Options, Callback, Acc0) ->
 end.
 
 
+fold_red_idx(TxDb, View, Idx, Options, Callback, Acc0) ->
+#{
+tx := Tx
+} = TxDb,
+#mrview{
+btree = Btree
+} = View,
+
+{Dir, StartKey, EndKey, InclusiveEnd, GroupKeyFun} = to_red_opts(Options),
+
+Wrapper = fun({GroupKey, Reduction}, WAcc) ->
+{_RowCount, _RowSize, UserReds} = Reduction,
+RedValue = lists:nth(Idx, UserReds),
+Callback(GroupKey, RedValue, WAcc)
+end,
+
+case {GroupKeyFun, Dir} of
+{group_all, fwd} ->
+EBtreeOpts = [
+{dir, fwd},
+{inclusive_end, InclusiveEnd}
+],
+Reduction = ebtree:reduce(Tx, Btree, StartKey, EndKey, EBtreeOpts),
+Wrapper({null, Reduction}, Acc0);
+{F, fwd} when is_function(F) ->
+EBtreeOpts = [
+{dir, fwd},
+{inclusive_end, InclusiveEnd}
+],
+ebtree:group_reduce(
+Tx,
+Btree,
+StartKey,
+EndKey,
+GroupKeyFun,
+Wrapper,
+Acc0,
+EBtreeOpts
+);
+{group_all, rev} ->
+% Start/End keys swapped on purpose because ebtree. Also
+% inclusive_start for same reason.
+EBtreeOpts = [
+{dir, rev},
+{inclusive_start, InclusiveEnd}
+],
+Reduction = ebtree:reduce(Tx, Btree, EndKey, StartKey, EBtreeOpts),
+Wrapper({null, Reduction}, Acc0);
+{F, rev} when is_function(F) ->
+% Start/End keys swapped on purpose because ebtree. Also
+% inclusive_start for same reason.
+EBtreeOpts = [
+{dir, rev},
+{inclusive_start, InclusiveEnd}
+],
+ebtree:group_reduce(
+Tx,
+Btree,
+EndKey,
+StartKey,
+GroupKeyFun,
+Wrapper,
+Acc0,
+EBtreeOpts
+)
+end.
+
+
 update_views(TxDb, Mrst, Docs) ->
 #{
 tx := Tx
@@ -427,7 +496,7 @@ open_id_tree(TxDb, Sig) ->
 ebtree:open(Tx, Prefix, get_order(id_btree), TreeOpts).
 
 
-open_view_tree(TxDb, Sig, _Lang, View) ->
+open_view_tree(TxDb, Sig, Lang, View) ->
 #{
 tx := Tx,
 db_prefix := DbPrefix
@@ -438,7 +507,7 @@ open_view_tree(TxDb, Sig, _Lang, View) ->
 Prefix = view_tree_prefix(DbPrefix, Sig, ViewId),
 TreeOpts = [
 {collate_fun, couch_views_util:collate_fun(View)},
-{reduce_fun, make_reduce_fun(View)},
+{reduce_fun, make_reduce_fun(Lang, View)},
 {persist_fun, fun persist_chunks/3},
 {cache_fun, create_cache_fun({view, ViewId})}
 ],
@@ -461,26 +530,31 @@ min_order(V) ->
 V + 1.
 
 
-make_reduce_fun(#mrview{}) ->
+make_reduce_fun(Lang, #mrview{} = View) ->
+RedFuns = [

[couchdb-www] branch asf-site updated: fix: one release versino bump straggler

2020-09-18 Thread jan
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/couchdb-www.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new d88d380  fix: one release versino bump straggler
d88d380 is described below

commit d88d380a835ac11c5581aeba0cc0588322c798e5
Author: Jan Lehnardt 
AuthorDate: Fri Sep 18 19:50:36 2020 +0200

fix: one release versino bump straggler
---
 index.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.html b/index.html
index 9806bf0..4da37d0 100644
--- a/index.html
+++ b/index.html
@@ -87,7 +87,7 @@ Thanks to Yohei Shimomae and the Apache Cordova team for the 
original design.
   
 
   
-DOWNLOAD3.1.0 (2020-09-18)
+DOWNLOAD3.1.1 (2020-09-18)
   
 
 



[couchdb-www] branch asf-site updated: fix: update release date

2020-09-18 Thread jan
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/couchdb-www.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new b58a639  fix: update release date
b58a639 is described below

commit b58a6396ffcf03aa1bcc0dbc53dadb715508c2ef
Author: Jan Lehnardt 
AuthorDate: Fri Sep 18 19:49:48 2020 +0200

fix: update release date
---
 index.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.html b/index.html
index 8694d9e..9806bf0 100644
--- a/index.html
+++ b/index.html
@@ -87,7 +87,7 @@ Thanks to Yohei Shimomae and the Apache Cordova team for the 
original design.
   
 
   
-DOWNLOAD3.1.0 (2020-05-05)
+DOWNLOAD3.1.0 (2020-09-18)
   
 
 



[couchdb-www] branch asf-site updated: feat: ship 3.1.1

2020-09-18 Thread jan
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/couchdb-www.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new fa3cd57  feat: ship 3.1.1
fa3cd57 is described below

commit fa3cd5791989225131741b60fbed0d7936b9b9e8
Author: Jan Lehnardt 
AuthorDate: Fri Sep 18 14:38:15 2020 +

feat: ship 3.1.1
---
 index.html | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/index.html b/index.html
index c423c15..8694d9e 100644
--- a/index.html
+++ b/index.html
@@ -543,7 +543,7 @@ Thanks to Yohei Shimomae and the Apache Cordova team for 
the original design.
   
 
   
-Download CouchDB 3.1.0
+Download CouchDB 3.1.1
   
 
   
@@ -556,18 +556,18 @@ Thanks to Yohei Shimomae and the Apache Cordova team for 
the original design.
 
 
   
-https://www.apache.org/dyn/closer.lua?path=/couchdb/source/3.1.0/apache-couchdb-3.1.0.tar.gz";
 class="type">Source
+https://www.apache.org/dyn/closer.lua?path=/couchdb/source/3.1.1/apache-couchdb-3.1.1.tar.gz";
 class="type">Source
 
-  Version 3.1.0 |
-  http://docs.couchdb.org/en/3.1.0/whatsnew/3.1.html#version-3.1.0"; 
class="release">Release Notes |
-  https://www.apache.org/dist/couchdb/source/3.1.0/apache-couchdb-3.1.0.tar.gz.asc";>PGP
 Signature |
-  https://www.apache.org/dist/couchdb/source/3.1.0/apache-couchdb-3.1.0.tar.gz.sha256";>SHA256
 |
-  https://www.apache.org/dist/couchdb/source/3.1.0/apache-couchdb-3.1.0.tar.gz.sha512";>SHA512
+  Version 3.1.1 |
+  http://docs.couchdb.org/en/3.1.1/whatsnew/3.1.html#version-3.1.1"; 
class="release">Release Notes |
+  https://www.apache.org/dist/couchdb/source/3.1.1/apache-couchdb-3.1.1.tar.gz.asc";>PGP
 Signature |
+  https://www.apache.org/dist/couchdb/source/3.1.1/apache-couchdb-3.1.1.tar.gz.sha256";>SHA256
 |
+  https://www.apache.org/dist/couchdb/source/3.1.1/apache-couchdb-3.1.1.tar.gz.sha512";>SHA512
 
   
   
 https://neighbourhood.ie/download-apache-couchdb-win/"; 
class="type">
-  Windows (x64)
+  Windows (x64) (3.1.1 coming soon)
 
 
   Erlang/OTP 20.3.8.25 | Version 3.1.0 |
@@ -579,14 +579,14 @@ Thanks to Yohei Shimomae and the Apache Cordova team for 
the original design.
   macOS (10.10+)
 
 
-  Erlang/OTP 22.2 | Version 3.1.0 |
-  http://docs.couchdb.org/en/3.1.0/whatsnew/3.1.html#version-3.1.0"; 
class="release">Release Notes
+  Erlang/OTP 22.2 | Version 3.1.1 |
+  http://docs.couchdb.org/en/3.1.1/whatsnew/3.1.html#version-3.1.1"; 
class="release">Release Notes
 
   
 http://docs.couchdb.org/en/latest/install/unix.html#installation-using-the-apache-couchdb-convenience-binary-packages";
 class="type">Debian/Ubuntu/RHEL/CentOS packages
 
-  Erlang/OTP 20.3.8.25 | Version 3.1.0 |
-http://docs.couchdb.org/en/3.1.0/whatsnew/3.1.html#version-3.1.0"; 
class="release">Release Notes
+  Erlang/OTP 20.3.8.25 | Version 3.1.1 |
+http://docs.couchdb.org/en/3.1.1/whatsnew/3.1.html#version-3.1.1"; 
class="release">Release Notes
 
   
 



[couchdb-docker] branch main updated (7f93d7e -> 47d2a97)

2020-09-18 Thread davisp
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-docker.git.


from 7f93d7e  Add script that keeps old couchdbdev docker images alive 
(#189)
 add 47d2a97  3.1.0 -> 3.1.1 (#190)

No new revisions were added by this update.

Summary of changes:
 .travis.yml | 4 ++--
 {3.1.0-ubi-clouseau => 3.1.1-ubi-clouseau}/Dockerfile   | 6 +++---
 {3.1.0-ubi => 3.1.1-ubi-clouseau}/bintray-apache-couchdb-rpm.repo   | 0
 {3.1.0-ubi => 3.1.1-ubi-clouseau}/imeyer_runit.repo | 0
 {3.1.0-ubi => 3.1.1-ubi-clouseau}/licenses/LICENSE  | 0
 {3.1.0 => 3.1.1-ubi-clouseau/resources}/10-docker-default.ini   | 0
 .../resources/clouseau/clouseau.ini | 0
 .../resources/clouseau/clouseau.sh  | 0
 .../resources/clouseau/log4j.properties | 0
 .../resources/docker-entrypoint.sh  | 0
 {3.1.0-ubi-clouseau => 3.1.1-ubi-clouseau}/resources/pre_stop   | 0
 {3.1.0-ubi-clouseau => 3.1.1-ubi-clouseau}/resources/run| 0
 {3.1.0-ubi-clouseau => 3.1.1-ubi-clouseau}/resources/run_clouseau   | 0
 {3.1.0 => 3.1.1-ubi-clouseau/resources}/vm.args | 0
 {3.1.0-ubi => 3.1.1-ubi}/Dockerfile | 6 +++---
 {3.1.0-ubi-clouseau => 3.1.1-ubi}/bintray-apache-couchdb-rpm.repo   | 0
 {3.1.0-ubi-clouseau => 3.1.1-ubi}/imeyer_runit.repo | 0
 {3.1.0-ubi-clouseau => 3.1.1-ubi}/licenses/LICENSE  | 0
 {3.1.0-ubi => 3.1.1-ubi}/resources/10-docker-default.ini| 0
 {3.1.0-ubi => 3.1.1-ubi}/resources/docker-entrypoint.sh | 0
 {3.1.0-ubi => 3.1.1-ubi}/resources/run  | 0
 {3.1.0-ubi => 3.1.1-ubi}/resources/vm.args  | 0
 {3.1.0-ubi-clouseau/resources => 3.1.1}/10-docker-default.ini   | 0
 {3.1.0 => 3.1.1}/Dockerfile | 2 +-
 {3.1.0 => 3.1.1}/docker-entrypoint.sh   | 0
 {3.1.0-ubi-clouseau/resources => 3.1.1}/vm.args | 0
 README.md   | 2 +-
 27 files changed, 10 insertions(+), 10 deletions(-)
 rename {3.1.0-ubi-clouseau => 3.1.1-ubi-clouseau}/Dockerfile (98%)
 rename {3.1.0-ubi => 3.1.1-ubi-clouseau}/bintray-apache-couchdb-rpm.repo (100%)
 rename {3.1.0-ubi => 3.1.1-ubi-clouseau}/imeyer_runit.repo (100%)
 rename {3.1.0-ubi => 3.1.1-ubi-clouseau}/licenses/LICENSE (100%)
 rename {3.1.0 => 3.1.1-ubi-clouseau/resources}/10-docker-default.ini (100%)
 rename {3.1.0-ubi-clouseau => 
3.1.1-ubi-clouseau}/resources/clouseau/clouseau.ini (100%)
 rename {3.1.0-ubi-clouseau => 
3.1.1-ubi-clouseau}/resources/clouseau/clouseau.sh (100%)
 rename {3.1.0-ubi-clouseau => 
3.1.1-ubi-clouseau}/resources/clouseau/log4j.properties (100%)
 rename {3.1.0-ubi-clouseau => 
3.1.1-ubi-clouseau}/resources/docker-entrypoint.sh (100%)
 rename {3.1.0-ubi-clouseau => 3.1.1-ubi-clouseau}/resources/pre_stop (100%)
 rename {3.1.0-ubi-clouseau => 3.1.1-ubi-clouseau}/resources/run (100%)
 rename {3.1.0-ubi-clouseau => 3.1.1-ubi-clouseau}/resources/run_clouseau (100%)
 rename {3.1.0 => 3.1.1-ubi-clouseau/resources}/vm.args (100%)
 rename {3.1.0-ubi => 3.1.1-ubi}/Dockerfile (98%)
 rename {3.1.0-ubi-clouseau => 3.1.1-ubi}/bintray-apache-couchdb-rpm.repo (100%)
 rename {3.1.0-ubi-clouseau => 3.1.1-ubi}/imeyer_runit.repo (100%)
 rename {3.1.0-ubi-clouseau => 3.1.1-ubi}/licenses/LICENSE (100%)
 rename {3.1.0-ubi => 3.1.1-ubi}/resources/10-docker-default.ini (100%)
 rename {3.1.0-ubi => 3.1.1-ubi}/resources/docker-entrypoint.sh (100%)
 rename {3.1.0-ubi => 3.1.1-ubi}/resources/run (100%)
 rename {3.1.0-ubi => 3.1.1-ubi}/resources/vm.args (100%)
 rename {3.1.0-ubi-clouseau/resources => 3.1.1}/10-docker-default.ini (100%)
 rename {3.1.0 => 3.1.1}/Dockerfile (99%)
 rename {3.1.0 => 3.1.1}/docker-entrypoint.sh (100%)
 rename {3.1.0-ubi-clouseau/resources => 3.1.1}/vm.args (100%)



[couchdb] branch print-stack-sm60 created (now 9de8e62)

2020-09-18 Thread jiangphcn
This is an automated email from the ASF dual-hosted git repository.

jiangphcn pushed a change to branch print-stack-sm60
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


  at 9de8e62  Print stack if name and stack of exception are present

This branch includes the following new commits:

 new 9de8e62  Print stack if name and stack of exception are present

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[couchdb] 01/01: Print stack if name and stack of exception are present

2020-09-18 Thread jiangphcn
This is an automated email from the ASF dual-hosted git repository.

jiangphcn pushed a commit to branch print-stack-sm60
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 9de8e6212eb65f60f382dd5a5ab408787047aa34
Author: jiangph 
AuthorDate: Fri Sep 18 18:27:44 2020 +0800

Print stack if name and stack of exception are present
---
 share/server/loop.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/share/server/loop.js b/share/server/loop.js
index 5d77389..f3d9aa5 100644
--- a/share/server/loop.js
+++ b/share/server/loop.js
@@ -130,6 +130,8 @@ var Loop = function() {
 } else if (e.error && e.reason) {
   // compatibility with old error format
   respond(["error", e.error, e.reason]);
+   }  else if (e.name && e.stack) {
+  respond(["error", e.name, e.stack]);
 } else if (e.name) {
   respond(["error", e.name, e]);
 } else {