Page MenuHomeSoftware Heritage

D4826.id.diff
No OneTemporary

D4826.id.diff

diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -99,6 +99,17 @@
congratulations :)
```
+Note: it is possible to set the `JAVA_HOME` environment variable to specify the
+version of the JVM to be used by Cassandra. For example, at the time of writing
+this, Cassandra does not support java 14, so one may want to use for example
+java 11:
+
+```
+(swh) :~/swh-storage$ export JAVA_HOME=/usr/lib/jvm/java-14-openjdk-amd64/bin/java
+(swh) :~/swh-storage$ tox
+[...]
+```
+
## Development
The storage server can be locally started. It requires a configuration file and
diff --git a/swh/storage/tests/test_cassandra.py b/swh/storage/tests/test_cassandra.py
--- a/swh/storage/tests/test_cassandra.py
+++ b/swh/storage/tests/test_cassandra.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2020 The Software Heritage developers
+# Copyright (C) 2018-2021 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
@@ -102,6 +102,14 @@
stdout = stderr = subprocess.DEVNULL
cassandra_bin = os.environ.get("SWH_CASSANDRA_BIN", "/usr/sbin/cassandra")
+ env = {
+ "MAX_HEAP_SIZE": "300M",
+ "HEAP_NEWSIZE": "50M",
+ "JVM_OPTS": "-Xlog:gc=error:file=%s/gc.log" % cassandra_log,
+ }
+ if "JAVA_HOME" in os.environ:
+ env["JAVA_HOME"] = os.environ["JAVA_HOME"]
+
proc = subprocess.Popen(
[
cassandra_bin,
@@ -111,11 +119,7 @@
"-Dcassandra-foreground=yes",
],
start_new_session=True,
- env={
- "MAX_HEAP_SIZE": "300M",
- "HEAP_NEWSIZE": "50M",
- "JVM_OPTS": "-Xlog:gc=error:file=%s/gc.log" % cassandra_log,
- },
+ env=env,
stdout=stdout,
stderr=stderr,
)
diff --git a/tox.ini b/tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -10,6 +10,7 @@
passenv =
SWH_CASSANDRA_BIN
SWH_CASSANDRA_LOG
+ JAVA_HOME
commands =
pytest \
!slow: --hypothesis-profile=fast \

File Metadata

Mime Type
text/plain
Expires
Nov 4 2024, 7:29 PM (19 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3229374

Event Timeline