Skip to content

Commit 7bb5480

Browse files
authored
feat(stream): always log hash join large amplification records (#16840)
1 parent de86f94 commit 7bb5480

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

src/stream/src/executor/hash_join.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
// limitations under the License.
1414

1515
use std::collections::{BTreeMap, HashSet};
16+
use std::sync::LazyLock;
1617
use std::time::Duration;
1718

1819
use itertools::Itertools;
1920
use multimap::MultiMap;
2021
use risingwave_common::array::Op;
2122
use risingwave_common::hash::{HashKey, NullBitmap};
23+
use risingwave_common::log::LogSuppresser;
2224
use risingwave_common::types::{DefaultOrd, ToOwnedDatum};
2325
use risingwave_common::util::epoch::EpochPair;
2426
use risingwave_common::util::iter_util::ZipEqDebug;
@@ -829,18 +831,23 @@ impl<K: HashKey, S: StateStore, const T: JoinTypePrimitive> HashJoinExecutor<K,
829831

830832
if let Some(rows) = &matched_rows {
831833
join_matched_join_keys.observe(rows.len() as _);
832-
if rows.len() > 10000 {
833-
let join_key_data_types = side_update.ht.join_key_data_types();
834-
let key = key.deserialize(join_key_data_types)?;
835-
tracing::debug!(target: "hash_join_amplification",
836-
matched_rows_len = rows.len(),
837-
update_table_id = side_update.ht.table_id(),
838-
match_table_id = side_match.ht.table_id(),
839-
join_key = ?key,
840-
actor_id = ctx.id,
841-
fragment_id = ctx.fragment_id,
842-
"large rows matched for join key"
843-
);
834+
if rows.len() >= 10000 {
835+
static LOG_SUPPERSSER: LazyLock<LogSuppresser> =
836+
LazyLock::new(LogSuppresser::default);
837+
if let Ok(suppressed_count) = LOG_SUPPERSSER.check() {
838+
let join_key_data_types = side_update.ht.join_key_data_types();
839+
let key = key.deserialize(join_key_data_types)?;
840+
tracing::warn!(target: "hash_join_amplification",
841+
suppressed_count,
842+
matched_rows_len = rows.len(),
843+
update_table_id = side_update.ht.table_id(),
844+
match_table_id = side_match.ht.table_id(),
845+
join_key = ?key,
846+
actor_id = ctx.id,
847+
fragment_id = ctx.fragment_id,
848+
"large rows matched for join key"
849+
);
850+
}
844851
}
845852
} else {
846853
join_matched_join_keys.observe(0.0)

0 commit comments

Comments
 (0)