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

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


The following commit(s) were added to refs/heads/master by this push:
     new 97fb0d5eae ARROW-16964: [C++] TSAN error in asof-join-node tests 
(#13639)
97fb0d5eae is described below

commit 97fb0d5eae1fdfe55a0cf1c0e433dbe235a629da
Author: Weston Pace <[email protected]>
AuthorDate: Tue Jul 19 02:10:57 2022 -1000

    ARROW-16964: [C++] TSAN error in asof-join-node tests (#13639)
    
    Converted `total_batches_` and `batches_processed_` to atomic variables 
since they are accessed simultaneously by the input received and process 
threads.  This was leading to a TSAN failure as described in the JIRA.
    
    Authored-by: Weston Pace <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 cpp/src/arrow/compute/exec/asof_join_node.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpp/src/arrow/compute/exec/asof_join_node.cc 
b/cpp/src/arrow/compute/exec/asof_join_node.cc
index e392c33e19..3da612aa03 100644
--- a/cpp/src/arrow/compute/exec/asof_join_node.cc
+++ b/cpp/src/arrow/compute/exec/asof_join_node.cc
@@ -288,9 +288,9 @@ class InputState {
   // Schema associated with the input
   std::shared_ptr<Schema> schema_;
   // Total number of batches (only int because InputFinished uses int)
-  int total_batches_ = -1;
+  std::atomic<int> total_batches_{-1};
   // Number of batches processed so far (only int because InputFinished uses 
int)
-  int batches_processed_ = 0;
+  std::atomic<int> batches_processed_{0};
   // Index of the time col
   col_index_t time_col_index_;
   // Index of the key col

Reply via email to