Aitozi commented on a change in pull request #14893:
URL: https://github.com/apache/flink/pull/14893#discussion_r788652085
##########
File path:
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBIncrementalCheckpointUtils.java
##########
@@ -122,30 +118,17 @@ private static void deleteRange(
RocksDB db,
List<ColumnFamilyHandle> columnFamilyHandles,
byte[] beginKeyBytes,
- byte[] endKeyBytes,
- @Nonnegative long writeBatchSize)
+ byte[] endKeyBytes)
throws RocksDBException {
for (ColumnFamilyHandle columnFamilyHandle : columnFamilyHandles) {
- try (ReadOptions readOptions = new ReadOptions();
- RocksIteratorWrapper iteratorWrapper =
- RocksDBOperationUtils.getRocksIterator(
- db, columnFamilyHandle, readOptions);
- RocksDBWriteBatchWrapper writeBatchWrapper =
- new RocksDBWriteBatchWrapper(db, writeBatchSize)) {
-
- iteratorWrapper.seek(beginKeyBytes);
-
- while (iteratorWrapper.isValid()) {
- final byte[] currentKey = iteratorWrapper.key();
- if (beforeThePrefixBytes(currentKey, endKeyBytes)) {
- writeBatchWrapper.remove(columnFamilyHandle,
currentKey);
- } else {
- break;
- }
- iteratorWrapper.next();
- }
- }
+ // Using RocksDB's deleteRange will take advantage of delete
+ // tombstones, which mark the range as deleted. There are
situations
+ // where tombstones can cause degraded performance, such as when
+ // too many tombstones are created.
+ //
+ //
https://github.com/facebook/rocksdb/blob/bcd32560dd5898956b9d24553c2bb3c1b1d2319f/include/rocksdb/db.h#L357-L371
Review comment:
After looking into the [deleteRange
implementations](https://rocksdb.org/blog/2018/11/21/delete-range.html) , I
think the read path will not be affected too much, Because the deleted key
range will not be query in current subtask.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]