Fix flaky pipe auto split IT#17756
Merged
Merged
Conversation
luoluoyuyu
approved these changes
May 27, 2026
Member
luoluoyuyu
left a comment
There was a problem hiding this comment.
Review 总结
IT 修复思路正确:history pipe 在 snapshot 传完后可能被 auto-drop,原先用固定 size==2 + 顺序断言过于脆弱。assertAutoSplitResult 改为只要求存在 _realtime、不存在未拆分原名、且列表中仅有 _history/_realtime 子 pipe,更贴近真实行为。
建议合入(见行内 1 条 nit)。
| // The history pipe may have already been auto-dropped after snapshot transfer completes. | ||
| Assert.assertTrue( | ||
| showPipeResult.stream().anyMatch(i -> Objects.equals(i.id, pipeName + "_realtime"))); | ||
| Assert.assertFalse(showPipeResult.stream().anyMatch(i -> Objects.equals(i.id, pipeName))); |
Member
There was a problem hiding this comment.
nit: Assert.assertFalse(showPipeResult.stream().anyMatch(...)) 可简写为 Assert.assertTrue(showPipeResult.stream().noneMatch(i -> Objects.equals(i.id, pipeName))),语义相同。
另:若未来存在第三个与 pipeName 前缀相关但非 _history/_realtime 的 pipe(例如手动创建的 a2b_custom),allMatch 仍会通过。若需更严,可改为:
final long related = showPipeResult.stream().filter(i -> i.getId().startsWith(pipeName)).count();
Assert.assertEquals(2, related); // or 1 if history already dropped当前实现已足够修 flake,非阻塞。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
IoTDBPipeAutoSplitIT assumes that auto split always leaves both history and realtime pipes visible immediately after creation. In practice, the history snapshot pipe can finish and be auto-dropped very quickly when there is no historical data, so SHOW PIPE may only return the realtime pipe and the test fails with expected 2 but was 1.
Modifications
Tests