Skip to content
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

ccmlib/node: check both pending and active tasks when waiting for compactions #611

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

cezarmoise
Copy link
Contributor

@cezarmoise cezarmoise commented Sep 17, 2024

Currently, when using wait_for_compactions, only pending tasks are considered. If there are active compaction tasks, the function will return anyway and this causes flakyness in tests, as sometimes the active task finishes before the next operation, but sometimes it doesn't.

  • Rename Node._parse_pending_tasks to Node._parse_tasks
  • Count all tasks, pending and active
  • Allow searching for tasks based on only keyspace
  • Update and refactor test to allow more varied cases

closes: #610
refs: https://github.com/scylladb/scylla-dtest/issues/4702

…pactions

- Rename Node._parse_pending_tasks to Node._parse_tasks
- Count all tasks, pending and active
- Allow searching for tasks based on only keyspace
- Update and refactor test to allow more varied cases
@cezarmoise
Copy link
Contributor Author

How does backporting work in this repo? I see the labels but no backport PRs.

@cezarmoise
Copy link
Contributor Author

cezarmoise commented Sep 17, 2024

@fruch
Copy link
Contributor

fruch commented Sep 17, 2024

How does backporting work in this repo? I see the labels but no backport PRs.

we don't have mergify setup for this one, labels are used.
and maintanters are doing backports manually

@cezarmoise
Copy link
Contributor Author

How does backporting work in this repo? I see the labels but no backport PRs.

we don't have mergify setup for this one, labels are used. and maintanters are doing backports manually

Ok, so I assume this needs to go in 6.0, 6.1 and 2024.2 ?

ccmlib/node.py Outdated Show resolved Hide resolved
ccmlib/node.py Outdated Show resolved Hide resolved
tests/test_internal_functions.py Outdated Show resolved Hide resolved
])
@pytest.mark.parametrize("test_case", test_cases, ids=[tc["id"] for tc in test_cases])
def test_parse_tasks(test_case):
output = test_case["output"]
Copy link

Choose a reason for hiding this comment

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

Use multiple arguments, instead of test_case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed d25fb7a

Copy link

Choose a reason for hiding this comment

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

Why not change the test_cases directly to have pytest.param?

Copy link
Contributor Author

@cezarmoise cezarmoise Sep 18, 2024

Choose a reason for hiding this comment

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

Then test_cases would look like

test_cases = [
    pytest.param(
        textwrap.dedent("""\
            pending tasks: 6
            - system_schema.tables: 1
            - system_schema.columns: 2
            - keyspace1.standard1: 3
            \
        """),
        [
            ("system_schema", "tables", 1),
            ("system_schema", "columns", 2),
            ("system_schema", None, 3),
            ("keyspace1", "standard1", 3),
            ("keyspace1", None, 3),
            (None, None, 6),
            ("keyspace1x", None, 0),
            ("keyspace1x", "table1x", 0),
        ],
        id="only_pending"
    ),
...
]

Which I don't know if it's better.
I like having the more explicit naming of everything, because pytest.param relies of order.

Copy link

@pehala pehala Sep 18, 2024

Choose a reason for hiding this comment

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

That actually looks much better to me, it is exactly the structure the pytest.parametrize should have in my opinion and thus making it easier to understand in my opinion. But I might be in minority here, so I will leave it out to others to decide

Copy link
Contributor

Choose a reason for hiding this comment

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

Both are o.k. from my POV

It's complex regardless of how you might present it.

Just a reference for issue in pytest about trying to introduce kwargs support for pytest.param, which never happened (but external plugging that supply something like it)
pytest-dev/pytest#9216 (comment)

ccmlib/node.py Outdated Show resolved Hide resolved
ccmlib/node.py Show resolved Hide resolved
@pehala
Copy link

pehala commented Sep 18, 2024

Could you please link issues that should be fixed by this?

@cezarmoise
Copy link
Contributor Author

Could you please link issues that should be fixed by this?

The initial issue is https://github.com/scylladb/scylla-dtest/issues/4702. Updated description to mention it.

Copy link
Contributor

@fruch fruch left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport-6.0 Needs backport to 6.0 Backport-6.1 Backport-2024.1 Needs backport to 2024.1 Backport-2024.2 Needs backport to 2024.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Node._parse_pending_tasks and Node.wait_for_compactions to account for tasks in progress
3 participants