private void swapROStores ( List < String > swappedStoreNames , boolean useSwappedStoreNames ) { try { for ( StoreDefinition storeDef : metadataStore . getStoreDefList ( ) ) { // Only pick up the RO stores if ( storeDef . getType ( ) . compareTo ( ReadOnlyStorageConfiguration . TYPE_NAME ) == 0 ) { if ( useSwappedStoreNames && ! swappedStoreNames . contains ( storeDef . getName ( ) ) ) { continue ; } ReadOnlyStorageEngine engine = ( ReadOnlyStorageEngine ) storeRepository . getStorageEngine ( storeDef . getName ( ) ) ; if ( engine == null ) { throw new VoldemortException ( "Could not find storage engine for " + storeDef . getName ( ) + " to swap " ) ; } logger . info ( "Swapping RO store " + storeDef . getName ( ) ) ; // Time to swap this store - Could have used admin client, // but why incur the overhead? engine . swapFiles ( engine . getCurrentDirPath ( ) ) ; // Add to list of stores already swapped if ( ! useSwappedStoreNames ) swappedStoreNames . add ( storeDef . getName ( ) ) ; } } } catch ( Exception e ) { logger . error ( "Error while swapping RO store" ) ; throw new VoldemortException ( e ) ; } }
Goes through all the RO Stores in the plan and swaps it