File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 1111 - ' toolchains/**'
1212 - ' linera-views/**'
1313 - ' linera-storage/**'
14+ - ' linera-service/src/storage.rs'
1415 - ' docker_scylla/**'
1516 workflow_dispatch :
1617
Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff 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 ) ) ]
You can’t perform that action at this time.
0 commit comments