Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert Newson rnewson

View GitHub Profile
View gist:8720700
commit 3659c01c686f61ae222735dd9e08b932163438e1
Author: Robert Newson <rnewson@apache.org>
Date: 2014-01-30 21:46:36 +0000
Produce a readable error if status code for open_revs is not 200
CouchDB-2043
diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
index 52e15b7..344074e 100644
View gist:8709497
Last login: Thu Jan 30 13:49:07 on ttys006
curl l% ➜ ~ curl localhost:5984/db1 -XPUT
{"ok":true}
➜ ~ curl localhost:5984/db1/doc1 -XPUT -d {}
{"ok":true,"id":"doc1","rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl 'localhost:5984/db1/doc1?rev=1-967a00dff5e02add41819138abb3284d' -X DELETE
{"ok":true,"id":"doc1","rev":"2-eec205a9d413992850a6e32678485900"}
➜ ~ curl 'localhost:5984/db1/doc1?latest=true'
{"error":"not_found","reason":"deleted"}
➜ ~ curl -g 'localhost:5984/db1/doc1?latest=true&open_revs=["1-967a00dff5e02add41819138abb3284d"]' -sv
View gist:8795078
0000000000001058 D _couch_driver_entry
0000000000000dc0 t _couch_drv_control
0000000000000cb0 t _couch_drv_start
0000000000000d80 t _couch_drv_stop
U _driver_alloc
U _driver_alloc_binary
U _driver_free
0000000000000eb0 T _driver_init
U _memcpy
0000000000000c60 T _return_control_result
View gist:8965429
diff --git a/src/couch_httpd.erl b/src/couch_httpd.erl
index db90129..45dd524 100644
--- a/src/couch_httpd.erl
+++ b/src/couch_httpd.erl
@@ -582,12 +582,17 @@ verify_is_server_admin(#user_ctx{roles=Roles}) ->
end.
log_request(#httpd{mochi_req=MochiReq,peer=Peer}, Code) ->
- ?LOG_INFO("~s - - ~s ~s ~B", [
- Peer,
View gist:8977883
diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
index 52e15b7..77d72d2 100644
--- a/src/couch_replicator/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl
@@ -171,13 +171,16 @@ open_doc_revs(#httpdb{} = HttpDb, Id, Revs, Options, Fun, Acc) ->
QS = options_to_query_args(HttpDb, Path, [revs, {open_revs, Revs} | Options]),
{Pid, Ref} = spawn_monitor(fun() ->
Self = self(),
- Callback = fun(200, Headers, StreamDataFun) ->
+ Callback = fun
View bulk_delete.js
var docs = [
{ _id: 'foo',
_rev: '1-70aa8fe77bbe596bded4a9de3aa185e4',
"foo": "bar"
},
{ _id: 'bar',
_rev: '1-70aa8fe77bbe596bded4a9de3aa185e4',
"bar": "foo"
}
]
View gist:9923643
diff --git a/src/couch_index/src/couch_index_updater.erl b/src/couch_index/src/couch_index_updater.erl
index c6d3059..ec3de54 100644
--- a/src/couch_index/src/couch_index_updater.erl
+++ b/src/couch_index/src/couch_index_updater.erl
@@ -35,7 +35,7 @@ start_link(Index, Module) ->
run(Pid, IdxState) ->
- gen_server:call(Pid, {update, IdxState}).
+ gen_server:call(Pid, {update, IdxState}, infinity).
View gist:10008876
diff --git a/src/couchdb/couch_httpd_auth.erl b/src/couchdb/couch_httpd_auth.erl
index 08841fb..91acc1d 100644
--- a/src/couchdb/couch_httpd_auth.erl
+++ b/src/couchdb/couch_httpd_auth.erl
@@ -367,12 +367,21 @@ authenticate(Pass, UserProps) ->
{couch_passwords:simple(Pass, UserSalt),
couch_util:get_value(<<"password_sha">>, UserProps, nil)};
<<"pbkdf2">> ->
- Iterations = couch_util:get_value(<<"iterations">>, UserProps, 10000),
+ Iterations = iterations(UserProps),
View gist:10927882
commit fd0850677e1e2c6aabb35e67d351529df7097890
Author: Robert Newson <rnewson@apache.org>
Date: Tue Apr 15 13:44:50 2014 +0100
Copy {main.js,coffee-script.js} to correct directory
diff --git a/rel/reltool.config b/rel/reltool.config
index 331e2b1..f180591 100644
--- a/rel/reltool.config
+++ b/rel/reltool.config
@rnewson
rnewson / Extra logging
Created Apr 18, 2014
Demonstrating that duplicate rows (same key emitted more than once from the same document) are indexed in value order.
View Extra logging
diff --git a/share/server/views.js b/share/server/views.js
index 499a91b..7d2f178 100644
--- a/share/server/views.js
+++ b/share/server/views.js
@@ -121,6 +121,7 @@ var Views = (function() {
buf.push("[]");
}
}
+ log(buf.join(", "));
print("[" + buf.join(", ") + "]");