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

[WIP] framework/db: introduce a new MySQL table based distributed lock #8968

Closed
wants to merge 2 commits into from

Conversation

rohityadavcloud
Copy link
Member

@rohityadavcloud rohityadavcloud commented Apr 24, 2024

This introduces a MySQL innodb table based distributed lock which can be used by one or more management server and its threads. This removes usage of MySQL server provided locking functions (GET_LOCK, RELEASE_LOCK) which are not replicated or not supported currently by any MySQL clustering solutions. This would be the first main step in having CloudStack to work with a MySQL clustering solution such as InnoDB cluster, Percona Xtradb cluster, MariaDB galera cluster. There may be other changes required which can be found in due course if this feature works at scale.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

In a local setup against simulator & mvn, in a single management server no exception were seen. Most tests need to be done such as:

  • simulator based smoketests which is one mvn-run of mgmt server + one mysql db server
  • smoketests (test matrix) which tests largely one mgmt server + one mysql db server
  • multiple (say 3) mgmt servers + one mysql db server
  • multiple (say 3) mgmt servers + mysql db cluster with say 3 nodes

@rohityadavcloud
Copy link
Member Author

rohityadavcloud commented Apr 24, 2024

This is largely WIP and experimental, at this point I'm only looking for automated tests which are easier done via a PR, I'm not looking for any feedback and review - thanks.

@blueorangutan package

@apache apache deleted a comment from blueorangutan Apr 24, 2024
@apache apache deleted a comment from blueorangutan Apr 24, 2024
@apache apache deleted a comment from blueorangutan Apr 24, 2024
@apache apache deleted a comment from blueorangutan Apr 24, 2024
@rohityadavcloud
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9411

@rohityadavcloud
Copy link
Member Author

@blueorangutan test matrix

@blueorangutan
Copy link

@rohityadavcloud a [SL] Trillian-Jenkins matrix job (centos7 mgmt + xenserver71, rocky8 mgmt + vmware67u3, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-9995)

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-9991)

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-9993)

@rohityadavcloud
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9412

@rohityadavcloud
Copy link
Member Author

@blueorangutan test matrix

@blueorangutan
Copy link

@rohityadavcloud a [SL] Trillian-Jenkins matrix job (centos7 mgmt + xenserver71, rocky8 mgmt + vmware67u3, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-10003)

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-10001)

@codecov-commenter
Copy link

codecov-commenter commented Apr 25, 2024

Codecov Report

Attention: Patch coverage is 40.84507% with 42 lines in your changes are missing coverage. Please review.

Project coverage is 14.96%. Comparing base (e409c6d) to head (9830bbe).

Files Patch % Lines
...java/com/cloud/upgrade/DatabaseUpgradeChecker.java 0.00% 22 Missing ⚠️
...rk/db/src/main/java/com/cloud/utils/db/DbUtil.java 62.96% 7 Missing and 3 partials ⚠️
.../src/main/java/com/cloud/utils/net/MacAddress.java 54.54% 6 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19    #8968      +/-   ##
============================================
- Coverage     14.96%   14.96%   -0.01%     
+ Complexity    10995    10989       -6     
============================================
  Files          5373     5373              
  Lines        468989   468920      -69     
  Branches      61009    57594    -3415     
============================================
- Hits          70191    70164      -27     
+ Misses       391019   390993      -26     
+ Partials       7779     7763      -16     
Flag Coverage Δ
uitests 4.31% <ø> (ø)
unittests 15.66% <40.84%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rohityadavcloud
Copy link
Member Author

@blueorangutan test matrix

@rohityadavcloud
Copy link
Member Author

@blueorangutan test alma8 vmware-70u3

@blueorangutan
Copy link

@rohityadavcloud a [SL] Trillian-Jenkins test job (alma8 mgmt + vmware-70u3) has been kicked to run smoke tests

@rohityadavcloud
Copy link
Member Author

@blueorangutan test alma8 kvm-alma8

@blueorangutan
Copy link

@rohityadavcloud a [SL] Trillian-Jenkins test job (alma8 mgmt + kvm-alma8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-10028)

@blueorangutan
Copy link

[SF] Trillian test result (tid-10005)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server r8
Total time taken: 55775 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8968-t10005-vmware-67u3.zip
Smoke tests completed. 129 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_events_resource Error 346.17 test_events_resource.py

@blueorangutan
Copy link

[SF] Trillian test result (tid-10025)
Environment: vmware-70u3 (x2), Advanced Networking with Mgmt server a8
Total time taken: 61906 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8968-t10025-vmware-70u3.zip
Smoke tests completed. 127 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_events_resource Error 345.93 test_events_resource.py
test_01_list_sec_storage_vm Failure 0.21 test_ssvm.py
test_03_ssvm_internals Failure 3.34 test_ssvm.py
test_05_stop_ssvm Failure 934.96 test_ssvm.py
test_06_stop_cpvm Error 988.39 test_ssvm.py
test_08_reboot_cpvm Error 914.21 test_ssvm.py
test_01_redundant_vpc_site2site_vpn Failure 522.63 test_vpc_vpn.py

Cleanup old mac address handling code to use JDK11 lib instead of hacks.
Also really strange to see some basic string parsing code was written by
hand, replaced with Long.parseValue(str, 16) to convert hex string to
long.

Signed-off-by: Rohit Yadav <[email protected]>
This introduces a MySQL innodb table based distributed lock which can
be used by one or more management server and its threads. This removes
usage of MySQL server provided locking functions (GET_LOCK,
RELEASE_LOCK) which are not replicated or supported currently by any
MySQL clustering solutions. This would be the first main step in having
CloudStack to work with a MySQL clustering solution such as InnoDB
cluster, Percona Xtradb cluster, MariaDB galera cluster. There may be
other changes required which can be found in due course if this feature
works at scale.

Signed-off-by: Rohit Yadav <[email protected]>
@rohityadavcloud
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9446

@rohityadavcloud
Copy link
Member Author

@blueorangutan test matrix

@blueorangutan
Copy link

@rohityadavcloud a [SL] Trillian-Jenkins matrix job (centos7 mgmt + xenserver71, rocky8 mgmt + vmware67u3, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-10058)

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-10060)

@rohityadavcloud
Copy link
Member Author

@blueorangutan test matrix

@blueorangutan
Copy link

@rohityadavcloud a [SL] Trillian-Jenkins matrix job (centos7 mgmt + xenserver71, rocky8 mgmt + vmware67u3, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-10061)

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-10063)

@blueorangutan
Copy link

[SF] Trillian test result (tid-10059)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server r8
Total time taken: 55077 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8968-t10059-vmware-67u3.zip
Smoke tests completed. 127 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_events_resource Error 358.17 test_events_resource.py
test_02_balanced_drs_algorithm Failure 144.54 test_cluster_drs.py
test_03_deploy_and_scale_kubernetes_cluster Error 289.72 test_kubernetes_clusters.py

@blueorangutan
Copy link

[SF] Trillian test result (tid-10062)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server r8
Total time taken: 50700 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8968-t10062-vmware-67u3.zip
Smoke tests completed. 127 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_events_resource Error 336.38 test_events_resource.py
test_02_balanced_drs_algorithm Error 427.88 test_cluster_drs.py
test_02_trigger_shutdown Failure 341.69 test_safe_shutdown.py

Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@rohityadavcloud rohityadavcloud changed the title framework/db: introduce a new MySQL table based distributed lock [WIP] framework/db: introduce a new MySQL table based distributed lock May 3, 2024
@rohityadavcloud
Copy link
Member Author

rohityadavcloud commented May 22, 2024

Update and note - on further R&D and investigation, MySQL server turned out to not really be the bottleneck, thanks to the creators of jprofiler, yourkit, MAT and visual vm, I've more insights on what's lacking in CloudStack. While such a PR like this may still be useful for users who want an active-active MySQL setup, the real challenge is fixing the schema and application in the first place, for which I'll submit a separate PR (or PRs). For now this is on-hold, to be treated as an experiment.

Closing this for now.

@rohityadavcloud rohityadavcloud added this to the unplanned milestone May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants