8000 Implement transactions by nadvornik · Pull Request #3814 · cobbler/cobbler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement transactions #3814

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 3 commits into from
May 13, 2025
Merged

Implement transactions #3814

merged 3 commits into from
May 13, 2025

Conversation

nadvornik
Copy link
Contributor
@nadvornik nadvornik commented Aug 30, 2024

Linked Items

Fixes #3810

Description

This is an implementation of transactions, as discussed in the related issue.

It fixes the original problem - the speed of creating and deleting of 500 profiles is now under 30s, from the original ~1hour.

Behaviour changes

Old: No change.

New: Added optional XMLRPC calls begin_transaction(token) and commit_transaction(token)
The modify/save/remove/copy/new operations performed between these calls are stored in memory and are visible
only for the client identified by the token. commit_transaction saves everything and regenerates the menus in one call.

Unresolved issues / TODO

  • It is not possible to create parent-child relation without saving the parent first.

  • Conflicts when the same items are modified in parallel in multiple transactions.

  • Tested only with profiles, so far.

Category

This is related to a:

  • Bugfix
  • Feature
  • Packaging
  • Docs
  • Code Quality
  • Refactoring
  • Miscellaneous

Tests

  • Unit-Tests were created (WIP)
  • System-Tests were created
  • Code is already covered by Unit-Tests
  • Code is already covered by System-Tests
  • No tests required

@SchoolGuy
Copy link
Member

@nadvornik I would just throw an error in case you attempt to edit the same item in parallel and ignore that request for the transaction in question. If you are using Cobbler as a "library" and do multithreaded operations you should synchronize these operations by yourself IMHO.

The solution for environments like this would be to wait until the conflicting transaction is finished and re-evaluate if the desired action still makes sense to be performed.

@nadvornik nadvornik force-pushed the transactions branch 3 times, most recently from e9e7cd8 to 986b531 Compare September 11, 2024 11:49
Copy link
codacy-production bot commented Sep 11, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.23% (target: -1.00%) 96.51% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (a24802f) 15936 10646 66.80%
Head commit (414a9ae) 16076 (+140) 10776 (+130) 67.03% (+0.23%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3814) 172 166 96.51%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@nadvornik nadvornik changed the title POC: Implement transactions Implement transactions Sep 13, 2024
@nadvornik nadvornik marked this pull request as ready for review September 13, 2024 13:49
@nadvornik
Copy link
Contributor Author

I have updated the tests to cover a scenario where a profile is reparented and the old parent is deleted in one transaction.
I have fixed related bugs.

@SchoolGuy
Copy link
Member

@nadvornik Currently the CI reports the following issues:

  • No Newsfragment which mentions the issue
  • Black is not happy
  • pyright is not happy

@SchoolGuy
Copy link
Member

@nadvornik I have taken the liberty to rebase the PR and fix black and the changelog. Please fix pyright!

@SchoolGuy
Copy link
Member

@nadvornik Could you get this finished before the end of the week please? I would like to backport it to 3.3.7 and include it with the release that will be made on Sunday. We have a community member asking for this to be available.

@SchoolGuy SchoolGuy mentioned this pull request Nov 17, 2024
12 tasks
@nadvornik nadvornik force-pushed the transactions branch 5 times, most recently from 04792a1 to d7eaf8a Compare April 17, 2025 19:44
@nadvornik
Copy link
Contributor Author

@SchoolGuy Linter is fixed. Is there anything else that needs to be improved?

Copy link
Member
@SchoolGuy SchoolGuy left a comment

Choose a reason for hiding this comment

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

Thank you for this lengthy process. I will run the CI now and if all checks out we can merge the PR!

@github-actions github-actions bot added the CI CI/CD related label Apr 27, 2025
@SchoolGuy
Copy link
Member

@nadvornik pyright is reporting a lot of low-hanging fruits for the code you wrote. While I would accept some errors (which we would need to silence with # type: ignore. Let's try to fix the easy ones.

@nadvornik nadvornik requested a review from SchoolGuy April 28, 2025 08:22
@github-actions github-actions bot removed the CI CI/CD related label Apr 29, 2025
@nadvornik nadvornik force-pushed the transactions branch 2 times, most recently from d62f134 to 5930744 Compare April 30, 2025 14:43
@nadvornik
Copy link
Contributor Author

@SchoolGuy pyright should be fixed now

@SchoolGuy
Copy link
Member

@nadvornik Now you broke Black and isort, and you lost the changes I force pushed that fix the GH actions workflows.

@github-actions github-actions bot added the CI CI/CD related label May 5, 2025
@nadvornik
Copy link
Contributor Author

@SchoolGuy please try again

@SchoolGuy
Copy link
Member
SchoolGuy commented May 5, 2025

@nadvornik You still need to restore the changes I force pushed that enable the CI to run again...

Edit: The changes only affect the workflow configuration for GitHub.

Copy link
Member
@SchoolGuy SchoolGuy left a comment

Choose a reason for hiding this comment

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

The current CI failures that are left are not related to this PR. Let's get it merged.

@github-project-automation github-project-automation bot moved this from Pull Requests to In Progress in Cobbler Server May 13, 2025
@SchoolGuy SchoolGuy merged commit 0e73bf3 into cobbler:main May 13, 2025
34 of 54 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Cobbler Server May 13, 2025
@SchoolGuy SchoolGuy added this to the v3.4.0 milestone May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API CI CI/CD related tests
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Handling of 500 profiles is slow
2 participants
0