StefanRRichter commented on a change in pull request #6875: [FLINK-9808] [state 
backends] Migrate state when necessary in state backends
URL: https://github.com/apache/flink/pull/6875#discussion_r226683613
 
 

 ##########
 File path: 
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/AbstractRocksDBState.java
 ##########
 @@ -154,6 +159,29 @@ public void setCurrentNamespace(N namespace) {
                return backend.db.get(columnFamily, 
tmpKeySerializationView.getCopyOfBuffer());
        }
 
+       public byte[] migrateSerializedValue(
+                       byte[] serializedOldValue,
+                       TypeSerializer<V> priorSerializer,
+                       TypeSerializer<V> newSerializer) throws 
StateMigrationException {
+
+               try {
+                       V value = priorSerializer.deserialize(new 
DataInputViewStreamWrapper(new ByteArrayInputStream(serializedOldValue)));
+
+                       ByteArrayOutputStream baos = new 
ByteArrayOutputStream();
+                       DataOutputViewStreamWrapper out = new 
DataOutputViewStreamWrapper(baos);
 
 Review comment:
   Better use `DataInputDeserializer` / `DataOutputSerializer` instead of 
wrapped byte-array streams. They are quiet a bit faster.

----------------------------------------------------------------
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