You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2020/04/28 15:52:07 UTC

[impala] 02/02: IMPALA-9701: fix data race in BTS

This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit f4258b5f971f90390b93aa7a2e76dd0b8a1d8825
Author: Tim Armstrong <ta...@cloudera.com>
AuthorDate: Mon Apr 27 16:52:40 2020 -0700

    IMPALA-9701: fix data race in BTS
    
    A benign data race in BufferedTupleStream was flagged
    by TSAN.
    
    Testing:
    Reran the unit test under TSAN, it succeeded.
    
    Change-Id: Ie2c4464adbc51bb8b0214ba0adbfa71217b87c86
    Reviewed-on: http://gerrit.cloudera.org:8080/15826
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/runtime/buffered-tuple-stream.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/be/src/runtime/buffered-tuple-stream.cc b/be/src/runtime/buffered-tuple-stream.cc
index a35a89e..1ca8a92 100644
--- a/be/src/runtime/buffered-tuple-stream.cc
+++ b/be/src/runtime/buffered-tuple-stream.cc
@@ -1079,7 +1079,9 @@ void BufferedTupleStream::ReadIterator::Init(bool attach_on_read) {
   valid_ = true;
   rows_returned_ = 0;
   DCHECK(!attach_on_read_) << "attach_on_read can only be set once";
-  attach_on_read_ = attach_on_read;
+  // Only set 'attach_on_read' if needed. Otherwise, if this is the builtin
+  // iterator, a benign data race may be flagged by TSAN (see IMPALA-9701).
+  if (attach_on_read) attach_on_read_ = attach_on_read;
 }
 
 void BufferedTupleStream::ReadIterator::SetReadPage(list<Page>::iterator read_page) {