[ 
https://issues.apache.org/jira/browse/HDDS-7907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17686159#comment-17686159
 ] 

Tsz-wo Sze commented on HDDS-7907:
----------------------------------

[~weichiu], Java OutputStream subclasses usually are not thread safe for 
performance reason. Since the write order becomes indeterminate when writing 
with multiple threads, most applications won't write with multiple threads. If 
an application wants to use multiple threads, they can synchronize the 
OutputStream itself as mentioned in the javadoc of DataOutputStream below.  If 
we synchronize in our code, the applications, which don't want it, cannot 
un-synchronize it.
 - 
[https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/io/DataOutputStream.html]
{quote}A DataOutputStream is not safe for use by multiple concurrent threads. 
If a DataOutputStream is to be used by more than one thread then access to the 
data output stream should be controlled by appropriate synchronization.
{quote}

However, we may have some bugs in our code. We should fix the bugs but not try 
to make it thread safe.

> [hsync] BlockOutputStream is not thread safe
> --------------------------------------------
>
>                 Key: HDDS-7907
>                 URL: https://issues.apache.org/jira/browse/HDDS-7907
>             Project: Apache Ozone
>          Issue Type: Sub-task
>            Reporter: Wei-Chiu Chuang
>            Priority: Major
>
> Tested the hsync implementation with ycsb + HBase workloads, and discovered 
> that hsync is not thread safe. In fact, most of the BlockOutputStream APIs 
> looks not thread safe and need to fix.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to