klion26 closed pull request #7421: [FLINK-11167][runtime] Optimize 
RocksDBListState#Put by removing the clear before put operation when input is 
not empty
URL: https://github.com/apache/flink/pull/7421
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBListState.java
 
b/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBListState.java
index 13f5559405e..8ac6649771e 100644
--- 
a/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBListState.java
+++ 
b/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBListState.java
@@ -210,8 +210,6 @@ public void update(List<V> valueToStore) {
        public void updateInternal(List<V> values) {
                Preconditions.checkNotNull(values, "List of values to add 
cannot be null.");
 
-               clear();
-
                if (!values.isEmpty()) {
                        try {
                                backend.db.put(
@@ -222,6 +220,8 @@ public void updateInternal(List<V> values) {
                        } catch (IOException | RocksDBException e) {
                                throw new FlinkRuntimeException("Error while 
updating data to RocksDB", e);
                        }
+               } else {
+                       clear();
                }
        }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to