Skip to content

Conversation

@losipiuk
Copy link
Member

@losipiuk losipiuk commented Oct 22, 2025

More info at https://trino.io/development/process#release-note -->

Release notes

(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

Summary by Sourcery

Adjust test timing in TestNodeStateManager to reduce flakiness by increasing the grace period and extending await timeouts

Tests:

  • Increase GRACE_PERIOD_MILLIS from 200ms to 1000ms in TestNodeStateManager
  • Extend await timeouts and slack for shutdown transitions to accommodate the longer grace period
  • Update comments in tests to reflect waiting for four grace periods and use longer time units for clarity

@losipiuk losipiuk requested a review from brybacki October 22, 2025 14:51
@cla-bot cla-bot bot added the cla-signed label Oct 22, 2025
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 22, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Extended test grace periods and adjusted await timeouts in TestNodeStateManager to reduce flakiness by increasing the grace period constant and updating related await durations and comments.

File-Level Changes

Change Details Files
Increased test grace period constant
  • Updated GRACE_PERIOD_MILLIS from 200 to 1000
core/trino-main/src/test/java/io/trino/server/TestNodeStateManager.java
Adjusted wait in testTransitionToShuttingDown
  • Changed comment to require 4 grace periods instead of 2
  • Increased await timeout from 4 * GRACE_PERIOD_MILLIS + 100 to 4 * GRACE_PERIOD_MILLIS + 1000
core/trino-main/src/test/java/io/trino/server/TestNodeStateManager.java
Updated await in testCannotReactivateShuttingDown
  • Modified comment to wait for 4 grace periods instead of 2
  • Retained await timeout at 4 * GRACE_PERIOD_MILLIS
core/trino-main/src/test/java/io/trino/server/TestNodeStateManager.java
Refined immediate shutdown wait in testImmediateTransitionToShuttingDownWhenDrained
  • Removed minimal wait comment
  • Changed atMost timeout from 100 milliseconds to 1 second
core/trino-main/src/test/java/io/trino/server/TestNodeStateManager.java

Possibly linked issues

  • #FlakyTest-TestNodeStateManager: PR increased GRACE_PERIOD_MILLIS and await durations in TestNodeStateManager to fix the reported flakiness.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

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 increases timeout values in the TestNodeStateManager test class to reduce test flakiness. The changes adjust the grace period from 200ms to 1000ms and proportionally increase the maximum wait times in test assertions to ensure more reliable test execution.

Key Changes:

  • Increased GRACE_PERIOD_MILLIS constant from 200 to 1000
  • Updated timeout values in test methods to account for the longer grace period

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


// here wait for at least 2 grace periods, and add some slack to reduce test flakyness
await().atMost(4 * GRACE_PERIOD_MILLIS + 100, MILLISECONDS).until(() -> shutdownAction.isShuttingDown());
// here wait for at least 4 grace periods, and add some slack to reduce test flakyness
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'flakyness' to 'flakiness'.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

good idea

assertThat(nodeStateManager.getServerState()).isEqualTo(NodeState.SHUTTING_DOWN);

// here wait for at least 2 grace periods, and add some slack to reduce test flakyness
// here wait for at least 4 grace periods, and add some slack to reduce test flakyness
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'flakyness' to 'flakiness'.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

keen eye

Copy link
Member

Choose a reason for hiding this comment

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

good idea

@findepi
Copy link
Member

findepi commented Oct 22, 2025

Error:  Errors: 
Error:    TestNodeStateManager.testDrain:97 » ConditionTimeout Assertion condition defined as a Lambda expression in io.trino.server.TestNodeStateManager 
expected: DRAINED
 but was: DRAINING within 1 seconds.
Error:    TestNodeStateManager.testWaitActiveTasksToFinishDuringDraining:216 » ConditionTimeout Assertion condition defined as a Lambda expression in io.trino.server.TestNodeStateManager 
expected: DRAINED
 but was: DRAINING within 1 seconds.
Error:    TestNodeStateManager.testWaitActiveTasksToFinishDuringShutdown:173 » ConditionTimeout Condition with Lambda expression in io.trino.server.TestNodeStateManager was not fulfilled within 1 seconds.
[INFO] 
Error:  Tests run: 8880, Failures: 0, Errors: 3, Skipped: 5

@losipiuk losipiuk force-pushed the lukaszos/wait-longer-to-reduce-flakiness--e65bb6 branch from fff7cb0 to 5bef456 Compare October 23, 2025 08:32
Copy link
Member

@findepi findepi left a comment

Choose a reason for hiding this comment

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

you have red anyway, so why don't you fix typoes too?


// here wait for at least 2 grace periods, and add some slack to reduce test flakyness
await().atMost(4 * GRACE_PERIOD_MILLIS + 100, MILLISECONDS).until(() -> shutdownAction.isShuttingDown());
// here wait for at least 4 grace periods, and add some slack to reduce test flakyness
Copy link
Member

Choose a reason for hiding this comment

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

good idea

assertThat(nodeStateManager.getServerState()).isEqualTo(NodeState.SHUTTING_DOWN);

// here wait for at least 2 grace periods, and add some slack to reduce test flakyness
// here wait for at least 4 grace periods, and add some slack to reduce test flakyness
Copy link
Member

Choose a reason for hiding this comment

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

good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants