You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/12/19 01:56:02 UTC
[GitHub] [flink] masteryhx commented on a diff in pull request #21468: [FLINK-30345][state/changelog] Avoid using sync DataOutputViewStreamWrapper to serialize records to changelog
masteryhx commented on code in PR #21468:
URL: https://github.com/apache/flink/pull/21468#discussion_r1051733639
##########
flink-state-backends/flink-statebackend-changelog/src/main/java/org/apache/flink/state/changelog/KvStateChangeLoggerImpl.java:
##########
@@ -78,21 +79,25 @@ public void namespacesMerged(Ns target, Collection<Ns> sources) throws IOExcepti
}
@Override
- protected void serializeValue(Value value, DataOutputViewStreamWrapper out) throws IOException {
+ protected void serializeValue(Value value, DataOutputView out) throws IOException {
valueSerializer.serialize(value, out);
}
@Override
- protected void serializeScope(Ns ns, DataOutputViewStreamWrapper out) throws IOException {
+ protected void serializeScope(Ns ns, DataOutputView out) throws IOException {
keySerializer.serialize(keyContext.getCurrentKey(), out);
namespaceSerializer.serialize(ns, out);
}
- protected void writeDefaultValueAndTtl(DataOutputViewStreamWrapper out) throws IOException {
+ protected void writeDefaultValueAndTtl(DataOutputView out) throws IOException {
out.writeBoolean(ttlConfig.isEnabled());
if (ttlConfig.isEnabled()) {
- try (ObjectOutputStream o = new ObjectOutputStream(out)) {
- o.writeObject(ttlConfig);
+ try (ByteArrayOutputStreamWithPos outputStreamWithPos =
+ new ByteArrayOutputStreamWithPos();
Review Comment:
Actually, I used `ByteArrayOutputStreamWithPos` because it's Un-synchronized but `ByteArrayOutputStream` is synchronized which is unnecessary.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org