@@ -2,7 +2,7 @@ use crate::common::{
22 Engine , PREFIX_SIZE , Pre , PreBytes , RESERVED_ID_CNT , RawKey , RawValue ,
33 vsdb_get_base_dir, vsdb_set_base_dir,
44} ;
5- use fjall:: { Config , Keyspace , Partition , PartitionCreateOptions } ;
5+ use fjall:: { CompressionType , Config , Keyspace , Partition , PartitionCreateOptions } ;
66use parking_lot:: Mutex ;
77use ruc:: * ;
88use std:: {
@@ -74,22 +74,39 @@ impl Engine for FjallEngine {
7474
7575 let mut parts = Vec :: with_capacity ( DATA_SET_NUM ) ;
7676 for j in 0 ..DATA_SET_NUM {
77- let p = ks
78- . open_partition (
79- & format ! ( "part_{}" , j) ,
80- PartitionCreateOptions :: default ( ) ,
81- )
82- . c ( d ! ( ) ) ?;
77+ let mut opts = PartitionCreateOptions :: default ( ) ;
78+
79+ #[ cfg( feature = "compress" ) ]
80+ {
81+ opts = opts. compression ( CompressionType :: Lz4 ) ;
82+ }
83+
84+ #[ cfg( not( feature = "compress" ) ) ]
85+ {
86+ opts = opts. compression ( CompressionType :: None ) ;
87+ }
88+
89+ let p = ks. open_partition ( & format ! ( "part_{}" , j) , opts) . c ( d ! ( ) ) ?;
8390 parts. push ( p) ;
8491 }
8592 shards. push ( ks) ;
8693 shards_parts. push ( parts) ;
8794 }
8895
8996 // Use a dedicated partition in shard 0 for meta
90- let meta = shards[ 0 ]
91- . open_partition ( "meta" , PartitionCreateOptions :: default ( ) )
92- . c ( d ! ( ) ) ?;
97+ let mut meta_opts = PartitionCreateOptions :: default ( ) ;
98+
99+ #[ cfg( feature = "compress" ) ]
100+ {
101+ meta_opts = meta_opts. compression ( CompressionType :: Lz4 ) ;
102+ }
103+
104+ #[ cfg( not( feature = "compress" ) ) ]
105+ {
106+ meta_opts = meta_opts. compression ( CompressionType :: None ) ;
107+ }
108+
109+ let meta = shards[ 0 ] . open_partition ( "meta" , meta_opts) . c ( d ! ( ) ) ?;
93110
94111 let ( prefix_allocator, initial_value) = PreAllocator :: init ( ) ;
95112
0 commit comments