flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] StefanRRichter commented on a change in pull request #6875: [FLINK-9808] [state backends] Migrate state when necessary in state backends
Date Fri, 19 Oct 2018 15:41:07 GMT
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_r226684033
 
 

 ##########
 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:
   This method is called in a loop. You should avoid creating streams and other temporary
objects on each invocation. Instead, let the calling loop pass them in and reuse the same
instances for the whole process. If we had a `StateValueTransformer` instance, they could
also hold them as members.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message