Skip to content

Commit 6b804f1

Browse files
committed
Make ScyllaDB replication factor configurable
1 parent c0bae58 commit 6b804f1

File tree

26 files changed

+91
-25
lines changed

26 files changed

+91
-25
lines changed

CLI.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
165165
* `--wasm-runtime <WASM_RUNTIME>` — The WebAssembly runtime to use
166166
* `--tokio-threads <TOKIO_THREADS>` — The number of Tokio worker threads to use
167167
* `--tokio-blocking-threads <TOKIO_BLOCKING_THREADS>` — The number of Tokio blocking threads to use
168+
* `--storage-replication-factor <STORAGE_REPLICATION_FACTOR>` — The replication factor for the keyspace
169+
170+
Default value: `1`
168171

169172

170173

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ COPY --from=binaries \
116116
COPY --chmod=755 \
117117
docker/server-entrypoint.sh \
118118
docker/server-init.sh \
119+
docker/proxy-entrypoint.sh \
119120
docker/proxy-init.sh \
120121
docker/compose-server-entrypoint.sh \
121122
docker/compose-proxy-entrypoint.sh \

docker/compose-proxy-entrypoint.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/bin/sh
22

3+
storage=$1
4+
storage_replication_factor=$2
5+
36
exec ./linera-proxy \
4-
--storage scylladb:tcp:scylla:9042 \
7+
--storage $storage \
58
--genesis /config/genesis.json \
9+
--storage-replication-factor $storage_replication_factor \
610
/config/server.json
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/sh
22

33
storage=$1
4+
storage_replication_factor=$2
45

56
exec ./linera-server run \
67
--storage $storage \
78
--server /config/server.json \
89
--shard 0 \
9-
--genesis /config/genesis.json
10+
--genesis /config/genesis.json \
11+
--storage-replication-factor $storage_replication_factor

docker/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717
container_name: proxy
1818
ports:
1919
- "19100:19100"
20-
command: [ "./compose-proxy-entrypoint.sh" ]
20+
command: [ "./compose-proxy-entrypoint.sh", "scylladb:tcp:scylla:9042", "1" ]
2121
volumes:
2222
- .:/config
2323
labels:
@@ -42,7 +42,7 @@ services:
4242
shard-init:
4343
image: "${LINERA_IMAGE:-linera}"
4444
container_name: shard-init
45-
command: [ "./compose-server-init.sh", "scylladb:tcp:scylla:9042" ]
45+
command: [ "./compose-server-init.sh", "scylladb:tcp:scylla:9042", "1" ]
4646
volumes:
4747
- .:/config
4848
depends_on:

docker/proxy-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
storage=$1
4+
storage_replication_factor=$2
5+
6+
exec ./linera-proxy \
7+
--storage $storage \
8+
--genesis /config/genesis.json \
9+
--storage-replication-factor $storage_replication_factor \
10+
/config/server.json

docker/server-entrypoint.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#!/bin/sh
22

3+
storage=$1
4+
storage_replication_factor=$2
5+
36
# Extract the ordinal number from the pod hostname
47
ORDINAL="${HOSTNAME##*-}"
5-
storage=$1
68

79
exec ./linera-server run \
810
--storage $storage \
911
--server /config/server.json \
1012
--shard $ORDINAL \
11-
--genesis /config/genesis.json
13+
--genesis /config/genesis.json \
14+
--storage-replication-factor $storage_replication_factor

docker/server-init.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/sh
22

33
storage=$1
4+
storage_replication_factor=$2
45

56
while true; do
67
./linera storage check-existence --storage $storage
@@ -13,7 +14,8 @@ while true; do
1314
echo "Database does not exist, attempting to initialize..."
1415
if ./linera-server initialize \
1516
--storage $storage \
16-
--genesis /config/genesis.json; then
17+
--genesis /config/genesis.json \
18+
--storage-replication-factor $storage_replication_factor; then
1719
echo "Initialization successful."
1820
exit 0
1921
else

kubernetes/linera-validator/helmfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ releases:
6666
- scylla-manager/scylla-manager
6767
- scylla-operator/scylla-operator
6868
values:
69-
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA" | default "scylla.values.yaml" }}
69+
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA" | default "scylla.values.yaml.gotmpl" }}
7070
- name: scylla-manager
7171
version: v1.13.0
7272
namespace: scylla-manager

kubernetes/linera-validator/scylla.values.yaml renamed to kubernetes/linera-validator/scylla.values.yaml.gotmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sysctls:
44
datacenter: validator
55
racks:
66
- name: rack
7-
members: 1
7+
members: {{ env "LINERA_HELMFILE_SET_SCYLLA_REPLICATION_FACTOR" | default 1 }}
88
scyllaConfig: "scylla-config"
99
storage:
1010
capacity: 2Gi

0 commit comments

Comments
 (0)