From 16a8c5ceee8c39b88d4a64ff682edb5d7c66b600 Mon Sep 17 00:00:00 2001 From: SeaRise Date: Tue, 7 Feb 2023 16:44:26 +0800 Subject: [PATCH] update --- dbms/src/Interpreters/Join.cpp | 1 + dbms/src/Interpreters/Join.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dbms/src/Interpreters/Join.cpp b/dbms/src/Interpreters/Join.cpp index 5e0e72972b5..c9149463c74 100644 --- a/dbms/src/Interpreters/Join.cpp +++ b/dbms/src/Interpreters/Join.cpp @@ -2135,6 +2135,7 @@ bool Join::needReturnNonJoinedData() const void Join::joinTotals(Block & block) const { + std::shared_lock lock(rwlock); Block totals_without_keys = totals; if (totals_without_keys) diff --git a/dbms/src/Interpreters/Join.h b/dbms/src/Interpreters/Join.h index 7cdab351e0a..3b28a84f956 100644 --- a/dbms/src/Interpreters/Join.h +++ b/dbms/src/Interpreters/Join.h @@ -122,8 +122,16 @@ class Join /** Keep "totals" (separate part of dataset, see WITH TOTALS) to use later. */ - void setTotals(const Block & block) { totals = block; } - bool hasTotals() const { return static_cast(totals); }; + void setTotals(const Block & block) + { + std::unique_lock lock(rwlock); + totals = block; + } + bool hasTotals() const + { + std::shared_lock lock(rwlock); + return static_cast(totals); + }; void joinTotals(Block & block) const;