From a19b9ff23ddb7da217954f963009d38c630891a7 Mon Sep 17 00:00:00 2001 From: Will Holley Date: Mon, 3 Feb 2020 10:19:59 +0000 Subject: Return mango warnings as a delimited string The CouchDB API defines the warning field returned by _find to be a string (and this is what Fauxton expects). 5d55e289 was missing a string conversion and returned the warning(s) as an array. This restores the intended behaviour. --- src/mango/src/mango_cursor.erl | 2 +- src/mango/test/05-index-selection-test.py | 8 ++++---- src/mango/test/12-use-correct-index-test.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mango/src/mango_cursor.erl b/src/mango/src/mango_cursor.erl index 29be49490..b1cb4148e 100644 --- a/src/mango/src/mango_cursor.erl +++ b/src/mango/src/mango_cursor.erl @@ -133,7 +133,7 @@ maybe_add_warning(UserFun, #cursor{index = Index, opts = Opts}, Stats, UserAcc) [] -> UserAcc; _ -> - WarningStr = lists:join(<<"\n">>, Warnings), + WarningStr = iolist_to_binary(lists:join(<<"\n">>, Warnings)), Arg = {add_key, warning, WarningStr}, {_Go, UserAcc1} = UserFun(Arg, UserAcc), UserAcc1 diff --git a/src/mango/test/05-index-selection-test.py b/src/mango/test/05-index-selection-test.py index 271e36176..2bc5a88f0 100644 --- a/src/mango/test/05-index-selection-test.py +++ b/src/mango/test/05-index-selection-test.py @@ -84,7 +84,7 @@ class IndexSelectionTests: ddocid = "_design/age" r = self.db.find({}, use_index=ddocid, return_raw=True) self.assertEqual( - r["warning"][0].lower(), + r["warning"].split('\n')[0].lower(), "{0} was not used because it does not contain a valid index for this query.".format( ddocid ), @@ -107,7 +107,7 @@ class IndexSelectionTests: selector = {"company": "Pharmex"} r = self.db.find(selector, use_index=ddocid, return_raw=True) self.assertEqual( - r["warning"][0].lower(), + r["warning"].split('\n')[0].lower(), "{0} was not used because it does not contain a valid index for this query.".format( ddocid ), @@ -124,7 +124,7 @@ class IndexSelectionTests: resp = self.db.find(selector, use_index=[ddocid, name], return_raw=True) self.assertEqual( - resp["warning"][0].lower(), + resp["warning"].split('\n')[0].lower(), "{0}, {1} was not used because it is not a valid index for this query.".format( ddocid, name ), @@ -162,7 +162,7 @@ class IndexSelectionTests: selector, sort=["foo", "bar"], use_index=ddocid_invalid, return_raw=True ) self.assertEqual( - resp["warning"][0].lower(), + resp["warning"].split('\n')[0].lower(), "{0} was not used because it does not contain a valid index for this query.".format( ddocid_invalid ), diff --git a/src/mango/test/12-use-correct-index-test.py b/src/mango/test/12-use-correct-index-test.py index 3a2f60af8..b6fe434f8 100644 --- a/src/mango/test/12-use-correct-index-test.py +++ b/src/mango/test/12-use-correct-index-test.py @@ -93,7 +93,7 @@ class ChooseCorrectIndexForDocs(mango.DbPerClass): self.assertEqual(explain_resp["index"]["type"], "special") resp = self.db.find(selector, return_raw=True) self.assertEqual( - resp["warning"][0].lower(), + resp["warning"].split('\n')[0].lower(), "no matching index found, create an index to optimize query time.", ) -- cgit v1.2.1 From 150e056af06c3954262d880600c23eae852c95eb Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Tue, 4 Feb 2020 10:00:24 +0000 Subject: Fix dev/run --with-admin-party-please (#2516) --- dev/run | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/run b/dev/run index 3186a1fc8..a96817d83 100755 --- a/dev/run +++ b/dev/run @@ -422,6 +422,7 @@ def hack_local_ini(ctx, contents): contents = contents.replace(previous_line, previous_line + secret_line) if ctx["with_admin_party"]: + os.environ["COUCHDB_TEST_ADMIN_PARTY_OVERRIDE"] = "1" ctx["admin"] = ("Admin Party!", "You do not need any password.") return contents -- cgit v1.2.1 From 06b8bb789c74f8952f0b4c0f220d7503bf4206ab Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Wed, 5 Feb 2020 11:09:35 +0000 Subject: Fix highlight_post_tag parsing from json request body Fixes #2520 --- src/dreyfus/src/dreyfus_httpd.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dreyfus/src/dreyfus_httpd.erl b/src/dreyfus/src/dreyfus_httpd.erl index e9851639b..346f5ede6 100644 --- a/src/dreyfus/src/dreyfus_httpd.erl +++ b/src/dreyfus/src/dreyfus_httpd.erl @@ -344,7 +344,7 @@ parse_json_index_param(<<"highlight_fields">>, Value) -> [{highlight_fields, Value}]; parse_json_index_param(<<"highlight_pre_tag">>, Value) -> [{highlight_pre_tag, Value}]; -parse_json_index_param(<<"highlight_pos_tag">>, Value) -> +parse_json_index_param(<<"highlight_post_tag">>, Value) -> [{highlight_post_tag, Value}]; parse_json_index_param(<<"highlight_number">>, Value) -> [{highlight_number, parse_positive_int_param2("highlight_number", Value)}]; -- cgit v1.2.1 From 8d82414fb9684cfdff2f9cdca0a708f42f77458c Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Wed, 5 Feb 2020 16:06:34 +0000 Subject: log thing --- test/javascript/tests/view_errors.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/javascript/tests/view_errors.js b/test/javascript/tests/view_errors.js index f135b749a..7aad40c9a 100644 --- a/test/javascript/tests/view_errors.js +++ b/test/javascript/tests/view_errors.js @@ -154,6 +154,7 @@ couchTests.view_errors = function(debug) { db.view("infinite/infinite_loop"); T(0 == 1); } catch(e) { + console.log("infinite sorrow: " + e.error); T(e.error == "os_process_error"); } -- cgit v1.2.1 From 1c02da2edb25789d07ee9f947d86449ee3239a4b Mon Sep 17 00:00:00 2001 From: Nick Vatamaniuc Date: Wed, 5 Feb 2020 14:19:28 -0500 Subject: Add a warning about Erlang VM versions where high priority flag won't work --- rel/overlay/etc/default.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini index 599942d44..1829d0d74 100644 --- a/rel/overlay/etc/default.ini +++ b/rel/overlay/etc/default.ini @@ -97,8 +97,8 @@ couch = couch_bt_engine [process_priority] ; Selectively disable altering process priorities for modules that request it. ; * NOTE: couch_server priority has been shown to lead to CouchDB hangs and -; unexpected failures. Do not enable unless you're sure you can tolerate -; this possibility. +; failures on Erlang releases 21.0 - 21.3.8.12 and 22.0 -> 22.2.4. Do not +; enable when running with those versions. ;couch_server = false [cluster] -- cgit v1.2.1