Skip to content

Commit b275635

Browse files
authored
Merge pull request #4956 from apache/nouveau-package-2
Control nouveau.yaml in configure and dev/run
2 parents 4f3dc95 + a6a1ae0 commit b275635

File tree

9 files changed

+61
-26
lines changed

9 files changed

+61
-26
lines changed

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ python-black-update: .venv/bin/black
228228
build-aux/*.py dev/run src/mango/test/*.py src/docs/src/conf.py src/docs/ext/*.py .
229229

230230
-include install.mk
231-
ifeq ($(with_nouveau), 0)
231+
ifeq ($(with_nouveau), false)
232232
exclude_nouveau=--exclude nouveau
233233
endif
234234

@@ -429,7 +429,7 @@ else
429429
endif
430430
endif
431431

432-
ifeq ($(with_nouveau), 1)
432+
ifeq ($(with_nouveau), true)
433433
@mkdir rel/couchdb/nouveau
434434
@cd nouveau && ./gradlew installDist
435435
@cp -R nouveau/build/install/nouveau rel/couchdb
@@ -475,7 +475,7 @@ clean:
475475
@rm -f src/couch/priv/couch_js/config.h
476476
@rm -f dev/*.beam dev/devnode.* dev/pbkdf2.pyc log/crash.log
477477
@rm -f src/couch_dist/certs/out
478-
ifeq ($(with_nouveau), 1)
478+
ifeq ($(with_nouveau), true)
479479
@cd nouveau && ./gradlew clean
480480
endif
481481

@@ -546,7 +546,7 @@ derived:
546546
.PHONY: nouveau
547547
# Build nouveau
548548
nouveau:
549-
ifeq ($(with_nouveau), 1)
549+
ifeq ($(with_nouveau), true)
550550
@cd nouveau && ./gradlew spotlessApply
551551
@cd nouveau && ./gradlew build -x test
552552
endif
@@ -556,15 +556,15 @@ nouveau-test: nouveau-test-gradle nouveau-test-elixir
556556

557557
.PHONY: nouveau-test-gradle
558558
nouveau-test-gradle: couch nouveau
559-
ifeq ($(with_nouveau), 1)
559+
ifeq ($(with_nouveau), true)
560560
@cd nouveau && ./gradlew test
561561
endif
562562

563563
.PHONY: nouveau-test-elixir
564564
nouveau-test-elixir: export MIX_ENV=integration
565565
nouveau-test-elixir: elixir-init devclean
566566
nouveau-test-elixir: couch nouveau
567-
ifeq ($(with_nouveau), 1)
567+
ifeq ($(with_nouveau), true)
568568
@dev/run "$(TEST_OPTS)" -n 1 -q -a adm:pass --with-nouveau \
569569
--locald-config test/config/test-config.ini \
570570
--no-eval 'mix test --trace --include test/elixir/test/config/nouveau.elixir'

Makefile.win

+6-6
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ python-black-update: .venv/bin/black
206206

207207
-include install.mk
208208

209-
ifeq ($(with_nouveau), 0)
209+
ifeq ($(with_nouveau), false)
210210
exclude_nouveau=--exclude nouveau
211211
endif
212212

@@ -389,7 +389,7 @@ else
389389
endif
390390
endif
391391

392-
ifeq ($(with_nouveau), 1)
392+
ifeq ($(with_nouveau), true)
393393
-@mkdir rel\couchdb\nouveau
394394
@cd nouveau && .\gradlew installDist
395395
@xcopy nouveau\build\install\nouveau rel\couchdb /E /I
@@ -435,7 +435,7 @@ clean:
435435
-@rmdir /s/q src\mango\.venv >NUL 2>&1 || true
436436
-@del /f/q src\couch\priv\couch_js\config.h >NUL 2>&1 || true
437437
-@del /f/q dev\boot_node.beam dev\pbkdf2.pyc log\crash.log >NUL 2>&1 || true
438-
ifeq ($(with_nouveau), 1)
438+
ifeq ($(with_nouveau), true)
439439
@cd nouveau && .\gradlew clean
440440
endif
441441

@@ -512,7 +512,7 @@ derived:
512512
.PHONY: nouveau
513513
# target: nouveau - Build nouveau
514514
nouveau:
515-
ifeq ($(with_nouveau), 1)
515+
ifeq ($(with_nouveau), true)
516516
@cd nouveau && .\gradlew build -x test
517517
endif
518518

@@ -522,15 +522,15 @@ nouveau-test: nouveau-test-gradle nouveau-test-elixir
522522

523523
.PHONY: nouveau-test-gradle
524524
nouveau-test-gradle: couch nouveau
525-
ifeq ($(with_nouveau), 1)
525+
ifeq ($(with_nouveau), true)
526526
@cd nouveau && .\gradlew test
527527
endif
528528

529529
.PHONY: nouveau-test-elixir
530530
nouveau-test-elixir: export MIX_ENV=integration
531531
nouveau-test-elixir: elixir-init devclean
532532
nouveau-test-elixir: couch nouveau
533-
ifeq ($(with_nouveau), 1)
533+
ifeq ($(with_nouveau), true)
534534
@dev\run "$(TEST_OPTS)" -n 1 -q -a adm:pass --with-nouveau \
535535
--locald-config test/elixir/test/config/test-config.ini \
536536
--no-eval 'mix test --trace --include test/elixir/test/config/nouveau.elixir'

configure

+8-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ERLFMT_VERSION="v1.3.0"
2828
WITH_PROPER="true"
2929
WITH_FAUXTON=1
3030
WITH_DOCS=1
31-
WITH_NOUVEAU=0
31+
WITH_NOUVEAU="false"
3232
WITH_CLOUSEAU=0
3333
ERLANG_MD5="false"
3434
SKIP_DEPS=0
@@ -105,7 +105,7 @@ parse_opts() {
105105
;;
106106

107107
--enable-nouveau)
108-
WITH_NOUVEAU=1
108+
WITH_NOUVEAU="true"
109109
shift
110110
continue
111111
;;
@@ -137,7 +137,7 @@ parse_opts() {
137137
--dev-with-nouveau)
138138
WITH_DOCS=0
139139
WITH_FAUXTON=0
140-
WITH_NOUVEAU=1
140+
WITH_NOUVEAU="true"
141141
shift
142142
continue
143143
;;
@@ -341,6 +341,11 @@ cat > rel/couchdb.config << EOF
341341
{prefix, "."}.
342342
{data_dir, "./data"}.
343343
{view_index_dir, "./data"}.
344+
{nouveau_enable, "$WITH_NOUVEAU"}.
345+
{nouveau_index_dir, "./data/nouveau"}.
346+
{nouveau_url, "http://127.0.0.1:5987"}.
347+
{nouveau_port, 5987}.
348+
{nouveau_admin_port, 5988}.
344349
{state_dir, "./data"}.
345350
{log_file, "$LOG_FILE"}.
346351
{fauxton_root, "./share/www"}.

configure.ps1

+7-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ $InstallDir="$LibDir\couchdb"
140140
$LogFile="$LogDir\couch.log"
141141
$BuildFauxton = [int](-not $DisableFauxton)
142142
$BuildDocs = [int](-not $DisableDocs)
143-
$BuildNouveau = $(If ($EnableNouveau) {1} else {0})
143+
$WithNouveau = ($EnableNouveau).ToString().ToLower()
144144
$WithClouseau = $(If ($EnableClouseau) {1} else {0})
145145
$Hostname = [System.Net.Dns]::GetHostEntry([string]"localhost").HostName
146146
$WithProper = (-not $DisableProper).ToString().ToLower()
@@ -166,6 +166,11 @@ $CouchDBConfig = @"
166166
{prefix, "."}.
167167
{data_dir, "./data"}.
168168
{view_index_dir, "./data"}.
169+
{nouveau_enable, "$WithNouveau"}.
170+
{nouveau_index_dir, "./data/nouveau"}.
171+
{nouveau_url, "http://127.0.0.1:5987"}.
172+
{nouveau_port, 5987}.
173+
{nouveau_admin_port, 5988}.
169174
{state_dir, "./data"}.
170175
{log_file, ""}.
171176
{fauxton_root, "./share/www"}.
@@ -212,7 +217,7 @@ man_dir = $ManDir
212217
213218
with_fauxton = $BuildFauxton
214219
with_docs = $BuildDocs
215-
with_nouveau = $BuildNouveau
220+
with_nouveau = $WithNouveau
216221
with_clouseau = $WithClouseau
217222
218223
user = $CouchDBUser

dev/run

+25-2
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,14 @@ def setup_configs(ctx):
362362
"backend_port": backend_port,
363363
"prometheus_port": prometheus_port,
364364
"uuid": "fake_uuid_for_dev",
365-
"with_nouveau": str(ctx["with_nouveau"]).lower(),
365+
"nouveau_enable": str(ctx["with_nouveau"]).lower(),
366+
"nouveau_url": "http://127.0.0.1:5987",
366367
"_default": "",
367368
}
368369
write_config(ctx, node, env)
369370
write_locald_configs(ctx, node, env)
370371
generate_haproxy_config(ctx)
372+
generate_nouveau_config(ctx)
371373

372374

373375
def write_locald_configs(ctx, node, env):
@@ -410,6 +412,26 @@ def generate_haproxy_config(ctx):
410412
handle.write("\n")
411413

412414

415+
def generate_nouveau_config(ctx):
416+
src = os.path.join(ctx["rootdir"], "rel", "nouveau.yaml")
417+
tgt = os.path.join(ctx["devdir"], "lib", "nouveau.yaml")
418+
419+
config = {
420+
"nouveau_index_dir": os.path.join(ctx["devdir"], "lib", "nouveau"),
421+
"nouveau_port": 5987,
422+
"nouveau_admin_port": 5988,
423+
}
424+
425+
with open(src) as handle:
426+
content = handle.read()
427+
428+
for key in config:
429+
content = re.sub("{{%s}}" % key, str(config[key]), content)
430+
431+
with open(tgt, "w") as handle:
432+
handle.write(content)
433+
434+
413435
def apply_config_overrides(ctx, content):
414436
for kv_str in ctx["config_overrides"]:
415437
key, val = kv_str.split("=")
@@ -512,11 +534,12 @@ def boot_haproxy(ctx):
512534
def boot_nouveau(ctx):
513535
if not ctx["with_nouveau"]:
514536
return
537+
config = os.path.join(ctx["devdir"], "lib", "nouveau.yaml")
515538
cmd = [
516539
"./gradlew",
517540
"run",
518541
"--args",
519-
"server src/test/resources/nouveau.yaml",
542+
"server {}".format(config),
520543
]
521544
logfname = os.path.join(ctx["devdir"], "logs", "nouveau.log")
522545
log = open(logfname, "w")

nouveau/src/main/java/org/apache/couchdb/nouveau/core/IndexManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private IndexDefinition loadIndexDefinition(final String name) throws IOExceptio
265265
}
266266

267267
private Path indexRootPath(final String name) {
268-
final Path result = rootDir.resolve(name).normalize();
268+
final Path result = rootDir.resolve(name);
269269
if (result.startsWith(rootDir)) {
270270
return result;
271271
}

nouveau/src/test/resources/nouveau.yaml rel/nouveau.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
maxIndexesOpen: 100
1+
maxIndexesOpen: 3000
22
commitIntervalSeconds: 30
33
idleSeconds: 60
4-
rootDir: target/indexes
4+
rootDir: {{nouveau_index_dir}}
55

66
logging:
77
level: INFO
@@ -10,12 +10,12 @@ server:
1010
applicationConnectors:
1111
- type: http
1212
bindHost: 127.0.0.1
13-
port: 5987
13+
port: {{nouveau_port}}
1414
useDateHeader: false
1515
adminConnectors:
1616
- type: http
1717
bindHost: 127.0.0.1
18-
port: 5988
18+
port: {{nouveau_admin_port}}
1919
useDateHeader: false
2020
gzip:
2121
includedMethods:

rel/overlay/etc/default.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,8 @@ port = {{prometheus_port}}
911911
;use_cluster_n_as_expected_n = false
912912

913913
[nouveau]
914-
enable = {{with_nouveau}}
914+
enable = {{nouveau_enable}}
915+
url = {{nouveau_url}}
915916

916917
[disk_monitor]
917918
;enable = false

rel/reltool.config

+2-1
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,6 @@
150150
{template, "overlay/etc/default.ini", "etc/default.ini"},
151151
{template, "overlay/etc/vm.args", "etc/vm.args"},
152152
{template, "files/couchdb.in", "bin/couchdb"},
153-
{template, "files/couchdb.cmd.in", "bin/couchdb.cmd"}
153+
{template, "files/couchdb.cmd.in", "bin/couchdb.cmd"},
154+
{template, "nouveau.yaml", "etc/nouveau.yaml"}
154155
]}.

0 commit comments

Comments
 (0)