Skip to content

Commit 79a3786

Browse files
authored
fix(common): only warn on dropping non-empty builder (risingwavelabs#8494)
Signed-off-by: Bugen Zhao <[email protected]>
1 parent e1ae04e commit 79a3786

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/common/src/util/chunk_coalesce.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,18 @@ impl DataChunkBuilder {
229229
}
230230
}
231231

232+
impl Drop for DataChunkBuilder {
233+
fn drop(&mut self) {
234+
// Possible to fail when async task gets cancelled.
235+
if self.buffered_count != 0 {
236+
tracing::warn!(
237+
remaining = self.buffered_count,
238+
"dropping non-empty data chunk builder"
239+
);
240+
}
241+
}
242+
}
243+
232244
/// The iterator that yields data chunks during appending a data chunk to a [`DataChunkBuilder`].
233245
pub struct AppendDataChunk<'a> {
234246
builder: &'a mut DataChunkBuilder,
@@ -249,6 +261,7 @@ impl FusedIterator for AppendDataChunk<'_> {}
249261

250262
impl Drop for AppendDataChunk<'_> {
251263
fn drop(&mut self) {
264+
// Possible to fail when async task gets cancelled.
252265
if self.remaining.is_some() {
253266
tracing::warn!("dropping `AppendDataChunk` without exhausting it");
254267
}

src/stream/src/common/builder.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@ pub struct StreamChunkBuilder {
4545

4646
impl Drop for StreamChunkBuilder {
4747
fn drop(&mut self) {
48-
// Possible to fail in some corner cases but should not in unit tests
49-
debug_assert_eq!(self.size, 0, "dropping non-empty stream chunk builder");
48+
// Possible to fail when async task gets cancelled.
49+
if self.size != 0 {
50+
tracing::warn!(
51+
remaining = self.size,
52+
"dropping non-empty stream chunk builder"
53+
);
54+
}
5055
}
5156
}
5257

0 commit comments

Comments
 (0)