@@ -204,60 +204,6 @@ impl IndexStoreTables {
204
204
)
205
205
}
206
206
207
- /// Lists all Column Families present in the on-disk database
208
- fn list_cfs ( & self ) -> Vec < String > {
209
- let path = self . meta . db . path_for_pruning ( ) ;
210
- typed_store:: rocks:: list_tables ( path. to_path_buf ( ) ) . unwrap ( )
211
- }
212
-
213
- /// Lists all Column Families that are known about in-code as defined in `IndexStoreTables`
214
- fn known_cfs ( ) -> Vec < String > {
215
- IndexStoreTables :: describe_tables ( ) . into_keys ( ) . collect ( )
216
- }
217
-
218
- /// Lists all Column Families that are present on-disk but not known by this version of code as
219
- /// defined in `IndexStoreTables`
220
- fn unknown_cfs ( & self ) -> Vec < String > {
221
- let known_cfs = Self :: known_cfs ( ) ;
222
- self . list_cfs ( )
223
- . into_iter ( )
224
- . filter ( |cf| !known_cfs. contains ( cf) )
225
- . collect ( )
226
- }
227
-
228
- fn drop_cf ( & mut self , cf : & str ) -> Result < ( ) , TypedStoreError > {
229
- self . meta
230
- . db
231
- . drop_cf ( cf)
232
- . map_err ( typed_store:: rocks:: errors:: typed_store_err_from_rocks_err)
233
- }
234
-
235
- fn create_cf ( & mut self , cf : & str ) -> Result < ( ) , TypedStoreError > {
236
- self . meta
237
- . db
238
- . create_cf ( cf, & typed_store:: rocks:: default_db_options ( ) . options )
239
- . map_err ( typed_store:: rocks:: errors:: typed_store_err_from_rocks_err)
240
- }
241
-
242
- fn reset_cf ( & mut self , cf : & str ) -> Result < ( ) , TypedStoreError > {
243
- self . drop_cf ( cf) ?;
244
- self . create_cf ( cf)
245
- }
246
-
247
- fn reset_db ( & mut self ) -> Result < ( ) , TypedStoreError > {
248
- // Drop unknown cfs
249
- for cf in self . unknown_cfs ( ) {
250
- self . drop_cf ( & cf) ?;
251
- }
252
-
253
- // Reset known cfs
254
- for cf in Self :: known_cfs ( ) {
255
- self . reset_cf ( & cf) ?;
256
- }
257
-
258
- Ok ( ( ) )
259
- }
260
-
261
207
fn needs_to_do_initialization ( & self , checkpoint_store : & CheckpointStore ) -> bool {
262
208
( match self . meta . get ( & ( ) ) {
263
209
Ok ( Some ( metadata) ) => metadata. version != CURRENT_DB_VERSION ,
@@ -706,12 +652,17 @@ impl RpcIndexStore {
706
652
let path = Self :: db_path ( dir) ;
707
653
708
654
let tables = {
709
- let mut tables = IndexStoreTables :: open ( & path) ;
655
+ let tables = IndexStoreTables :: open ( & path) ;
710
656
711
657
// If the index tables are uninitialized or on an older version then we need to
712
658
// populate them
713
659
if tables. needs_to_do_initialization ( checkpoint_store) {
714
- tables. reset_db ( ) . expect ( "unable to reset rpc-index db" ) ;
660
+ let mut tables = {
661
+ drop ( tables) ;
662
+ typed_store:: rocks:: safe_drop_db ( path. clone ( ) )
663
+ . expect ( "unable to destroy old rpc-index db" ) ;
664
+ IndexStoreTables :: open ( path)
665
+ } ;
715
666
716
667
tables
717
668
. init (
0 commit comments