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

ASF GitHub Bot commented on DRILL-8139:
---------------------------------------

vvysotskyi commented on a change in pull request #2463:
URL: https://github.com/apache/drill/pull/2463#discussion_r809142708



##########
File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/compression/DrillCompressionCodecFactory.java
##########
@@ -80,38 +99,56 @@ public DrillCompressionCodecFactory(Configuration config, 
ByteBufferAllocator al
   }
 
   @Override
-  public BytesInputCompressor getCompressor(CompressionCodecName codecName) {
+  public synchronized BytesInputCompressor getCompressor(CompressionCodecName 
codecName) {
     if (AIRCOMPRESSOR_CODECS.contains(codecName)) {
       return airCompressors.computeIfAbsent(
           codecName,
           c -> new AirliftBytesInputCompressor(codecName, allocator)
       );
+    } else if (codecName != CompressionCodecName.SNAPPY) {
+      // Work around PARQUET-2126: construct a new codec factory every time to
+      // avoid a concurrrency bug c.f. DRILL-8139. Remove once PARQUET-2126 is
+      // fixed.  Snappy is immune because of the thread safety in the Xerial 
lib.
+      CompressionCodecFactory ccf = 
CodecFactory.createDirectCodecFactory(config, allocator, pageSize);
+      // hold onto a reference for later release()
+      singleUseFactories.add(ccf);
+      return ccf.getCompressor(codecName);
     } else {
       return parqCodecFactory.getCompressor(codecName);
     }
   }
 
   @Override
-  public BytesInputDecompressor getDecompressor(CompressionCodecName 
codecName) {
+  public synchronized BytesInputDecompressor 
getDecompressor(CompressionCodecName codecName) {
     if (AIRCOMPRESSOR_CODECS.contains(codecName)) {
       return airCompressors.computeIfAbsent(
           codecName,
           c -> new AirliftBytesInputCompressor(codecName, allocator)
       );
+    } else if (codecName != CompressionCodecName.SNAPPY) {

Review comment:
       `AIRCOMPRESSOR_CODECS` contains `CompressionCodecName.SNAPPY`, so this 
condition will be always `true`.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


> Data corruption and occasional segfaults querying Parquet/gzip under the 
> async column reader and sync page reader
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-8139
>                 URL: https://issues.apache.org/jira/browse/DRILL-8139
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Storage - Parquet
>    Affects Versions: 1.19.0
>            Reporter: James Turton
>            Assignee: James Turton
>            Priority: Blocker
>         Attachments: recording.mp4
>
>
> Update: PARQUET-2126 has been opened to describe the underlying thread safety 
> problem in parquet-mr.  The rdblue/brotli-codec is also affected.
> In previously released versions of Drill, back to at least 1.17, this bug 
> only appears under the combination of the async column reader and the _sync_ 
> page reader, as per the reproduction script below.  In master, the bug 
> appears under the async column reader and both the sync and async page 
> readers.
> {code:java}
> set `store.parquet.compression` = 'gzip';
> drop table if exists dfs.tmp.m;
> create table dfs.tmp.m as select * from cp.`tpch/supplier.parquet`;
> set `store.parquet.reader.pagereader.async` = false;
> set `store.parquet.reader.columnreader.async` = true;
> select * from dfs.tmp.m order by s_suppkey; – repeat this last query and 
> watch the returned data. Eventually you will also failed queries or JVM 
> crashes
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to