Skip to content

Commit 2578b55

Browse files
committed
nouveau: use http/2
we lose the pipelining benefit for indexing as http/2 does not support it but we benefit from far fewer connections between couchdb and nouveau server.
1 parent 020a52c commit 2578b55

File tree

15 files changed

+302
-255
lines changed

15 files changed

+302
-255
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ src/couch/priv/couchspawnkillable
5353
src/couch/priv/couch_ejson_compare/couch_ejson_compare.d
5454
src/couch/priv/couch_js/**/*.d
5555
src/couch/priv/icu_driver/couch_icu_driver.d
56+
src/cowlib/
5657
src/mango/src/mango_cursor_text.nocompile
5758
src/excoveralls/
5859
src/fauxton/
5960
src/folsom/
61+
src/gun/
6062
src/hackney/
6163
src/hqueue/
6264
src/ibrowse/

configure

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ ERLANG_MD5="false"
3434
SKIP_DEPS="false"
3535
WITH_SPIDERMONKEY="true"
3636

37+
export GIT_CONFIG_COUNT=1
38+
export GIT_CONFIG_KEY_0="url.https://github.com/apache/couchdb-.insteadOf"
39+
export GIT_CONFIG_VALUE_0="https://github.com/ninenines/"
40+
3741
run_erlang() {
3842
erl -noshell -eval "$1" -eval "halt()."
3943
}

configure.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ with_docs = $BuildDocs
248248
with_nouveau = $($WithNouveau.ToString().ToLower())
249249
with_clouseau = $($WithClouseau.ToString().ToLower())
250250
251+
$Env:GIT_CONFIG_COUNT = 1
252+
$Env:GIT_CONFIG_KEY_0 = "url.https://github.com/apache/couchdb-.insteadOf"
253+
$Env:GIT_CONFIG_VALUE_0 = "https://github.com/ninenines/"
254+
251255
user = $CouchDBUser
252256
253257
js_engine = $JSEngine
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
package org.apache.couchdb.nouveau.api;
15+
16+
import com.fasterxml.jackson.annotation.JsonProperty;
17+
18+
public class Ok {
19+
20+
public static final Ok INSTANCE = new Ok();
21+
22+
@JsonProperty
23+
public boolean ok() {
24+
return true;
25+
}
26+
}

nouveau/src/main/java/org/apache/couchdb/nouveau/resources/IndexResource.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.apache.couchdb.nouveau.api.IndexDefinition;
3636
import org.apache.couchdb.nouveau.api.IndexInfo;
3737
import org.apache.couchdb.nouveau.api.IndexInfoRequest;
38+
import org.apache.couchdb.nouveau.api.Ok;
3839
import org.apache.couchdb.nouveau.api.SearchRequest;
3940
import org.apache.couchdb.nouveau.api.SearchResults;
4041
import org.apache.couchdb.nouveau.core.IndexManager;
@@ -54,27 +55,29 @@ public IndexResource(final IndexManager indexManager) {
5455
}
5556

5657
@PUT
57-
public void createIndex(@PathParam("name") String name, @NotNull @Valid IndexDefinition indexDefinition)
58+
public Ok createIndex(@PathParam("name") String name, @NotNull @Valid IndexDefinition indexDefinition)
5859
throws IOException {
5960
indexManager.create(name, indexDefinition);
61+
return Ok.INSTANCE;
6062
}
6163

6264
@DELETE
6365
@Path("/doc/{docId}")
64-
public void deleteDoc(
66+
public Ok deleteDoc(
6567
@PathParam("name") String name,
6668
@PathParam("docId") String docId,
6769
@NotNull @Valid DocumentDeleteRequest request)
6870
throws Exception {
69-
indexManager.with(name, (index) -> {
71+
return indexManager.with(name, (index) -> {
7072
index.delete(docId, request);
71-
return null;
73+
return Ok.INSTANCE;
7274
});
7375
}
7476

7577
@DELETE
76-
public void deletePath(@PathParam("name") String path, @Valid final List<String> exclusions) throws IOException {
78+
public Ok deletePath(@PathParam("name") String path, @Valid final List<String> exclusions) throws IOException {
7779
indexManager.deleteAll(path, exclusions);
80+
return Ok.INSTANCE;
7881
}
7982

8083
@GET
@@ -85,9 +88,8 @@ public IndexInfo getIndexInfo(@PathParam("name") String name) throws Exception {
8588
}
8689

8790
@POST
88-
public void setIndexInfo(@PathParam("name") String name, @NotNull @Valid IndexInfoRequest request)
89-
throws Exception {
90-
indexManager.with(name, (index) -> {
91+
public Ok setIndexInfo(@PathParam("name") String name, @NotNull @Valid IndexInfoRequest request) throws Exception {
92+
return indexManager.with(name, (index) -> {
9193
if (request.getMatchUpdateSeq().isPresent()
9294
&& request.getUpdateSeq().isPresent()) {
9395
index.setUpdateSeq(
@@ -99,7 +101,7 @@ public void setIndexInfo(@PathParam("name") String name, @NotNull @Valid IndexIn
99101
request.getMatchPurgeSeq().getAsLong(),
100102
request.getPurgeSeq().getAsLong());
101103
}
102-
return null;
104+
return Ok.INSTANCE;
103105
});
104106
}
105107

@@ -114,14 +116,14 @@ public SearchResults searchIndex(@PathParam("name") String name, @NotNull @Valid
114116

115117
@PUT
116118
@Path("/doc/{docId}")
117-
public void updateDoc(
119+
public Ok updateDoc(
118120
@PathParam("name") String name,
119121
@PathParam("docId") String docId,
120122
@NotNull @Valid DocumentUpdateRequest request)
121123
throws Exception {
122-
indexManager.with(name, (index) -> {
124+
return indexManager.with(name, (index) -> {
123125
index.update(docId, request);
124-
return null;
126+
return Ok.INSTANCE;
125127
});
126128
}
127129
}

rebar.config.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ DepDescs = [
158158
{fauxton, {url, "https://github.com/apache/couchdb-fauxton"},
159159
{tag, "v1.3.4"}, [raw]},
160160
{ibrowse, "ibrowse", {tag, "CouchDB-4.4.2-6"}},
161+
{gun, "gun", {tag, "2.2.0"}},
161162
{jiffy, "jiffy", {tag, "1.1.2"}},
162163
{mochiweb, "mochiweb", {tag, "v3.2.2"}},
163164
{meck, "meck", {tag, "1.0.0"}},

rel/nouveau.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ logging:
88

99
server:
1010
applicationConnectors:
11-
- type: http
11+
- type: h2c
1212
bindHost: 127.0.0.1
1313
port: {{nouveau_port}}
1414
useDateHeader: false
1515
adminConnectors:
16-
- type: http
16+
- type: h2c
1717
bindHost: 127.0.0.1
1818
port: {{nouveau_admin_port}}
1919
useDateHeader: false

rel/reltool.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
ets_lru,
4949
fabric,
5050
global_changes,
51+
gun,
52+
cowlib,
5153
ibrowse,
5254
ioq,
5355
jiffy,
@@ -111,6 +113,8 @@
111113
{app, ets_lru, [{incl_cond, include}]},
112114
{app, fabric, [{incl_cond, include}]},
113115
{app, global_changes, [{incl_cond, include}]},
116+
{app, gun, [{incl_cond, include}]},
117+
{app, cowlib, [{incl_cond, include}]},
114118
{app, ibrowse, [{incl_cond, include}]},
115119
{app, ioq, [{incl_cond, include}]},
116120
{app, jiffy, [{incl_cond, include}]},

src/nouveau/src/nouveau.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{vsn, git},
1919
{applications, [
2020
config,
21-
ibrowse,
21+
gun,
2222
kernel,
2323
stdlib,
2424
mem3,

0 commit comments

Comments
 (0)