@@ -134,6 +134,8 @@ TEST(Config, GetAndSet) {
134134 {" rocksdb.row_cache_size" , " 100" },
135135 {" rocksdb.rate_limiter_auto_tuned" , " yes" },
136136 {" rocksdb.compression_level" , " 32767" },
137+ {" rocksdb.max_dict_bytes" , " 16384" },
138+ {" rocksdb.zstd_max_train_bytes" , " 262144" },
137139 {" rocksdb.wal_compression" , " no" },
138140 {" histogram-bucket-boundaries" , " 10,100,1000,10000" },
139141
@@ -149,9 +151,12 @@ TEST(Config, GetRenameCommand) {
149151 unlink (path);
150152
151153 std::ofstream output_file (path, std::ios::out);
152- output_file << " rename-command KEYS KEYS_NEW" << " \n " ;
153- output_file << " rename-command GET GET_NEW" << " \n " ;
154- output_file << " rename-command SET SET_NEW" << " \n " ;
154+ output_file << " rename-command KEYS KEYS_NEW"
155+ << " \n " ;
156+ output_file << " rename-command GET GET_NEW"
157+ << " \n " ;
158+ output_file << " rename-command SET SET_NEW"
159+ << " \n " ;
155160 output_file.close ();
156161 redis::CommandTable::Reset ();
157162 Config config;
@@ -171,9 +176,12 @@ TEST(Config, Rewrite) {
171176 unlink (path);
172177
173178 std::ofstream output_file (path, std::ios::out);
174- output_file << " rename-command KEYS KEYS_NEW" << " \n " ;
175- output_file << " rename-command GET GET_NEW" << " \n " ;
176- output_file << " rename-command SET SET_NEW" << " \n " ;
179+ output_file << " rename-command KEYS KEYS_NEW"
180+ << " \n " ;
181+ output_file << " rename-command GET GET_NEW"
182+ << " \n " ;
183+ output_file << " rename-command SET SET_NEW"
184+ << " \n " ;
177185 output_file.close ();
178186
179187 redis::CommandTable::Reset ();
@@ -189,6 +197,32 @@ TEST(Config, Rewrite) {
189197 unlink (path);
190198}
191199
200+ TEST (Config, LoadRocksDBDictionaryCompressionOptions) {
201+ const char *path = " test.conf" ;
202+ unlink (path);
203+
204+ std::ofstream output_file (path, std::ios::out);
205+ output_file << " rocksdb.max_dict_bytes 16384"
206+ << " \n " ;
207+ output_file << " rocksdb.zstd_max_train_bytes 262144"
208+ << " \n " ;
209+ output_file.close ();
210+
211+ Config config;
212+ ASSERT_TRUE (config.Load (CLIOptions (path)).IsOK ());
213+ ASSERT_EQ (config.rocks_db .max_dict_bytes , 16384U );
214+ ASSERT_EQ (config.rocks_db .zstd_max_train_bytes , 262144U );
215+
216+ ASSERT_TRUE (config.Rewrite ({}).IsOK ());
217+
218+ Config rewritten_config;
219+ ASSERT_TRUE (rewritten_config.Load (CLIOptions (path)).IsOK ());
220+ ASSERT_EQ (rewritten_config.rocks_db .max_dict_bytes , 16384U );
221+ ASSERT_EQ (rewritten_config.rocks_db .zstd_max_train_bytes , 262144U );
222+
223+ unlink (path);
224+ }
225+
192226TEST (Config, ParseConfigLine) {
193227 ASSERT_EQ (*ParseConfigLine (" " ), ConfigKV{});
194228 ASSERT_EQ (*ParseConfigLine (" # hello" ), ConfigKV{});
0 commit comments