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

feat: support to rebuild instance #6872

Merged
merged 6 commits into from
Mar 26, 2024
Merged

feat: support to rebuild instance #6872

merged 6 commits into from
Mar 26, 2024

Conversation

wangyelei
Copy link
Contributor

@wangyelei wangyelei commented Mar 25, 2024

During the operation of the database, there may be scenarios where it becomes unavailable due to reasons such as data corruption or when a node goes offline while using local disks. This PR is a supplement that focuses on rebuilding instances when the aforementioned exceptional situations occur, in order to restore the database to a usable state.

add a opsRequest type RebuildInstance.
api spec:

apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
  generateName: mysql-rebuild-
  namespace: default
spec:
  clusterRef: mysql
  type: RebuildInstance
  rebuildFrom:
  - componentName: mysql
    # Indicates the name of the backup from which to recover. Currently, only a full physical backup is supported
    # unless your component only has one replica. Such as 'xtrabackup' is full physical backup for mysql and 'mysqldump' is not.
    # And if no specified backupName, the instance will be recreated with empty 'PersistentVolumes'.
    backupName: backup-kubeblocks-cloud-ns-mysql-20240322101046
   # instance name (pod name)
    instanceNames:
    - mysql-mysql-2
    - mysql-mysql-0
  ttlSecondsBeforeAbort: 0
 

@github-actions github-actions bot added the size/XXL Denotes a PR that changes 1000+ lines. label Mar 25, 2024
@wangyelei wangyelei changed the title feat: support to rebuild instance feat: support to rebuild instance Mar 25, 2024
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

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

Project coverage is 65.98%. Comparing base (7fa65a3) to head (90bb9e3).
Report is 4 commits behind head on main.

Files Patch % Lines
controllers/apps/operations/rebuild_instance.go 71.37% 104 Missing and 44 partials ⚠️
pkg/controllerutil/util.go 0.00% 15 Missing ⚠️
pkg/dataprotection/utils/utils.go 0.00% 10 Missing ⚠️
apis/apps/v1alpha1/opsrequest_conditions.go 0.00% 8 Missing ⚠️
pkg/controller/builder/builder_pod.go 0.00% 6 Missing ⚠️
controllers/apps/operations/custom.go 75.00% 1 Missing and 1 partial ⚠️
controllers/apps/operations/ops_progress_util.go 85.71% 1 Missing ⚠️
pkg/controller/plan/restore.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #6872    +/-   ##
========================================
  Coverage   65.97%   65.98%            
========================================
  Files         332      333     +1     
  Lines       40045    40594   +549     
========================================
+ Hits        26421    26786   +365     
- Misses      11365    11505   +140     
- Partials     2259     2303    +44     
Flag Coverage Δ
unittests 65.98% <66.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.

@wangyelei wangyelei merged commit da2515e into main Mar 26, 2024
47 checks passed
@wangyelei wangyelei deleted the feature/rebuild_instance branch March 26, 2024 01:41
@github-actions github-actions bot added this to the Release 0.9.0 milestone Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-interaction feature size/XXL Denotes a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Features] support to rebuild an instance when the node is offline or the instance is unrecoverable
4 participants