private static void deleteRange ( RocksDB db , List < ColumnFamilyHandle > columnFamilyHandles , byte [ ] beginKeyBytes , byte [ ] endKeyBytes ) throws RocksDBException { for ( ColumnFamilyHandle columnFamilyHandle : columnFamilyHandles ) { try ( RocksIteratorWrapper iteratorWrapper = RocksDBOperationUtils . getRocksIterator ( db , columnFamilyHandle ) ; RocksDBWriteBatchWrapper writeBatchWrapper = new RocksDBWriteBatchWrapper ( db ) ) { iteratorWrapper . seek ( beginKeyBytes ) ; while ( iteratorWrapper . isValid ( ) ) { final byte [ ] currentKey = iteratorWrapper . key ( ) ; if ( beforeThePrefixBytes ( currentKey , endKeyBytes ) ) { writeBatchWrapper . remove ( columnFamilyHandle , currentKey ) ; } else { break ; } iteratorWrapper . next ( ) ; } } } }
Delete the record falls into [ beginKeyBytes endKeyBytes ) of the db .