From 1a111277d10db221d35629e1b0b9060f7ba42891 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Mon, 10 Oct 2011 22:02:07 +0100 Subject: Backport erlang-oauth from master for R15 compat --- src/erlang-oauth/Makefile.am | 4 +++- src/erlang-oauth/oauth.app.in | 2 +- src/erlang-oauth/oauth_hmac_sha1.erl | 2 +- src/erlang-oauth/oauth_http.erl | 2 +- src/erlang-oauth/oauth_plaintext.erl | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/erlang-oauth/Makefile.am b/src/erlang-oauth/Makefile.am index 50782e75..48b76482 100644 --- a/src/erlang-oauth/Makefile.am +++ b/src/erlang-oauth/Makefile.am @@ -22,13 +22,15 @@ oauth_file_collection = \ oauth_unix.erl \ oauth_uri.erl +# Removed oauth_rsa_sha1.beam until we require R12B5 or +# we add a ./configure option to enable it. + oauthebin_make_generated_file_list = \ oauth.app \ oauth.beam \ oauth_hmac_sha1.beam \ oauth_http.beam \ oauth_plaintext.beam \ - oauth_rsa_sha1.beam \ oauth_unix.beam \ oauth_uri.beam diff --git a/src/erlang-oauth/oauth.app.in b/src/erlang-oauth/oauth.app.in index 6357b9b0..a8ec17c4 100644 --- a/src/erlang-oauth/oauth.app.in +++ b/src/erlang-oauth/oauth.app.in @@ -1,6 +1,6 @@ {application, oauth, [ {description, "Erlang OAuth implementation"}, - {vsn, "dev"}, + {vsn, "7d85d3ef"}, {modules, [ oauth, oauth_hmac_sha1, diff --git a/src/erlang-oauth/oauth_hmac_sha1.erl b/src/erlang-oauth/oauth_hmac_sha1.erl index 79d59f37..69064edd 100644 --- a/src/erlang-oauth/oauth_hmac_sha1.erl +++ b/src/erlang-oauth/oauth_hmac_sha1.erl @@ -8,4 +8,4 @@ signature(BaseString, CS, TS) -> base64:encode_to_string(crypto:sha_mac(Key, BaseString)). verify(Signature, BaseString, CS, TS) -> - couch_util:verify(signature(BaseString, CS, TS), Signature). + Signature =:= signature(BaseString, CS, TS). diff --git a/src/erlang-oauth/oauth_http.erl b/src/erlang-oauth/oauth_http.erl index bf5a4bac..92c806cc 100644 --- a/src/erlang-oauth/oauth_http.erl +++ b/src/erlang-oauth/oauth_http.erl @@ -10,7 +10,7 @@ post(URL, Data) -> request(post, {URL, [], "application/x-www-form-urlencoded", Data}). request(Method, Request) -> - http:request(Method, Request, [{autoredirect, false}], []). + httpc:request(Method, Request, [{autoredirect, false}], []). response_params(Response) -> oauth_uri:params_from_string(response_body(Response)). diff --git a/src/erlang-oauth/oauth_plaintext.erl b/src/erlang-oauth/oauth_plaintext.erl index 41a1e9b2..d8085e02 100644 --- a/src/erlang-oauth/oauth_plaintext.erl +++ b/src/erlang-oauth/oauth_plaintext.erl @@ -7,4 +7,4 @@ signature(CS, TS) -> oauth_uri:calate("&", [CS, TS]). verify(Signature, CS, TS) -> - couch_util:verify(signature(CS, TS), Signature). + Signature =:= signature(CS, TS). -- cgit v1.2.3 From 605f274ff8fa5d421d7397eef3e719950b853838 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Mon, 10 Oct 2011 22:06:37 +0100 Subject: Fix R15 warning for etap_web.erl --- src/etap/etap_web.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/etap/etap_web.erl b/src/etap/etap_web.erl index fb7aee16..f97edfd7 100644 --- a/src/etap/etap_web.erl +++ b/src/etap/etap_web.erl @@ -42,7 +42,7 @@ simple_404(Url, Desc) -> %% @doc Create and return a request structure. build_request(Method, Url, Headers, Body) when Method==options;Method==get;Method==head;Method==delete;Method==trace -> - try http:request(Method, {Url, Headers}, [{autoredirect, false}], []) of + try httpc:request(Method, {Url, Headers}, [{autoredirect, false}], []) of {ok, {OutStatus, OutHeaders, OutBody}} -> etap_request:new(Method, Url, Headers, Body, OutStatus, OutHeaders, OutBody); _ -> error @@ -56,7 +56,7 @@ build_request(Method, Url, Headers, Body) when Method == post; Method == put -> {value, {"Content-Type", X}} -> X; _ -> [] end, - try http:request(Method, {Url, Headers, ContentType, Body}, [{autoredirect, false}], []) of + try httpc:request(Method, {Url, Headers, ContentType, Body}, [{autoredirect, false}], []) of {ok, {OutStatus, OutHeaders, OutBody}} -> etap_request:new(Method, Url, Headers, Body, OutStatus, OutHeaders, OutBody); _ -> error -- cgit v1.2.3 From 79fa8d7d66d5e869d2a0757bb7fdf9f95fe36f66 Mon Sep 17 00:00:00 2001 From: Filipe David Manana Date: Wed, 12 Oct 2011 12:17:41 +0100 Subject: Remove duplicated word "the" --- src/couchdb/priv/couch_js/help.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/couchdb/priv/couch_js/help.h b/src/couchdb/priv/couch_js/help.h index 84c83c06..c42c9f59 100644 --- a/src/couchdb/priv/couch_js/help.h +++ b/src/couchdb/priv/couch_js/help.h @@ -51,7 +51,7 @@ static const char USAGE_TEMPLATE[] = " -H enable %s cURL bindings (only avaiable\n" " if package was built with cURL available)\n" " -S SIZE specify that the interpreter should set the\n" - " the stack quota for JS contexts to SIZE bytes\n" + " stack quota for JS contexts to SIZE bytes\n" "\n" "Report bugs at <%s>.\n"; -- cgit v1.2.3 From d01047563d932c9d2c0c9c014a98bf4a83ff485a Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Mon, 10 Oct 2011 20:20:59 +0100 Subject: Update CHANGES/NEWS/acinclude.m4.in for 1.1.1 --- CHANGES | 2 -- NEWS | 2 -- acinclude.m4.in | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 0c619ab9..ada57715 100644 --- a/CHANGES +++ b/CHANGES @@ -4,8 +4,6 @@ Apache CouchDB CHANGES Version 1.1.1 ------------- -This version has not been released yet. - * Add configurable maximum to the number of bytes returned by _log. * Allow CommonJS modules to be an empty string. * Bump minimum Erlang version to R13B02. diff --git a/NEWS b/NEWS index 13e6ac56..99cc474f 100644 --- a/NEWS +++ b/NEWS @@ -10,8 +10,6 @@ Each release section notes when backwards incompatible changes have been made. Version 1.1.1 ------------- -This version has not been released yet. - * Add configurable maximum to the number of bytes returned by _log. * Allow CommonJS modules to be an empty string. * Bump minimum Erlang version to R13B02. diff --git a/acinclude.m4.in b/acinclude.m4.in index e74f6336..8466b564 100644 --- a/acinclude.m4.in +++ b/acinclude.m4.in @@ -19,7 +19,7 @@ m4_define([LOCAL_BUG_URI], [https://issues.apache.org/jira/browse/COUCHDB]) m4_define([LOCAL_VERSION_MAJOR], [1]) m4_define([LOCAL_VERSION_MINOR], [1]) m4_define([LOCAL_VERSION_REVISION], [1]) -m4_define([LOCAL_VERSION_STAGE], [a]) +m4_define([LOCAL_VERSION_STAGE], []) m4_define([LOCAL_VERSION_RELEASE], [%release%]) m4_define([LOCAL_VERSION_PRIMARY], [LOCAL_VERSION_MAJOR.LOCAL_VERSION_MINOR.LOCAL_VERSION_REVISION]) -- cgit v1.2.3 From 282ed2c3288d0346e507adefedb67a959c27f235 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Wed, 12 Oct 2011 15:55:06 -0400 Subject: Freeze dependencies, this is 0.4.0pre1 --- rebar.config | 14 +++++++------- rel/reltool.config | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rebar.config b/rebar.config index 6fb5113f..417ddb2f 100644 --- a/rebar.config +++ b/rebar.config @@ -14,19 +14,19 @@ {deps, [ {oauth, ".*", {git, "https://github.com/cloudant/erlang-oauth.git", - {branch, "couch"}}}, + {tag, "BigCouch-0.4.0"}}}, {ibrowse, ".*", {git, "https://github.com/cloudant/ibrowse.git", - {branch, "couch_1.1"}}}, + {tag, "CouchDB-1.1.0"}}}, {mochiweb, ".*", {git, "https://github.com/cloudant/mochiweb.git", - {branch, "couch_1.1"}}}, + {tag, "CouchDB-1.1.0"}}}, {rexi, ".*", {git, "https://github.com/cloudant/rexi.git", - master}}, + {tag, "1.5.5"}}}, {fabric, ".*", {git, "https://github.com/cloudant/fabric.git", - master}}, + {tag, "2.0.1"}}}, {mem3, ".*", {git, "https://github.com/cloudant/mem3.git", - master}}, + {tag, "2.0.0"}}}, {chttpd, ".*", {git, "https://github.com/cloudant/chttpd.git", - master}} + {tag, "1.4.0"}}} ]}. % needed for a clean transition to the deps model {clean_files, [ diff --git a/rel/reltool.config b/rel/reltool.config index d8403865..6aa8735c 100644 --- a/rel/reltool.config +++ b/rel/reltool.config @@ -14,7 +14,7 @@ {sys, [ {lib_dirs, ["../apps", "../deps"]}, - {rel, "bigcouch", "0.4a", [ + {rel, "bigcouch", "0.4.0pre1", [ kernel, stdlib, sasl, -- cgit v1.2.3 From 1e1d07a916f22a29ccc2fff98f44746851b287ff Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Thu, 13 Oct 2011 15:09:02 +0100 Subject: restore couch_util:verify call in oauth. --- src/erlang-oauth/oauth_hmac_sha1.erl | 2 +- src/erlang-oauth/oauth_plaintext.erl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/erlang-oauth/oauth_hmac_sha1.erl b/src/erlang-oauth/oauth_hmac_sha1.erl index 69064edd..35549cfc 100644 --- a/src/erlang-oauth/oauth_hmac_sha1.erl +++ b/src/erlang-oauth/oauth_hmac_sha1.erl @@ -8,4 +8,4 @@ signature(BaseString, CS, TS) -> base64:encode_to_string(crypto:sha_mac(Key, BaseString)). verify(Signature, BaseString, CS, TS) -> - Signature =:= signature(BaseString, CS, TS). + couch_util:verify(Signature, signature(BaseString, CS, TS)). diff --git a/src/erlang-oauth/oauth_plaintext.erl b/src/erlang-oauth/oauth_plaintext.erl index d8085e02..9544a0af 100644 --- a/src/erlang-oauth/oauth_plaintext.erl +++ b/src/erlang-oauth/oauth_plaintext.erl @@ -7,4 +7,4 @@ signature(CS, TS) -> oauth_uri:calate("&", [CS, TS]). verify(Signature, CS, TS) -> - Signature =:= signature(CS, TS). + couch_util:verify(Signature, signature(CS, TS)). -- cgit v1.2.3 From e671953b9a08b174d6de88777e690f4ea2cc3cdf Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Mon, 17 Oct 2011 18:33:52 +0100 Subject: remove scons cache in 'make clean' --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 4bf74e8c..ef6236cd 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ compile: clean: @echo "==> couchjs (clean)" @cd couchjs && python scons/scons.py --clean + @rm -rf couchjs/.sconf_temp couchjs/.sconsign.dblite @./rebar clean # compile is required here because of cross-dependencies between apps -- cgit v1.2.3 From 6b26f47e8287b2d1c1d7b74199647dec2e7c2bef Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Mon, 17 Oct 2011 20:23:25 +0100 Subject: Build couchjs with C, not C++. Fixes libm error on CentOS. --- couchjs/c_src/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchjs/c_src/SConscript b/couchjs/c_src/SConscript index a5f8b66b..4fc9e5a3 100644 --- a/couchjs/c_src/SConscript +++ b/couchjs/c_src/SConscript @@ -22,7 +22,7 @@ def require_lib(name): def runcmd(cmd): return commands.getstatusoutput(cmd) -env = Environment(CC="c++", CCFLAGS='-g -O2 -DXP_UNIX') +env = Environment(CCFLAGS='-g -O2 -DXP_UNIX') if os.uname()[0] == 'SunOS': env['CC'] = '/usr/sfw/bin/gcc' -- cgit v1.2.3 From 7ce9e103e50678a38c78607f2441340cd6d688da Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Tue, 18 Oct 2011 16:18:01 -0500 Subject: Prevent linking against too new of a SpiderMonkey Versions of SpiderMonkey newer than js185-1.0.0 have removed the JSOPTION_ANONFUNFIX which basically invalidates all CouchDB JavaScript functions ever written. This configure patch prevents the accidental linking to a library that has this new behavior while allowing people to forcefully override the check. --- configure.ac | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/configure.ac b/configure.ac index 5124b8b1..6f9327d0 100644 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,12 @@ AC_ARG_WITH([js-lib], [AC_HELP_STRING([--with-js-lib=PATH], ]) AC_SUBST(JS_LIB_DIR) +use_js_trunk=no +AC_ARG_ENABLE([js-trunk], [AC_HELP_STRING([--enable-js-trunk], + [allow use of SpiderMonkey versions newer than js185-1.0.0])], [ + use_js_trunk=$enableval +], []) + AC_ARG_VAR([ERLC_FLAGS], [general flags to prepend to ERLC_FLAGS]) AC_ARG_VAR([FLAGS], [general flags to prepend to LDFLAGS and CPPFLAGS]) @@ -177,6 +183,21 @@ AC_CHECK_HEADER([jsapi.h], [], [ Are the Mozilla SpiderMonkey headers installed?]) ])]) +# Prevent people from accidentally using SpiderMonkey's that are too new + +if test "$use_js_trunk" = "no"; then +AC_CHECK_DECL([JSOPTION_ANONFUNFIX], [], [ + AC_MSG_ERROR([Your SpiderMonkey library is too new. + +Versions of SpiderMonkey after the js185-1.0.0 release remove the optional +enforcement of preventing anonymous functions in a statement context. This +will most likely break your existing JavaScript code as well as render all +example code invalid. + +If you wish to ignore this error pass --enable-js-trunk to ./configure.])], + [[#include ]]) +fi + AC_SUBST(JSLIB) AC_LANG_PUSH(C) -- cgit v1.2.3 From 7c6e5f0f4340e997a761ff5ca627422fea90d4cc Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Tue, 18 Oct 2011 16:19:51 -0500 Subject: Minor fixes to link agianst SpiderMonkey trunk This patch allows couchjs to link against the SpiderMonkey as it existed in the mercurial hash 59c1e6bdb11 from [1]. This does *not* ensure compatibility with CouchDB as there are other things that will also need to be fixed. Specifically, the anonymous function issue for builtin JS functions. [1] http://hg.mozilla.org/mozilla-central/ --- configure.ac | 8 ++++++++ src/couchdb/priv/couch_js/http.c | 12 ++++++------ src/couchdb/priv/couch_js/sm185.c | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 6f9327d0..182e0eb5 100644 --- a/configure.ac +++ b/configure.ac @@ -214,6 +214,14 @@ AC_CHECK_LIB([$JS_LIB_BASE], [JS_GetStringCharsAndLength], AC_DEFINE([HAVE_JS_GET_STRING_CHARS_AND_LENGTH], [1], [Use newer JS_GetCharsAndLength function.])) +# Deal with JSScript -> JSObject -> JSScript switcheroo + +AC_CHECK_TYPE([JSScript*], + [AC_DEFINE([JSSCRIPT_TYPE], [JSScript*], [Use JSObject* for scripts])], + [AC_DEFINE([JSSCRIPT_TYPE], [JSObject*], [Use JSScript* for scripts])], + [[#include ]] +) + AC_LANG_POP(C) AC_ARG_WITH([win32-icu-binaries], [AC_HELP_STRING([--with-win32-icu-binaries=PATH], diff --git a/src/couchdb/priv/couch_js/http.c b/src/couchdb/priv/couch_js/http.c index 77078e35..7630c456 100644 --- a/src/couchdb/priv/couch_js/http.c +++ b/src/couchdb/priv/couch_js/http.c @@ -126,7 +126,7 @@ http_open(JSContext* cx, JSObject* req, jsval mth, jsval url, jsval snc) goto done; } - if(mth == JSVAL_VOID) { + if(JSVAL_IS_VOID(mth)) { JS_ReportError(cx, "You must specify a method."); goto done; } @@ -148,7 +148,7 @@ http_open(JSContext* cx, JSObject* req, jsval mth, jsval url, jsval snc) http->method = methid; - if(url == JSVAL_VOID) { + if(JSVAL_IS_VOID(url)) { JS_ReportError(cx, "You must specify a URL."); goto done; } @@ -164,7 +164,7 @@ http_open(JSContext* cx, JSObject* req, jsval mth, jsval url, jsval snc) goto done; } - if(snc != JSVAL_FALSE) { + if(JSVAL_IS_BOOLEAN(snc) && !JSVAL_TO_BOOLEAN(snc)) { JS_ReportError(cx, "Synchronous flag must be false."); goto done; } @@ -200,7 +200,7 @@ http_set_hdr(JSContext* cx, JSObject* req, jsval name, jsval val) goto done; } - if(name == JSVAL_VOID) + if(JSVAL_IS_VOID(name)) { JS_ReportError(cx, "You must speciy a header name."); goto done; @@ -213,7 +213,7 @@ http_set_hdr(JSContext* cx, JSObject* req, jsval name, jsval val) goto done; } - if(val == JSVAL_VOID) + if(JSVAL_IS_VOID(val)) { JS_ReportError(cx, "You must specify a header value."); goto done; @@ -258,7 +258,7 @@ http_send(JSContext* cx, JSObject* req, jsval body) goto done; } - if(body != JSVAL_VOID && body != JS_GetEmptyStringValue(cx)) { + if(!JSVAL_IS_VOID(body)) { bodystr = enc_string(cx, body, &bodylen); if(!bodystr) { JS_ReportError(cx, "Failed to encode body."); diff --git a/src/couchdb/priv/couch_js/sm185.c b/src/couchdb/priv/couch_js/sm185.c index 701d5677..6a4522e7 100644 --- a/src/couchdb/priv/couch_js/sm185.c +++ b/src/couchdb/priv/couch_js/sm185.c @@ -310,7 +310,7 @@ main(int argc, const char* argv[]) JSObject* global = NULL; JSCrossCompartmentCall *call = NULL; JSObject* klass = NULL; - JSObject* script; + JSSCRIPT_TYPE script; JSString* scriptsrc; const jschar* schars; size_t slen; -- cgit v1.2.3 From 5f59de1d4b8a6fbac537ff7419f68aa7015b0121 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Tue, 18 Oct 2011 20:30:10 -0400 Subject: Revert "Build couchjs with C, not C++. Fixes libm error on CentOS." This reverts commit 6b26f47e8287b2d1c1d7b74199647dec2e7c2bef. Turns out the 'libm' error is a very obscure way of reporting a lack of a C++ compiler. --- couchjs/c_src/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchjs/c_src/SConscript b/couchjs/c_src/SConscript index 4fc9e5a3..a5f8b66b 100644 --- a/couchjs/c_src/SConscript +++ b/couchjs/c_src/SConscript @@ -22,7 +22,7 @@ def require_lib(name): def runcmd(cmd): return commands.getstatusoutput(cmd) -env = Environment(CCFLAGS='-g -O2 -DXP_UNIX') +env = Environment(CC="c++", CCFLAGS='-g -O2 -DXP_UNIX') if os.uname()[0] == 'SunOS': env['CC'] = '/usr/sfw/bin/gcc' -- cgit v1.2.3 From e37148e14bdaf88a0a568edbade6cf9101afb4af Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Wed, 19 Oct 2011 12:57:25 +0100 Subject: mention 1.8.5 support in NEWS/CHANGES --- CHANGES | 1 + NEWS | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index ada57715..d62f0e16 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ Apache CouchDB CHANGES Version 1.1.1 ------------- +* Support SpiderMonkey 1.8.5 * Add configurable maximum to the number of bytes returned by _log. * Allow CommonJS modules to be an empty string. * Bump minimum Erlang version to R13B02. diff --git a/NEWS b/NEWS index 99cc474f..52df969d 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ Each release section notes when backwards incompatible changes have been made. Version 1.1.1 ------------- +* Support SpiderMonkey 1.8.5 * Add configurable maximum to the number of bytes returned by _log. * Allow CommonJS modules to be an empty string. * Bump minimum Erlang version to R13B02. -- cgit v1.2.3 From ac1f52b32b39e8adc2b7d74040da0e0db4894d2a Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Thu, 20 Oct 2011 17:25:25 +0100 Subject: Fix object sealing on sm 1.7.0 --- src/couchdb/priv/couch_js/sm170.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/couchdb/priv/couch_js/sm170.c b/src/couchdb/priv/couch_js/sm170.c index ebb6673f..c900b850 100644 --- a/src/couchdb/priv/couch_js/sm170.c +++ b/src/couchdb/priv/couch_js/sm170.c @@ -217,7 +217,7 @@ seal(JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval) return JS_TRUE; } - if(JS_SealObject(cx, obj, deep) != JS_TRUE) + if(JS_SealObject(cx, target, deep) != JS_TRUE) return JS_FALSE; *rval = JSVAL_VOID; -- cgit v1.2.3 From 0d0ed4122370bf279d26057395bdc508bc4ae9f7 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Thu, 20 Oct 2011 11:40:25 -0500 Subject: Fix JavaScript CLI test runner. Accidentally inverted the logic of a test when patching for newer versions of SpiderMonkey. --- src/couchdb/priv/couch_js/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/couchdb/priv/couch_js/http.c b/src/couchdb/priv/couch_js/http.c index 7630c456..052865aa 100644 --- a/src/couchdb/priv/couch_js/http.c +++ b/src/couchdb/priv/couch_js/http.c @@ -164,7 +164,7 @@ http_open(JSContext* cx, JSObject* req, jsval mth, jsval url, jsval snc) goto done; } - if(JSVAL_IS_BOOLEAN(snc) && !JSVAL_TO_BOOLEAN(snc)) { + if(JSVAL_IS_BOOLEAN(snc) && JSVAL_TO_BOOLEAN(snc)) { JS_ReportError(cx, "Synchronous flag must be false."); goto done; } -- cgit v1.2.3 From 89f7faa6d09248999fb51ffd2a13777168f51805 Mon Sep 17 00:00:00 2001 From: Filipe David Manana Date: Thu, 20 Oct 2011 17:55:58 +0100 Subject: Update CHANGES and NEWS to reflect COUCHDB-1129 --- CHANGES | 1 + NEWS | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index d62f0e16..8e89305f 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,7 @@ Version 1.1.1 * Fix replication crash when source database has a document with empty ID. * Fix deadlock when assigning couchjs processes to serve requests. * Fixes to the document multipart PUT API. +* Fixes regarding file descriptor leaks for databases with views. Version 1.1.0 ------------- diff --git a/NEWS b/NEWS index 52df969d..e62289ed 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ Version 1.1.1 * Fix replication crash when source database has a document with empty ID. * Fix deadlock when assigning couchjs processes to serve requests. * Fixes to the document multipart PUT API. +* Fixes regarding file descriptor leaks for databases with views. Version 1.1.0 ------------- -- cgit v1.2.3 From a5d2cea416567776369881ae5a521bf36f72ef02 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Thu, 20 Oct 2011 18:03:46 +0100 Subject: Fix object sealing with spidermonkey 1.7.0 --- couchjs/c_src/sm170.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchjs/c_src/sm170.c b/couchjs/c_src/sm170.c index 44cb5870..016c91e0 100644 --- a/couchjs/c_src/sm170.c +++ b/couchjs/c_src/sm170.c @@ -217,7 +217,7 @@ seal(JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval) return JS_TRUE; } - if(JS_SealObject(cx, obj, deep) != JS_TRUE) + if(JS_SealObject(cx, target, deep) != JS_TRUE) return JS_FALSE; *rval = JSVAL_VOID; -- cgit v1.2.3 From af7a6ae52890c6c158615068f2a48d40c52ec538 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Sun, 23 Oct 2011 12:27:35 -0500 Subject: Hardcode couchjs binary name Windows doesn't have the libgen.h header or an easily identified basename function. Instead of playing games we just configure the name with autoconf and run with that. --- configure.ac | 5 +++++ src/couchdb/priv/couch_js/help.h | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 182e0eb5..6a5d8653 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,12 @@ Is the Mozilla SpiderMonkey library installed?])])])])])])]) AC_SUBST(JS_LIB_BASE) +AC_DEFINE([COUCHJS_NAME], ["couchjs"], ["CouchJS executable name."]) + if test x${IS_WINDOWS} = xTRUE; then + + AC_DEFINE([COUCHJS_NAME], ["couchjs.exe"], ["CouchJS executable name."]) + if test -f "$JS_LIB_DIR/$JS_LIB_BASE.dll"; then # seamonkey 1.7- build layout on Windows JS_LIB_BINARY="$JS_LIB_DIR/$JS_LIB_BASE.dll" diff --git a/src/couchdb/priv/couch_js/help.h b/src/couchdb/priv/couch_js/help.h index c42c9f59..41025942 100644 --- a/src/couchdb/priv/couch_js/help.h +++ b/src/couchdb/priv/couch_js/help.h @@ -13,8 +13,6 @@ #ifndef COUCHJS_HELP_H #define COUCHJS_HELP_H -#include - #include "config.h" static const char VERSION_TEMPLATE[] = @@ -55,7 +53,7 @@ static const char USAGE_TEMPLATE[] = "\n" "Report bugs at <%s>.\n"; -#define BASENAME basename((char*)argv[0]) +#define BASENAME COUCHJS_NAME #define couch_version(basename) \ fprintf( \ -- cgit v1.2.3 From f351ee614b620f3c642cce63c95fced99ff4af46 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 24 Oct 2011 15:07:57 -0500 Subject: Fix SpiderMonkey source evaluation Looks like we had a couple commits get crossed over during the merges. This removes the original version of the patch that wrapped JS functions with parens. --- couchjs/js/util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchjs/js/util.js b/couchjs/js/util.js index a7449315..0b812fe1 100644 --- a/couchjs/js/util.js +++ b/couchjs/js/util.js @@ -91,9 +91,9 @@ var Couch = { } sandbox.require = require; } - var functionObject = evalcx("(" + source + ")", sandbox); + var functionObject = evalcx(source, sandbox); } else { - var functionObject = eval("(" + source + ")"); + var functionObject = eval(source); } } catch (err) { throw(["error", "compilation_error", err.toSource() + " (" + source + ")"]); -- cgit v1.2.3 From a6352493651f6f8e3430269555421b5599a77809 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Wed, 26 Oct 2011 14:04:54 -0400 Subject: Fix retrieval of headers larger than 4k Our headers start with a <<1>> and then four bytes indicating the length of the header and its checksum. When the header is larger than 4090 bytes it will be split across multiple blocks in the file and will need to be reassembled on read. The reassembly consists of stripping out <<0>> from the beginning of each subsequent block in the remove_block_prefixes/2 function. The bug here is that we tell remove_block_prefixes that we're starting 1 byte into the current block instead of 5, so it ends up removing one good byte from the header and injecting one or more random <<0>>s. Headers larger than 4k are very rare and generally require a view group with a huge number of indexes or indexes with fairly large reductions, which explains why this bug has gone undetected until now. Closes COUCHDB-1319. --- apps/couch/src/couch_file.erl | 2 +- apps/couch/test/etap/011-file-headers.t | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/couch/src/couch_file.erl b/apps/couch/src/couch_file.erl index dfc1f822..1985f5eb 100644 --- a/apps/couch/src/couch_file.erl +++ b/apps/couch/src/couch_file.erl @@ -528,7 +528,7 @@ load_header(Fd, Block) -> RawBin = <> end, <> = - iolist_to_binary(remove_block_prefixes(1, RawBin)), + iolist_to_binary(remove_block_prefixes(5, RawBin)), Md5Sig = couch_util:md5(HeaderBin), {ok, HeaderBin}. diff --git a/apps/couch/test/etap/011-file-headers.t b/apps/couch/test/etap/011-file-headers.t index 4705f629..764b10df 100755 --- a/apps/couch/test/etap/011-file-headers.t +++ b/apps/couch/test/etap/011-file-headers.t @@ -22,7 +22,7 @@ main(_) -> {S1, S2, S3} = now(), random:seed(S1, S2, S3), - etap:plan(17), + etap:plan(18), case (catch test()) of ok -> etap:end_tests(); @@ -68,6 +68,13 @@ test() -> etap:is({ok, Size2}, couch_file:bytes(Fd), "Rewriting the same second header returns the same second size."), + couch_file:write_header(Fd, erlang:make_tuple(5000, <<"CouchDB">>)), + etap:is( + couch_file:read_header(Fd), + {ok, erlang:make_tuple(5000, <<"CouchDB">>)}, + "Headers larger than the block size can be saved (COUCHDB-1319)" + ), + ok = couch_file:close(Fd), % Now for the fun stuff. Try corrupting the second header and see -- cgit v1.2.3 From 2e1054abbb568e400204e8afcf21cf91085f0f3b Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Wed, 2 Nov 2011 21:04:28 +0000 Subject: Add a script to create a source tarball --- make_tarball | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 make_tarball diff --git a/make_tarball b/make_tarball new file mode 100755 index 00000000..6b13c5fc --- /dev/null +++ b/make_tarball @@ -0,0 +1,20 @@ +#!/bin/sh -e + +COUCHDB_VERSION=`git describe --match 1.*` +BIGCOUCH_VERSION=`git describe` + +rm -rf .tmp +git archive HEAD --prefix=.tmp/bigcouch/ | tar xf - +pushd .tmp/bigcouch +git init +git add --all +git commit -m "Tarball commit" +git tag -m "CouchDB version" "$COUCHDB_VERSION" +echo "This is the release tarball for $BIGCOUCH_VERSION" > BUILD +git add BUILD +git commit -am "Tarball commit" +git tag -m "BigCouch version" "$BIGCOUCH_VERSION" +popd + +tar czf $BIGCOUCH_VERSION.tar.gz -C .tmp bigcouch +rm -rf .tmp -- cgit v1.2.3 From e0dd9f36cb405535708886e6451c0521a47b9fc1 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Tue, 8 Nov 2011 11:00:30 -0500 Subject: Simplify README --- README.Solaris | 6 -- README.md | 169 ++++++++++----------------------------------------------- 2 files changed, 28 insertions(+), 147 deletions(-) delete mode 100644 README.Solaris diff --git a/README.Solaris b/README.Solaris deleted file mode 100644 index 18b4b641..00000000 --- a/README.Solaris +++ /dev/null @@ -1,6 +0,0 @@ - -To build on solaris, you will need some additional packages. - -sudo pkgin install erlang-14.1.1 spidermonkey-1.8.0 icu-4.2.1 scmgit-1.7.0.7 - -BigCouch is tested on 5.11 snv_121 (http://genunix.org/dist/indiana/osol-1002-121-x86.iso) diff --git a/README.md b/README.md index 5a774c98..64fcde31 100644 --- a/README.md +++ b/README.md @@ -1,159 +1,46 @@ -### Overview +## Overview -BigCouch is a highly available, fault-tolerant, clustered, mostly api-compliant version of [Apache CouchDB][1]. While it appears to the end-user as one CouchDB instance, it is in fact one or more BigCouch nodes in an elastic cluster, acting in concert to store and retrieve documents, index and serve views, and serve CouchApps. BigCouch has been developed and is continually maintained by [Cloudant][2] who offer hosted CouchDB as a service. +BigCouch is a highly available, fault-tolerant, clustered, mostly api-compliant +version of [Apache CouchDB][1]. While it appears to the end-user as one CouchDB +instance, it is in fact one or more BigCouch nodes in an elastic cluster, +acting in concert to store and retrieve documents, index and serve views, and +serve CouchApps. BigCouch has been developed and is continually maintained by +[Cloudant][2]. -Clusters behave according to concepts outlined in [Amazon's Dynamo paper][4], namely that each BigCouch node can accept requests, data is placed on partitions based on a consistent hashing algorithm, and quorum protocols are for read/write operations. +Clusters behave according to concepts outlined in [Amazon's Dynamo paper][4], +namely that each BigCouch node can accept requests, data is placed on +partitions based on a consistent hashing algorithm, and quorum protocols are +used for read/write operations. -### Contents +BigCouch is made available under an Apache 2.0 license. See the LICENSE file +for details. - * README.md this file - * LICENSE open-source license governing BigCouch -### Getting Started +## Getting Started -#### Prerequisites +If your main intent is to use BigCouch, you can follow [this +guide](http://bigcouch.cloudant.com/use). If you’re interested in extending +BigCouch, patching bugs, etc., you should follow [these +instructions](http://bigcouch.cloudant.com/develop) instead. -BigCouch has the same dependencies as CouchDB: +More information can be found on the official [BigCouch +website](http://bigcouch.cloudant.com/). You can also ask questions on or +subscribe to [the mailing list](http://groups.google.com/group/bigcouch-user). - * Erlang (R13B03 or higher) (R14B01 or higher to build a release) - * ICU (4.2 is preferable) - * Spidermonkey (1.9.2 preferable, [https://launchpad.net/~commonjs/+archive/ppa/][6]) - * LibCurl (7.18 or higher) - * OpenSSL - * make - * Python (2.4 or higher) -#### Installing prerequisites on Ubuntu +## Troubleshooting - sudo apt-get install erlang libicu42 libicu-dev libcurl4-openssl-dev +Please see http://bigcouch.cloudant.com/troubleshoot -To install Spidermonkey 1.9.2 from PPA: +## Contact - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 74EE6429 - sudo bash -c 'echo "deb http://ppa.launchpad.net/commonjs/ppa/ubuntu karmic main" >> /etc/apt/sources.list.d/commonjs.list' - sudo apt-get update - sudo apt-get install libmozjs-1.9.2 libmozjs-1.9.2-dev - sudo ln -s /usr/lib/libmozjs-1.9.2.so /usr/lib/libmozjs.so - -#### Installing prerequisites on Mac OS X with [Homebrew][7] - - brew install erlang icu4c spidermonkey - brew ln icu4c - -#### Installing prerequisites on RedHat/Centos - - yum install js-devel libicu libicu-devel openssl openssl-devel python python-devel - - Erlang and LibCurl need to be installed from source to meet version requirements - -#### Building and installing BigCouch - -`$CLOUDANT_SRC` is the directory holding your downloaded source files, while `$PREFIX` is the prefix to which the software is installed (defaults to `/opt/bigcouch`): - - cd $CLOUDANT_SRC - ./configure -p $PREFIX - make - sudo make install - -`sudo` is only necessary when installing to a prefix which is not user-writeable. In any case, the installer tries to chown the database directory and logfile to the user who configured BigCouchbigcouch. - -Run into any issues? Check out our wiki, [https://github.com/cloudant/bigcouch/wiki/Troubleshooting][8] - -#### Starting BigCouch - - $PREFIX/bin/bigcouch - -Now, visit http://localhost:5984/_utils in a browser to verify the BigCouch node is operational. - -BigCouch listens on two ports. Defaults and explanations: - - * 5984 - front door, cluster-aware port, appears as a standalone CouchDB. - * 5986 - back door, single-node port, used for admin functions - -Note: see the `rel/sv/README` file for information on using `runit` to stop/start BigCouch. - -#### Joining a new node to the cluster - -Each BigCouch node has a local `nodes` database, accessible through the backend interface on port 5986. Documents in the `nodes` DB name nodes in the cluster. To add a new node, create a document with that node's name as the ID. For example - - curl -X PUT http://foo.example.com:5986/nodes/bigcouch@bar.example.com -d {} - -Everything else should be automatic, provided the machines can ping each other and the nodes set the same magic cookie. You are advised to change the magic cookie from the default in `rel/etc/vm.args` when on a public network. - -#### Local development cluster - -The `make dev` target will build a three-node cluster under the rel/ directory. Get the nodes running, like above, by doing the following (in separate terminals): - - ./rel/dev1/bin/bigcouch - ./rel/dev2/bin/bigcouch - ./rel/dev3/bin/bigcouch - -These development nodes listen on ports 15984/15986 (dev1), 25984/25986 (dev2), and 35984/35986 (dev3). Now, once the nodes are started, join the dev2 node by sending this PUT to dev1's listening backend port: - - curl -X PUT http://127.0.0.1:15986/nodes/dev2@127.0.0.1 -d {} - -To verify the two-node cluster has been linked properly, on either node (via proper frontend port), try: - - curl http://127.0.0.1:15984/_membership - -You should see something similar to this: - - {"all_nodes":["dev1@127.0.0.1","dev2@127.0.0.1"],"cluster_nodes":["dev1@127.0.0.1","dev2@127.0.0.1"]} - -Add node 3 to the cluster by sending a similar PUT to either of the first two nodes. - -#### Now What? - -If the above steps were successful, you should have a running BigCouch cluster that looks just like a standalone CouchDB. You may interact with it the same way you would a standalone CouchDB, via the HTTP REST interface. - -Because every node can handle requests equally, you may want to put a load balancer in front of the cluster and set up a round-robin strategy for distributing incoming requests across all of your cluster's nodes. - -##### Create a database: - - curl -X PUT http://loadbalancer:5984/test_db - -Also note that 'q' and 'n' are query string arguments that may be specified. These are Cloudant-specific options, and their values and defaults are discussed in the Configuration section below. Ex: &q=12 or &n=4. - -##### Create a document: - - curl -X PUT http://loadbalancer:5984/test_db/doc_1 -d '{"a":1,"b":2}' - -You may also provide 'r' and 'w' on the GET and PUT/POST document operations respectively. Their values and defaults are discussed in the Configuration section below. Ex: &r=3 for high consistency reads, or &w=1 for higher throughput writes. - -##### Check out Futon, CouchDB's web UI: - - * [http://loadbalancer:5984/_utils][5] - -### Configuration - -#### Cluster constants - -_Q_ - number of partitions per database. Q is specified in the default.ini file, but may be provided as a URL parameter when creating a database. Default value is 8, query parameter is &q=12 or similar. - -_N_ - replication constant. N defaults to 3, but can vary by database just as Q can vary. N copies of each document will be written to the data store, on N different nodes. - -_R_ - read quorum constant. N writes have occurred for each document, as noted above. When reads are requested, N reads are sent to the N nodes that store the particular document. The system will return to the requesting client with the document when R successful reads have returned, and agree on versioning. R defaults to 2. Lower R values often result in faster reads at the expense of consistency. Higher R values usually result in slower reads, but more consistent, or agreed-upon data values returning. - -_W_ - write quorum constant. When writing the N copies, the data store will respond to the write client after W successful writes have completed. The remaining N-W writes are still being attempted in the background, but the client receives a 201 Created status and can resume execution. W defaults to 2. Lower W values mean more write throughput, and higher W values mean more data durability. - -### Troubleshooting - -Please see [http://github.com/cloudant/bigcouch/wiki/troubleshooting][8] - -### Contact - -Cloudant folks are usually hanging out in IRC. Freenode, channel #cloudant. We may also be reached: - - * [http://cloudant.com][2] - * [info@cloudant.com][3] +Cloudant folks are usually hanging out in IRC. Freenode, channel #cloudant. +There's also a [Google Group](http://groups.google.com/group/bigcouch-user). ---- [1]: http://couchdb.apache.org [2]: http://cloudant.com -[3]: mailto:info@cloudant.com +[3]: http://haproxy.1wt.eu/ [4]: http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html -[5]: http://loadbalancer:5984/_utils -[6]: https://launchpad.net/~commonjs/+archive/ppa/ -[7]: http://mxcl.github.com/homebrew/ -[8]: http://github.com/cloudant/bigcouch/wiki/troubleshooting +[5]: https://github.com/cloudant/bigcouch/wiki/API-Extensions -- cgit v1.2.3 From 223646af60465522572cfea014f35bfa68496d0e Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Wed, 9 Nov 2011 13:08:49 +0000 Subject: Conditionally apply JSON encoding to update_seq values BigCouch 0.3 cannot parse requests of the form /db/_changes?since="123-foo" so the recent ?JSON_ENCODE addition to Since in two places causes 0.3 <-> 0.4 replication to fail with json_encode/badterm errors. This patch applies JSON encoding only when the Since value is not already a binary (i.e, when it's a [integer(), binary()]) and interop is restored. BugzID: 12833 --- apps/couch/src/couch_rep.erl | 3 ++- apps/couch/src/couch_rep_changes_feed.erl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/couch/src/couch_rep.erl b/apps/couch/src/couch_rep.erl index 8f2508f5..82b69bc9 100644 --- a/apps/couch/src/couch_rep.erl +++ b/apps/couch/src/couch_rep.erl @@ -834,7 +834,8 @@ ensure_full_commit(#http_db{headers = Headers} = Source, RequiredSeq) -> Req = Source#http_db{ resource = "_ensure_full_commit", method = post, - qs = [{seq, iolist_to_binary(?JSON_ENCODE(RequiredSeq))}], + qs = [{seq, case RequiredSeq of Bin when is_binary(Bin) -> Bin; + Else -> iolist_to_binary(?JSON_ENCODE(Else)) end}], headers = Headers1 }, {ResultProps} = couch_rep_httpc:request(Req), diff --git a/apps/couch/src/couch_rep_changes_feed.erl b/apps/couch/src/couch_rep_changes_feed.erl index 70db52a0..651069fb 100644 --- a/apps/couch/src/couch_rep_changes_feed.erl +++ b/apps/couch/src/couch_rep_changes_feed.erl @@ -64,7 +64,8 @@ init([Parent, #http_db{headers = Headers0} = Source, Since, PostProps]) -> BaseQS = [ {"style", all_docs}, {"heartbeat", 10000}, - {"since", iolist_to_binary(?JSON_ENCODE(Since))}, + {"since", case Since of Bin when is_binary(Bin) -> Bin; + Else -> iolist_to_binary(?JSON_ENCODE(Else)) end}, {"feed", Feed} ], {QS, Method, Body, Headers} = case get_value(<<"doc_ids">>, PostProps) of -- cgit v1.2.3 From 89850ce8d8ae32f8e0c3803655643a265b3f7fbd Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Wed, 9 Nov 2011 14:33:46 -0500 Subject: Bump fabric version and drop the pre1 from release version --- rebar.config | 2 +- rel/reltool.config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 417ddb2f..9816e46a 100644 --- a/rebar.config +++ b/rebar.config @@ -22,7 +22,7 @@ {rexi, ".*", {git, "https://github.com/cloudant/rexi.git", {tag, "1.5.5"}}}, {fabric, ".*", {git, "https://github.com/cloudant/fabric.git", - {tag, "2.0.1"}}}, + {tag, "2.0.2"}}}, {mem3, ".*", {git, "https://github.com/cloudant/mem3.git", {tag, "2.0.0"}}}, {chttpd, ".*", {git, "https://github.com/cloudant/chttpd.git", diff --git a/rel/reltool.config b/rel/reltool.config index 6aa8735c..3caff2d1 100644 --- a/rel/reltool.config +++ b/rel/reltool.config @@ -14,7 +14,7 @@ {sys, [ {lib_dirs, ["../apps", "../deps"]}, - {rel, "bigcouch", "0.4.0pre1", [ + {rel, "bigcouch", "0.4.0", [ kernel, stdlib, sasl, -- cgit v1.2.3 From 3462a5692ea0a7d76a024fbe38a8026e44e72876 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Wed, 9 Nov 2011 13:41:59 -0600 Subject: Add check for JS script object type --- couchjs/c_src/SConscript | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/couchjs/c_src/SConscript b/couchjs/c_src/SConscript index a5f8b66b..da3752bc 100644 --- a/couchjs/c_src/SConscript +++ b/couchjs/c_src/SConscript @@ -86,6 +86,13 @@ if not env.GetOption('clean'): conf.Define(vsn) break + ## Find the proper type for JS script objects + + if conf.CheckType("JSScript*", '#include "%s"' % jsapi): + conf.Define("JSSCRIPT_TYPE", "JSScript*") + else: + conf.Define("JSSCRIPT_TYPE", "JSObject*") + ## Define properties for -h / -V (_, vsn) = runcmd("git describe --match 1.*") -- cgit v1.2.3 From 83a451f1e8166ec62baa04932281615b92fde946 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Thu, 1 Dec 2011 10:00:06 -0600 Subject: Set the stack size for sub contexts I was forgetting to pass the args through to evalcx so that it could use the stack size specified on the command line. --- couchjs/c_src/sm170.c | 5 ++++- couchjs/c_src/sm180.c | 5 ++++- couchjs/c_src/sm185.c | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/couchjs/c_src/sm170.c b/couchjs/c_src/sm170.c index 016c91e0..61f764dd 100644 --- a/couchjs/c_src/sm170.c +++ b/couchjs/c_src/sm170.c @@ -122,12 +122,14 @@ evalcx(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) size_t srclen; JSBool ret = JS_FALSE; + couch_args* args = (couch_args*) JS_GetContextPrivate(cx); + sandbox = NULL; if(!JS_ConvertArguments(cx, argc, argv, "S / o", &str, &sandbox)) { return JS_FALSE; } - subcx = JS_NewContext(JS_GetRuntime(cx), 8L * 1024L); + subcx = JS_NewContext(JS_GetRuntime(cx), args->stack_size); if(!subcx) { JS_ReportOutOfMemory(cx); return JS_FALSE; @@ -306,6 +308,7 @@ main(int argc, const char* argv[]) if(cx == NULL) return 1; + JS_SetContextPrivate(cx, args); JS_SetErrorReporter(cx, couch_error); JS_ToggleOptions(cx, JSOPTION_XML); diff --git a/couchjs/c_src/sm180.c b/couchjs/c_src/sm180.c index 7dc2a974..6c33345f 100644 --- a/couchjs/c_src/sm180.c +++ b/couchjs/c_src/sm180.c @@ -127,12 +127,14 @@ evalcx(JSContext *cx, uintN argc, jsval* vp) jsval rval; JSBool ret = JS_FALSE; + couch_args* args = (couch_args*) JS_GetContextPrivate(cx); + sandbox = NULL; if(!JS_ConvertArguments(cx, argc, argv, "S / o", &str, &sandbox)) { return JS_FALSE; } - subcx = JS_NewContext(JS_GetRuntime(cx), 8L * 1024L); + subcx = JS_NewContext(JS_GetRuntime(cx), args->stack_size); if(!subcx) { JS_ReportOutOfMemory(cx); return JS_FALSE; @@ -315,6 +317,7 @@ main(int argc, const char* argv[]) if(cx == NULL) return 1; + JS_SetContextPrivate(cx, args); JS_SetErrorReporter(cx, couch_error); JS_ToggleOptions(cx, JSOPTION_XML); diff --git a/couchjs/c_src/sm185.c b/couchjs/c_src/sm185.c index a7258460..ecca4c8b 100644 --- a/couchjs/c_src/sm185.c +++ b/couchjs/c_src/sm185.c @@ -147,12 +147,14 @@ evalcx(JSContext *cx, uintN argc, jsval* vp) jsval rval; JSBool ret = JS_FALSE; + couch_args* args = (couch_args*) JS_GetContextPrivate(cx); + sandbox = NULL; if(!JS_ConvertArguments(cx, argc, argv, "S / o", &str, &sandbox)) { return JS_FALSE; } - subcx = JS_NewContext(JS_GetRuntime(cx), 8L * 1024L); + subcx = JS_NewContext(JS_GetRuntime(cx), args->stack_size); if(!subcx) { JS_ReportOutOfMemory(cx); return JS_FALSE; @@ -327,6 +329,7 @@ main(int argc, const char* argv[]) if(cx == NULL) return 1; + JS_SetContextPrivate(cx, args); JS_SetErrorReporter(cx, couch_error); JS_ToggleOptions(cx, JSOPTION_XML); -- cgit v1.2.3 From 0bdc62b8b186de839cf44721b8b61aa1eeae1f14 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Tue, 6 Dec 2011 11:49:10 -0500 Subject: Allow CPPPATH to be overriden in the environment --- couchjs/c_src/SConscript | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/couchjs/c_src/SConscript b/couchjs/c_src/SConscript index da3752bc..451c03d3 100644 --- a/couchjs/c_src/SConscript +++ b/couchjs/c_src/SConscript @@ -22,7 +22,8 @@ def require_lib(name): def runcmd(cmd): return commands.getstatusoutput(cmd) -env = Environment(CC="c++", CCFLAGS='-g -O2 -DXP_UNIX') +env = Environment(CC="c++", CCFLAGS='-g -O2 -DXP_UNIX', + CPPPATH=os.getenv("CPPPATH")) if os.uname()[0] == 'SunOS': env['CC'] = '/usr/sfw/bin/gcc' -- cgit v1.2.3 From 6cec3db82d6e17e413e771ad0e3aab156bafbc1b Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Tue, 22 Nov 2011 11:52:43 -0600 Subject: Make cURL a soft dependency This makes sure that we only optionally require the same version of cURL that CouchDB does. --- couchjs/c_src/SConscript | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/couchjs/c_src/SConscript b/couchjs/c_src/SConscript index 451c03d3..68ad5d3e 100644 --- a/couchjs/c_src/SConscript +++ b/couchjs/c_src/SConscript @@ -52,7 +52,6 @@ if not env.GetOption('clean'): require_lib('m') require_lib('pthread') - require_lib('curl') require_lib('nspr4') ## check for SpiderMonkey development header @@ -94,6 +93,16 @@ if not env.GetOption('clean'): else: conf.Define("JSSCRIPT_TYPE", "JSObject*") + ## Check if curl is available + try: + vsn = runcmd("curl-config --version")[1] + vsn = vsn.split()[-1].strip().split(".") + vsn = tuple(map(int, vsn)) + if vsn > (7, 18, 0): + require_lib('curl') + except: + pass + ## Define properties for -h / -V (_, vsn) = runcmd("git describe --match 1.*") -- cgit v1.2.3 From 631ab540159c4e1f64baf609e225fb6ef7cddd18 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Tue, 10 Jan 2012 14:53:17 -0500 Subject: Bump fabric and chttpd versions The fabric bump fixes some corner cases for read repair. The chttpd bump improves error handling for delayed responses. --- rebar.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 9816e46a..32a95fc8 100644 --- a/rebar.config +++ b/rebar.config @@ -22,11 +22,11 @@ {rexi, ".*", {git, "https://github.com/cloudant/rexi.git", {tag, "1.5.5"}}}, {fabric, ".*", {git, "https://github.com/cloudant/fabric.git", - {tag, "2.0.2"}}}, + {tag, "2.0.3"}}}, {mem3, ".*", {git, "https://github.com/cloudant/mem3.git", {tag, "2.0.0"}}}, {chttpd, ".*", {git, "https://github.com/cloudant/chttpd.git", - {tag, "1.4.0"}}} + {tag, "1.4.1"}}} ]}. % needed for a clean transition to the deps model {clean_files, [ -- cgit v1.2.3 From 91c25cff6fb000ce9d2e4945df2fd034d72e817b Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Tue, 10 Jan 2012 15:04:16 -0500 Subject: Remove unused URLs --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 64fcde31..2a6c1ead 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,4 @@ There's also a [Google Group](http://groups.google.com/group/bigcouch-user). [1]: http://couchdb.apache.org [2]: http://cloudant.com -[3]: http://haproxy.1wt.eu/ [4]: http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html -[5]: https://github.com/cloudant/bigcouch/wiki/API-Extensions -- cgit v1.2.3 From 121c71c8f0af5c76ae5b6a0383796a850f612388 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Tue, 10 Jan 2012 15:06:10 -0500 Subject: Remove superfluous formatting --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 2a6c1ead..b6a87af3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ used for read/write operations. BigCouch is made available under an Apache 2.0 license. See the LICENSE file for details. - ## Getting Started If your main intent is to use BigCouch, you can follow [this @@ -27,7 +26,6 @@ More information can be found on the official [BigCouch website](http://bigcouch.cloudant.com/). You can also ask questions on or subscribe to [the mailing list](http://groups.google.com/group/bigcouch-user). - ## Troubleshooting Please see http://bigcouch.cloudant.com/troubleshoot @@ -37,8 +35,6 @@ Please see http://bigcouch.cloudant.com/troubleshoot Cloudant folks are usually hanging out in IRC. Freenode, channel #cloudant. There's also a [Google Group](http://groups.google.com/group/bigcouch-user). ----- - [1]: http://couchdb.apache.org [2]: http://cloudant.com [4]: http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html -- cgit v1.2.3 From effae95921f30d4847f8a8082f7e6f619c5108d7 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Mon, 16 Jan 2012 19:03:03 +0000 Subject: Use spawn_monitor to await process completion BugzID: 13133 --- apps/couch/src/couch_doc.erl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/couch/src/couch_doc.erl b/apps/couch/src/couch_doc.erl index 63ac0892..2c841835 100644 --- a/apps/couch/src/couch_doc.erl +++ b/apps/couch/src/couch_doc.erl @@ -484,13 +484,10 @@ atts_to_mp([Att | RestAtts], Boundary, WriteFun, doc_from_multi_part_stream(ContentType, DataFun) -> - Parent = self(), - Parser = spawn_link(fun() -> + {Parser, ParserRef} = spawn_monitor(fun() -> {<<"--">>, _, _} = couch_httpd:parse_multipart_request( ContentType, DataFun, - fun(Next) -> mp_parse_doc(Next, []) end), - unlink(Parent), - Parent ! {self(), finished} + fun(Next) -> mp_parse_doc(Next, []) end) end), Parser ! {get_doc_bytes, self()}, receive @@ -505,7 +502,7 @@ doc_from_multi_part_stream(ContentType, DataFun) -> A end, Doc#doc.atts), WaitFun = fun() -> - receive {Parser, finished} -> ok end, + receive {'DOWN', ParserRef, _, _, _} -> ok end, erlang:put(mochiweb_request_recv, true) end, {ok, Doc#doc{atts=Atts2}, WaitFun, Parser} -- cgit v1.2.3 From 5a7a1a536f32794910e8730ad93891f23a4e8895 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Mon, 16 Jan 2012 22:11:20 +0000 Subject: Only set the process dictionary if exit was ok --- apps/couch/src/couch_doc.erl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/couch/src/couch_doc.erl b/apps/couch/src/couch_doc.erl index 2c841835..923fbb0e 100644 --- a/apps/couch/src/couch_doc.erl +++ b/apps/couch/src/couch_doc.erl @@ -487,7 +487,8 @@ doc_from_multi_part_stream(ContentType, DataFun) -> {Parser, ParserRef} = spawn_monitor(fun() -> {<<"--">>, _, _} = couch_httpd:parse_multipart_request( ContentType, DataFun, - fun(Next) -> mp_parse_doc(Next, []) end) + fun(Next) -> mp_parse_doc(Next, []) end), + exit(ok) end), Parser ! {get_doc_bytes, self()}, receive @@ -502,8 +503,14 @@ doc_from_multi_part_stream(ContentType, DataFun) -> A end, Doc#doc.atts), WaitFun = fun() -> - receive {'DOWN', ParserRef, _, _, _} -> ok end, - erlang:put(mochiweb_request_recv, true) + receive {'DOWN', ParserRef, _, _, Result} -> ok end, + case Result of + ok -> + erlang:put(mochiweb_request_recv, true); + _Else -> + ?LOG_ERROR("Unexpected msg while parsing multipart stream: ~p", + [Result]) + end end, {ok, Doc#doc{atts=Atts2}, WaitFun, Parser} end. -- cgit v1.2.3 From b5c6252b4f99092215f46fe62be5b124eeac734d Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Tue, 17 Jan 2012 22:33:07 +0000 Subject: Bump to chttpd 1.4.2 --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 32a95fc8..66366cf5 100644 --- a/rebar.config +++ b/rebar.config @@ -26,7 +26,7 @@ {mem3, ".*", {git, "https://github.com/cloudant/mem3.git", {tag, "2.0.0"}}}, {chttpd, ".*", {git, "https://github.com/cloudant/chttpd.git", - {tag, "1.4.1"}}} + {tag, "1.4.2"}}} ]}. % needed for a clean transition to the deps model {clean_files, [ -- cgit v1.2.3 From 855bb7dcda1cef59c449d62de35d9c4d74683731 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Wed, 18 Jan 2012 13:39:37 +0000 Subject: Revert use of spawn_monitor As Filipe correctly points out, we want the parent to die if the child dies. --- apps/couch/src/couch_doc.erl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/apps/couch/src/couch_doc.erl b/apps/couch/src/couch_doc.erl index 923fbb0e..63ac0892 100644 --- a/apps/couch/src/couch_doc.erl +++ b/apps/couch/src/couch_doc.erl @@ -484,11 +484,13 @@ atts_to_mp([Att | RestAtts], Boundary, WriteFun, doc_from_multi_part_stream(ContentType, DataFun) -> - {Parser, ParserRef} = spawn_monitor(fun() -> + Parent = self(), + Parser = spawn_link(fun() -> {<<"--">>, _, _} = couch_httpd:parse_multipart_request( ContentType, DataFun, fun(Next) -> mp_parse_doc(Next, []) end), - exit(ok) + unlink(Parent), + Parent ! {self(), finished} end), Parser ! {get_doc_bytes, self()}, receive @@ -503,14 +505,8 @@ doc_from_multi_part_stream(ContentType, DataFun) -> A end, Doc#doc.atts), WaitFun = fun() -> - receive {'DOWN', ParserRef, _, _, Result} -> ok end, - case Result of - ok -> - erlang:put(mochiweb_request_recv, true); - _Else -> - ?LOG_ERROR("Unexpected msg while parsing multipart stream: ~p", - [Result]) - end + receive {Parser, finished} -> ok end, + erlang:put(mochiweb_request_recv, true) end, {ok, Doc#doc{atts=Atts2}, WaitFun, Parser} end. -- cgit v1.2.3 From 050b8c9e0bac0f35407e3cf741d2732f50374132 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Fri, 20 Jan 2012 19:37:05 +0000 Subject: Bump dependencies for pre7 release --- rebar.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 66366cf5..6b49e107 100644 --- a/rebar.config +++ b/rebar.config @@ -22,11 +22,11 @@ {rexi, ".*", {git, "https://github.com/cloudant/rexi.git", {tag, "1.5.5"}}}, {fabric, ".*", {git, "https://github.com/cloudant/fabric.git", - {tag, "2.0.3"}}}, + {tag, "2.0.4"}}}, {mem3, ".*", {git, "https://github.com/cloudant/mem3.git", {tag, "2.0.0"}}}, {chttpd, ".*", {git, "https://github.com/cloudant/chttpd.git", - {tag, "1.4.2"}}} + {tag, "1.4.3"}}} ]}. % needed for a clean transition to the deps model {clean_files, [ -- cgit v1.2.3 From 6696d6fd42620f87f29f09f03daaf5fbe454e10d Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Tue, 24 Jan 2012 03:29:40 -0600 Subject: Minor bug getting the reduce_limit setting --- apps/couch/src/couch_proc_manager.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/couch/src/couch_proc_manager.erl b/apps/couch/src/couch_proc_manager.erl index 438f7973..509da9ba 100644 --- a/apps/couch/src/couch_proc_manager.erl +++ b/apps/couch/src/couch_proc_manager.erl @@ -150,7 +150,7 @@ make_proc(Pid, Lang, Mod) -> {ok, Proc}. get_query_server_config() -> - Limit = couch_config:get("query_server_config", <<"reduce_limit">>, "true"), + Limit = couch_config:get("query_server_config", "reduce_limit", "true"), {[{<<"reduce_limit">>, list_to_atom(Limit)}]}. proc_with_ddoc(DDoc, DDocKey, Procs) -> -- cgit v1.2.3 From f199c336b304b1a9abc03d6898b10dafb7a17ad6 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Tue, 31 Jan 2012 14:34:59 -0500 Subject: Fix bug in replicator request piplining A replication with both an HTTP source and target on the same host and port could end up in a dead lock due to ibrowse replication pipelining when attachments are present on the source. The ibrowse http worker would end up forming a multipart/mime body using anonymous reader functions for attachment stubs. When the attachment stub functions are executed it is possible that they end up assigned to the same ibrowse worker. This is a bit of a long path but then end result is equivalent to calling gen_server:call(self(), Args, infinity) from a gen_server callback. A quick work around for users is to set up a DNA alias (possibly in /etc/hosts) or to use a combination of hostname and ip address so that ibrowse assigns the requests to different pools. --- apps/couch/src/couch_rep_writer.erl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/couch/src/couch_rep_writer.erl b/apps/couch/src/couch_rep_writer.erl index 40323925..6f557107 100644 --- a/apps/couch/src/couch_rep_writer.erl +++ b/apps/couch/src/couch_rep_writer.erl @@ -126,13 +126,18 @@ write_multi_part_doc(#http_db{headers=Headers} = Db, #doc{atts=Atts} = Doc) -> {"Content-Length", Len} | Headers ] }, - Result = case couch_rep_httpc:request(Request) of - {[{<<"error">>, Error}, {<<"reason">>, Reason}]} -> - {Pos, [RevId | _]} = Doc#doc.revs, - ErrId = couch_util:to_existing_atom(Error), - [{Doc#doc.id, couch_doc:rev_to_str({Pos, RevId})}, {ErrId, Reason}]; - _ -> - [] + Conn = couch_rep_httpc:spawn_link_worker_process(Request), + Result = try + case couch_rep_httpc:request(Request) of + {[{<<"error">>, Error}, {<<"reason">>, Reason}]} -> + {Pos, [RevId | _]} = Doc#doc.revs, + ErrId = couch_util:to_existing_atom(Error), + [{Doc#doc.id, couch_doc:rev_to_str({Pos, RevId})}, {ErrId, Reason}]; + _ -> + [] + end + after + ibrowse:stop_worker_process(Conn) end, StreamerPid ! stop, Result. -- cgit v1.2.3 From db23528537fed7b9b0e85d3f3617f560cb52d630 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Tue, 31 Jan 2012 16:59:28 -0500 Subject: Fix previous commit --- apps/couch/src/couch_rep_writer.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/couch/src/couch_rep_writer.erl b/apps/couch/src/couch_rep_writer.erl index 6f557107..cea4408e 100644 --- a/apps/couch/src/couch_rep_writer.erl +++ b/apps/couch/src/couch_rep_writer.erl @@ -128,7 +128,7 @@ write_multi_part_doc(#http_db{headers=Headers} = Db, #doc{atts=Atts} = Doc) -> }, Conn = couch_rep_httpc:spawn_link_worker_process(Request), Result = try - case couch_rep_httpc:request(Request) of + case couch_rep_httpc:request(Request#http_db{conn=Conn}) of {[{<<"error">>, Error}, {<<"reason">>, Reason}]} -> {Pos, [RevId | _]} = Doc#doc.revs, ErrId = couch_util:to_existing_atom(Error), -- cgit v1.2.3