GitHub user johnma14 opened a pull request:

    https://github.com/apache/kafka/pull/2906

    Kafka-4994 Fix findbug warnings about OffsetStorageWriter#currentFlushId

    Based on the description of the class OffsetStorageWriter, it is not a 
thread-safe class and should be accessed only from a Task's processing thread. 
Many methods within this class have been explicitly synchronized in their 
function definition. The doFlush() method is a non-blocking function and hasn't 
been synchronized but modifies the variables used within the synchronized 
methods in this class. This could lead to potential inconsistent 
synchronization of some variables within this class.  We can therefore remove 
the synchronized keyword from the method signatures within the 
OffsetStorageWriter class since the WorkerSourceTask class calls the different 
methods (offset, beginFlush,cancelFlush, handleFinishWrite) within a 
synchronized block. There is no need to synchronize calls to these methods more 
than once. 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/johnma14/kafka kafka-4994

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/2906.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2906
    
----
commit 726185526a5197a4537930cfa580503746a5468c
Author: Mariam John <mari...@us.ibm.com>
Date:   2017-04-24T19:45:32Z

    Fix findbug warnings about OffsetStorageWriter
    
    Based on the description of the class OffsetStorageWriter, it is not a 
thread-safe class and should be accessed
    only from a Task's processing thread. Still many methods within this class 
have been explicitly synchronized in
    their function definiton. The doFlush() method is a non-blocking function 
and hasn't been synchronized but modifies
    the variables used within the synchronized methods in this class. This 
could lead to potential inconsistent synchronization
    of many variables within this class.  We can therefore remove the 
synchronized keyword from the method signatures within the OffsetStorageWriter 
class. The WorkerSourceTask class calls the different methods (offset, 
beginFlush,cancelFlush, handleFinishWrite) within a synchronized block. Hence 
their method definitions in OffsetStorageWriter.java does not need to contain 
the 'synchronized' keyword.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to