8000 feat(bin): flush output to stdout before db conn shutdown by BugenZhao · Pull Request #262 · risinglightdb/sqllogictest-rs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(bin): flush output to stdout before db conn shutdown #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 7, 2025

Conversation

BugenZhao
Copy link
Collaborator
@BugenZhao BugenZhao commented Apr 24, 2025

...so that upon cancellation, we get more prompt results from ongoing tests.

@BugenZhao BugenZhao requested review from xxchan and Copilot April 24, 2025 05:55
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that all output is flushed to stdout before shutting down the database connection by refactoring how output is handled. Key changes include:

  • Introducing a new Output trait with implementations for Stdout and Vec.
  • Refactoring both serial and parallel test runners to use the new Output trait and removing buffer flushing from the caller.
  • Adjusting the signature and usage of connect_and_run_test_file accordingly.
Comments suppressed due to low confidence (1)

sqllogictest-bin/src/main.rs:669

  • [nitpick] Consider renaming the trait 'Output' to a more descriptive name like 'FlushableOutput' to better convey its purpose.
trait Output: Write {

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@BugenZhao BugenZhao force-pushed the bz/flush-output-before-shutdown branch from 74068a0 to e117b19 Compare April 29, 2025 08:31
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@BugenZhao BugenZhao requested a review from stdrc April 30, 2025 05:38
Copy link
Member
@skyzh skyzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

/// to avoid interleaving output from different parallelism.
impl Output for Vec<u8> {
fn finish(&mut self) -> io::Result<()> {
let mut stdout = stdout();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not guarantee the exclusiveness of the handler?

The std doc says,

Each handle returned is a reference to a shared global buffer whose access is synchronized via a mutex. If you need more explicit control over locking, see the Stdout::lock method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. However, it appears that write_all is not interruptable and we only call it once, so we still won't observe interleaving output. Nonetheless, lock seems always better.

BugenZhao added 3 commits May 7, 2025 14:25
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
8000
@BugenZhao BugenZhao enabled auto-merge (squash) May 7, 2025 06:53
@BugenZhao BugenZhao merged commit 86559e5 into main May 7, 2025
4 checks passed
@BugenZhao BugenZhao deleted the bz/flush-output-before-shutdown branch May 7, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0