flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zentol <...@git.apache.org>
Subject [GitHub] flink pull request #5645: FLINK-8876 Improve concurrent access handling in s...
Date Wed, 07 Mar 2018 16:04:56 GMT
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5645#discussion_r172893030
  
    --- Diff: flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSerializer.java
---
    @@ -163,8 +224,19 @@ public T copy(T from, T reuse) {
     
     	@Override
     	public void copy(DataInputView source, DataOutputView target) throws IOException {
    -		T value = deserialize(source);
    -		serialize(value, target);
    +		if (CONCURRENT_ACCESS_CHECK) {
    +			enterExclusiveThread();
    +		}
    +
    +		try {
    +			T value = deserialize(source);
    --- End diff --
    
    Have to point out that after `deserialize()` the checks in copy() are ineffective as the
`currentThread` field has already been nulled. In other words, we guard against concurrent
access before deserialize(), and within deserialize()&serialize(), but not between deserialize()&serialize()
or after serialize().
    
    This isn't a _problem_ as all code is actually covered, but we may want to document that.


---

Mime
View raw message