Skip to content

Commit d91699f

Browse files
authored
Fix CI after #3870 (#3872)
## Motivation #3870 was incomplete and CI didn't catch it ## Proposal Bring back the logic to diversify local rocksdb directories when testing ## Test Plan CI
1 parent 9a629aa commit d91699f

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

.github/workflows/scylladb.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- 'toolchains/**'
1212
- 'linera-views/**'
1313
- 'linera-storage/**'
14+
- 'linera-service/src/storage.rs'
1415
- 'docker_scylla/**'
1516
workflow_dispatch:
1617

linera-service/src/cli_wrappers/local_net.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,10 +683,15 @@ impl LocalNet {
683683
}
684684

685685
async fn run_server(&mut self, validator: usize, shard: usize) -> Result<Child> {
686-
let storage = self
686+
let mut storage = self
687687
.initialized_validator_storages
688688
.get(&validator)
689-
.expect("initialized storage");
689+
.expect("initialized storage")
690+
.clone();
691+
692+
// For the storage backends with a local directory, make sure that we don't reuse
693+
// the same directory for all the shards.
694+
storage.storage_config.maybe_append_shard_path(shard)?;
690695

691696
let mut command = self.command_for_binary("linera-server").await?;
692697
if let Ok(var) = env::var(SERVER_ENV) {

linera-service/src/storage.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,24 @@ pub enum StorageConfig {
123123
},
124124
}
125125

126+
impl StorageConfig {
127+
pub fn maybe_append_shard_path(&mut self, _shard: usize) -> std::io::Result<()> {
128+
match self {
129+
#[cfg(all(feature = "rocksdb", feature = "scylladb"))]
130+
StorageConfig::DualRocksDbScyllaDb {
131+
path_with_guard,
132+
spawn_mode: _,
133+
uri: _,
134+
} => {
135+
let shard_str = format!("shard_{}", _shard);
136+
path_with_guard.path_buf.push(shard_str);
137+
std::fs::create_dir_all(&path_with_guard.path_buf)
138+
}
139+
_ => Ok(()),
140+
}
141+
}
142+
}
143+
126144
/// The description of a storage implementation.
127145
#[derive(Clone, Debug)]
128146
#[cfg_attr(any(test), derive(Eq, PartialEq))]

0 commit comments

Comments
 (0)