Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
* `--wasm-runtime <WASM_RUNTIME>` — The WebAssembly runtime to use
* `--tokio-threads <TOKIO_THREADS>` — The number of Tokio worker threads to use
* `--tokio-blocking-threads <TOKIO_BLOCKING_THREADS>` — The number of Tokio blocking threads to use
* `--storage-replication-factor <STORAGE_REPLICATION_FACTOR>` — The replication factor for the keyspace

Default value: `1`



Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ COPY --from=binaries \
COPY --chmod=755 \
docker/server-entrypoint.sh \
docker/server-init.sh \
docker/proxy-entrypoint.sh \
docker/proxy-init.sh \
docker/compose-server-entrypoint.sh \
docker/compose-proxy-entrypoint.sh \
Expand Down
3 changes: 3 additions & 0 deletions docker/compose-proxy-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/sh

storage_replication_factor=$1

exec ./linera-proxy \
--storage scylladb:tcp:scylla:9042 \
--genesis /config/genesis.json \
--storage-replication-factor $storage_replication_factor \
/config/server.json
4 changes: 3 additions & 1 deletion docker/compose-server-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/sh

storage=$1
storage_replication_factor=$2

exec ./linera-server run \
--storage $storage \
--server /config/server.json \
--shard 0 \
--genesis /config/genesis.json
--genesis /config/genesis.json \
--storage-replication-factor $storage_replication_factor
6 changes: 3 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
container_name: proxy
ports:
- "19100:19100"
command: [ "./compose-proxy-entrypoint.sh" ]
command: [ "./compose-proxy-entrypoint.sh", "1" ]
volumes:
- .:/config
labels:
Expand All @@ -30,7 +30,7 @@ services:
image: "${LINERA_IMAGE:-linera}"
deploy:
replicas: 4
command: [ "./compose-server-entrypoint.sh", "scylladb:tcp:scylla:9042" ]
command: [ "./compose-server-entrypoint.sh", "scylladb:tcp:scylla:9042", "1" ]
volumes:
- .:/config
labels:
Expand All @@ -42,7 +42,7 @@ services:
shard-init:
image: "${LINERA_IMAGE:-linera}"
container_name: shard-init
command: [ "./compose-server-init.sh", "scylladb:tcp:scylla:9042" ]
command: [ "./compose-server-init.sh", "scylladb:tcp:scylla:9042", "1" ]
volumes:
- .:/config
depends_on:
Expand Down
9 changes: 9 additions & 0 deletions docker/proxy-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

storage_replication_factor=$1

exec ./linera-proxy \
--storage scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042 \
--genesis /config/genesis.json \
--storage-replication-factor $storage_replication_factor \
/config/server.json
7 changes: 5 additions & 2 deletions docker/server-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/bin/sh

storage=$1
storage_replication_factor=$2

# Extract the ordinal number from the pod hostname
ORDINAL="${HOSTNAME##*-}"
storage=$1

exec ./linera-server run \
--storage $storage \
--server /config/server.json \
--shard $ORDINAL \
--genesis /config/genesis.json
--genesis /config/genesis.json \
--storage-replication-factor $storage_replication_factor
4 changes: 3 additions & 1 deletion docker/server-init.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

storage=$1
storage_replication_factor=$2

while true; do
./linera storage check-existence --storage $storage
Expand All @@ -13,7 +14,8 @@ while true; do
echo "Database does not exist, attempting to initialize..."
if ./linera-server initialize \
--storage $storage \
--genesis /config/genesis.json; then
--genesis /config/genesis.json \
--storage-replication-factor $storage_replication_factor; then
echo "Initialization successful."
exit 0
else
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/linera-validator/helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ releases:
- scylla-manager/scylla-manager
- scylla-operator/scylla-operator
values:
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA" | default "scylla.values.yaml" }}
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA" | default "scylla.values.yaml.gotmpl" }}
- name: scylla-manager
version: v1.13.0
namespace: scylla-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sysctls:
datacenter: validator
racks:
- name: rack
members: 1
members: {{ env "LINERA_HELMFILE_SET_STORAGE_REPLICATION_FACTOR" | default 1 }}
scyllaConfig: "scylla-config"
storage:
capacity: 2Gi
Expand Down
10 changes: 1 addition & 9 deletions kubernetes/linera-validator/templates/proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ spec:
name: linera-port
- containerPort: 20100
name: linera-port-int
command:
[
"./linera-proxy",
"--storage",
"scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042",
"--genesis",
"/config/genesis.json",
]
args: ["/config/server.json"]
command: ["./proxy-entrypoint.sh", {{ .Values.storageReplicationFactor | quote }}]
env:
- name: RUST_LOG
value: {{ .Values.logLevel }}
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/linera-validator/templates/shards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
- name: linera-server-initializer
image: {{ .Values.lineraImage }}
imagePullPolicy: {{ .Values.lineraImagePullPolicy }}
command: ["./server-init.sh", {{ .Values.storage | quote }}]
command: ["./server-init.sh", {{ .Values.storage | quote }}, {{ .Values.storageReplicationFactor | quote }}]
env:
- name: RUST_LOG
value: {{ .Values.logLevel }}
Expand All @@ -53,7 +53,7 @@ spec:
- name: linera-server
image: {{ .Values.lineraImage }}
imagePullPolicy: {{ .Values.lineraImagePullPolicy }}
command: ["./server-entrypoint.sh", {{ .Values.storage | quote }}]
command: ["./server-entrypoint.sh", {{ .Values.storage | quote }}, {{ .Values.storageReplicationFactor | quote }}]
env:
- name: RUST_LOG
value: {{ .Values.logLevel }}
Expand Down
1 change: 1 addition & 0 deletions kubernetes/linera-validator/values-local.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rocksdbStorageSize: {{ env "LINERA_HELMFILE_SET_ROCKSDB_STORAGE_SIZE" | default
storage: {{ env "LINERA_HELMFILE_SET_STORAGE" | default "scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042" }}
dualStore: {{ env "LINERA_HELMFILE_SET_DUAL_STORE" | default "false" }}
usingLocalSsd: {{ env "LINERA_HELMFILE_SET_USING_LOCAL_SSD" | default "false" }}
storageReplicationFactor: {{ env "LINERA_HELMFILE_SET_STORAGE_REPLICATION_FACTOR" | default 1 }}

# Loki
loki-stack:
Expand Down
1 change: 1 addition & 0 deletions linera-indexer/lib/src/rocks_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl RocksDbRunner {
max_concurrent_queries: config.client.max_concurrent_queries,
max_stream_queries: config.client.max_stream_queries,
storage_cache_config,
replication_factor: 1,
};
let path_buf = config.client.storage.as_path().to_path_buf();
let path_with_guard = PathWithGuard::new(path_buf);
Expand Down
5 changes: 5 additions & 0 deletions linera-indexer/lib/src/scylla_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ pub struct ScyllaDbConfig {
/// The maximal number of entries in the storage cache.
#[arg(long, default_value = "1000")]
pub max_cache_entries: usize,

/// The replication factor for the keyspace
#[arg(long, default_value = "1")]
pub replication_factor: u32,
}

pub type ScyllaDbRunner = Runner<ScyllaDbStore, ScyllaDbConfig>;
Expand All @@ -57,6 +61,7 @@ impl ScyllaDbRunner {
max_concurrent_queries: config.client.max_concurrent_queries,
max_stream_queries: config.client.max_stream_queries,
storage_cache_config,
replication_factor: config.client.replication_factor,
};
let namespace = config.client.table.clone();
let store_config = ScyllaDbStoreConfig::new(config.client.uri.clone(), common_config);
Expand Down
1 change: 1 addition & 0 deletions linera-service/src/linera-exporter/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ impl ExporterOptions {
max_concurrent_queries: self.max_concurrent_queries,
max_stream_queries: self.max_stream_queries,
storage_cache_config,
replication_factor: 1,
};

let mut runtime_builder = match self.tokio_threads {
Expand Down
5 changes: 5 additions & 0 deletions linera-service/src/linera/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,10 @@ struct ClientOptions {
/// Subcommand.
#[command(subcommand)]
command: ClientCommand,

/// The replication factor for the keyspace
#[arg(long, default_value = "1")]
storage_replication_factor: u32,
}

impl ClientOptions {
Expand All @@ -1456,6 +1460,7 @@ impl ClientOptions {
max_concurrent_queries: self.max_concurrent_queries,
max_stream_queries: self.max_stream_queries,
storage_cache_config,
replication_factor: self.storage_replication_factor,
}
}

Expand Down
5 changes: 5 additions & 0 deletions linera-service/src/proxy/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ pub struct ProxyOptions {
/// Path to the file describing the initial user chains (aka genesis state)
#[arg(long = "genesis")]
genesis_config_path: PathBuf,

/// The replication factor for the keyspace
#[arg(long, default_value = "1")]
storage_replication_factor: u32,
}

/// A Linera Proxy, either gRPC or over 'Simple Transport', meaning TCP or UDP.
Expand Down Expand Up @@ -409,6 +413,7 @@ impl ProxyOptions {
max_concurrent_queries: self.max_concurrent_queries,
max_stream_queries: self.max_stream_queries,
storage_cache_config,
replication_factor: self.storage_replication_factor,
};
let genesis_config: GenesisConfig = util::read_json(&self.genesis_config_path)?;
let store_config = self.storage_config.add_common_config(common_config).await?;
Expand Down
12 changes: 12 additions & 0 deletions linera-service/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ enum ServerCommand {
/// The maximal number of entries in the storage cache.
#[arg(long, default_value = "1000")]
max_cache_entries: usize,

/// The replication factor for the storage.
#[arg(long, default_value = "1")]
storage_replication_factor: u32,
},

/// Act as a trusted third-party and generate all server configurations
Expand Down Expand Up @@ -436,6 +440,10 @@ enum ServerCommand {
/// The maximal number of entries in the storage cache.
#[arg(long, default_value = "1000")]
max_cache_entries: usize,

/// The replication factor for the storage.
#[arg(long, default_value = "1")]
storage_replication_factor: u32,
},

/// Replaces the configurations of the shards by following the given template.
Expand Down Expand Up @@ -538,6 +546,7 @@ async fn run(options: ServerOptions) {
max_cache_size,
max_entry_size,
max_cache_entries,
storage_replication_factor,
} => {
linera_version::VERSION_INFO.log();

Expand All @@ -564,6 +573,7 @@ async fn run(options: ServerOptions) {
max_concurrent_queries,
max_stream_queries,
storage_cache_config,
replication_factor: storage_replication_factor,
};
let store_config = storage_config
.add_common_config(common_config)
Expand Down Expand Up @@ -626,6 +636,7 @@ async fn run(options: ServerOptions) {
max_cache_size,
max_entry_size,
max_cache_entries,
storage_replication_factor,
} => {
let genesis_config: GenesisConfig =
util::read_json(&genesis_config_path).expect("Failed to read initial chain config");
Expand All @@ -638,6 +649,7 @@ async fn run(options: ServerOptions) {
max_concurrent_queries,
max_stream_queries,
storage_cache_config,
replication_factor: storage_replication_factor,
};
let store_config = storage_config
.add_common_config(common_config)
Expand Down
1 change: 1 addition & 0 deletions linera-storage-service/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ pub fn service_config_from_endpoint(
let common_config = CommonStoreInternalConfig {
max_concurrent_queries: None,
max_stream_queries: 100,
replication_factor: 1,
};
let endpoint = endpoint.to_string();
Ok(ServiceStoreInternalConfig {
Expand Down
1 change: 1 addition & 0 deletions linera-views/src/backends/dynamo_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@ impl TestKeyValueStore for JournalingKeyValueStore<DynamoDbStoreInternal> {
let common_config = CommonStoreInternalConfig {
max_concurrent_queries: Some(TEST_DYNAMO_DB_MAX_CONCURRENT_QUERIES),
max_stream_queries: TEST_DYNAMO_DB_MAX_STREAM_QUERIES,
replication_factor: 1,
};
Ok(DynamoDbStoreInternalConfig {
use_dynamodb_local: true,
Expand Down
1 change: 1 addition & 0 deletions linera-views/src/backends/indexed_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl IndexedDbStoreConfig {
max_concurrent_queries: None,
max_stream_queries,
storage_cache_config: DEFAULT_STORAGE_CACHE_CONFIG,
replication_factor: 1,
};
Self { common_config }
}
Expand Down
7 changes: 6 additions & 1 deletion linera-views/src/backends/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ pub struct MemoryStoreConfig {
}

impl MemoryStoreConfig {
/// Creates a `MemoryStoreConfig`. `max_concurrent_queries` and `cache_size` are not used.
/// Creates a `MemoryStoreConfig`. `max_concurrent_queries`, `cache_size` and `replication_factor` are not used.
pub fn new(max_stream_queries: usize) -> Self {
let common_config = CommonStoreInternalConfig {
max_concurrent_queries: None,
max_stream_queries,
replication_factor: 1,
};
Self { common_config }
}
Expand Down Expand Up @@ -281,6 +282,7 @@ impl MemoryStore {
let common_config = CommonStoreInternalConfig {
max_concurrent_queries: None,
max_stream_queries,
replication_factor: 1,
};
let config = MemoryStoreConfig { common_config };
let kill_on_drop = false;
Expand All @@ -296,6 +298,7 @@ impl MemoryStore {
let common_config = CommonStoreInternalConfig {
max_concurrent_queries: None,
max_stream_queries,
replication_factor: 1,
};
let config = MemoryStoreConfig { common_config };
let kill_on_drop = true;
Expand Down Expand Up @@ -323,6 +326,7 @@ impl AdminKeyValueStore for MemoryStore {
let common_config = CommonStoreInternalConfig {
max_concurrent_queries: None,
max_stream_queries,
replication_factor: 1,
};
let config = MemoryStoreConfig { common_config };
let mut memory_stores = MEMORY_STORES
Expand Down Expand Up @@ -384,6 +388,7 @@ impl TestKeyValueStore for MemoryStore {
let common_config = CommonStoreInternalConfig {
max_concurrent_queries: None,
max_stream_queries,
replication_factor: 1,
};
Ok(MemoryStoreConfig { common_config })
}
Expand Down
1 change: 1 addition & 0 deletions linera-views/src/backends/rocks_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ impl TestKeyValueStore for RocksDbStoreInternal {
let common_config = CommonStoreInternalConfig {
max_concurrent_queries: None,
max_stream_queries: TEST_ROCKS_DB_MAX_STREAM_QUERIES,
replication_factor: 1,
};
let spawn_mode = RocksDbSpawnMode::get_spawn_mode_from_runtime();
Ok(RocksDbStoreInternalConfig {
Expand Down
Loading
Loading