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

Set the database column type to text for 'Workflow/Experiment/Schedule' #4145

Merged
merged 0 commits into from
Aug 12, 2023

Conversation

moqimoqidea
Copy link
Contributor

What problem does this PR solve?

The DB of chaos dashboard restricts the length of these three fields to normal varchar. This can easily lead to storage failure due to data being too long, logs show:

2023-08-09T07:59:54.584Z	ERROR	collector.NetworkChaos	collector/collector.go:114	failed to update experiment	{"archive": {"ID":16,"CreatedAt":"2023-08-05T11:15:45Z","UpdatedAt":"2023-08-09T07:59:54.583499664Z","DeletedAt":null,"uid":"d97a7ec5-8b9d-4acf-8ee4-a997b42648fb","kind":"NetworkChaos","name":"net-loss-100","namespace":"default","action":"loss","start_time":"2023-08-05T11:15:44Z","finish_time":null,"archived":false,"Experiment":"{\"kind\":\"NetworkChaos\",\"apiVersion\":\"chaos-mesh.org/v1alpha1\",\"metadata\":{\"name\":\"net-loss-100\",\"namespace\":\"default\",\"uid\":\"d97a7ec5-8b9d-4acf-8ee4-a997b42648fb\",\"resourceVersion\":\"4947395\",\"generation\":31,\"creationTimestamp\":\"2023-08-05T11:15:44Z\",\"annotations\":{\"experiment.chaos-mesh.org/pause\":\"true\"},\"finalizers\":[\"chaos-mesh/records\"],\"managedFields\":[{\"manager\":\"chaos-dashboard\",\"operation\":\"Update\",\"apiVersion\":\"chaos-mesh.org/v1alpha1\",\"time\":\"2023-08-05T11:17:51Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:experiment.chaos-mesh.org/pause\":{}}},\"f:spec\":{\".\":{},\"f:action\":{},\"f:direction\":{},\"f:loss\":{\".\":{},\"f:loss\":{}},\"f:mode\":{},\"f:selector\":{\".\":{},\"f:labelSelectors\":{\".\":{},\"f:app\":{}},\"f:namespaces\":{}}},\"f:status\":{\".\":{},\"f:experiment\":{}}}},{\"manager\":\"chaos-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"chaos-mesh.org/v1alpha1\",\"time\":\"2023-08-05T11:22:47Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:finalizers\":{\".\":{},\"v:\\\"chaos-mesh/records\\\"\":{}}},\"f:status\":{\"f:conditions\":{},\"f:experiment\":{\"f:containerRecords\":{},\"f:desiredPhase\":{}},\"f:instances\":{\".\":{},\"f:default/chaos-hello-web-block-5cff846575-7c7cf\":{}}}}}]},\"spec\":{\"selector\":{\"namespaces\":[\"default\"],\"labelSelectors\":{\"app\":\"chaos-hello-web-block\"}},\"mode\":\"all\",\"action\":\"loss\",\"loss\":{\"loss\":\"100\",\"correlation\":\"0\"},\"direction\":\"to\"},\"status\":{\"conditions\":[{\"type\":\"Selected\",\"status\":\"True\"},{\"type\":\"AllInjected\",\"status\":\"False\"},{\"type\":\"AllRecovered\",\"status\":\"True\"},{\"type\":\"Paused\",\"status\":\"True\"}],\"experiment\":{\"desiredPhase\":\"Stop\",\"containerRecords\":[{\"id\":\"default/chaos-hello-web-block-5cff846575-7c7cf\",\"selectorKey\":\".\",\"phase\":\"Not Injected\",\"injectedCount\":1,\"recoveredCount\":1,\"events\":[{\"type\":\"Succeeded\",\"operation\":\"Apply\",\"timestamp\":\"2023-08-05T11:15:44Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:51Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:52Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:52Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:52Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:52Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:52Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:52Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:52Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:53Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:53Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:54Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:54Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:59Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:17:59Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:18:20Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:18:20Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:19:42Z\"},{\"type\":\"Failed\",\"operation\":\"Recover\",\"message\":\"failed to apply for pod default/chaos-hello-web-block-5cff846575-7c7cf: unable to flush ip sets for pod chaos-hello-web-block-5cff846575-7c7cf\",\"timestamp\":\"2023-08-05T11:19:42Z\"},{\"type\":\"Succeeded\",\"operation\":\"Recover\",\"timestamp\":\"2023-08-05T11:22:47Z\"}]}]},\"instances\":{\"default/chaos-hello-web-block-5cff846575-7c7cf\":2}}}"}, "error": "Error 1406: Data too long for column 'experiment' at row 1"}
2023-08-09T08:04:21.815Z	ERROR	collector.event-collector.Event	collector/event_collector.go:105	failed to save event	{"event": {"id":0,"object_id":"4c5e13f1-e59b-48bc-afe0-e4061aefa16d","created_at":"2023-08-09T08:04:21Z","namespace":"default","name":"kill-tomcat-6","kind":"PodChaos","type":"Warning","reason":"Failed","message":"Failed to update records: Internal error occurred: failed calling webhook \"mpodchaos.kb.io\": failed to call webhook: Post \"https://chaos-mesh-controller-manager.chaos-mesh.svc:443/mutate-chaos-mesh-org-v1alpha1-podchaos?timeout=5s\": context deadline exceeded"}, "error": "Error 1406: Data too long for column 'message' at row 1"}

notes: no Schedule Data too long log, I haven't used Schedule heavily yet, but according to the storage structure, I predict we will encounter the same problem in the future.

What's changed and how it works?

Set the database column type to text for 'Workflow/Experiment/Schedule'

Checklist

CHANGELOG

Must include at least one of them.

  • I have updated the CHANGELOG.md
  • I have labeled this PR with "no-need-update-changelog"

Tests

Must include at least one of them.

  • Unit test
  • E2E test
  • Manual test

Side effects

  • Breaking backward compatibility

DCO

If you find the DCO check fails, please run commands like below (Depends on the actual situations. For example, if the failed commit isn't the most recent) to fix it:

git commit --amend --signoff
git push --force

@sonatype-lift
Copy link

sonatype-lift bot commented Aug 9, 2023

Sonatype Lift is retiring

Sonatype Lift will be retiring on Sep 12, 2023, with its analysis stopping on Aug 12, 2023. We understand that this news may come as a disappointment, and Sonatype is committed to helping you transition off it seamlessly. If you’d like to retain your data, please export your issues from the web console.
We are extremely grateful and thank you for your support over the years.

📖 Read about the impacts and timeline

@chaotic-prow
Copy link

chaotic-prow bot commented Aug 11, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@g1eny0ung g1eny0ung merged commit f1ee334 into chaos-mesh:master Aug 12, 2023
10 of 11 checks passed
@moqimoqidea
Copy link
Contributor Author

moqimoqidea commented Aug 14, 2023

Hello, I saw this force-pushed completely covered code change, does this merge not work as expected?

https://github.com/chaos-mesh/chaos-mesh/compare/3fc324531a74457f30346c23e0831d5214b05b8e..f1ee3341362e62c8a97b23c86b40d377cc8efeb0

@g1eny0ung

@g1eny0ung g1eny0ung requested review from g1eny0ung and removed request for g1eny0ung August 14, 2023 09:08
@g1eny0ung
Copy link
Member

g1eny0ung commented Aug 14, 2023

It seems that the pull bot you're using alters the PR, which is causing the change in this PR to show that no files have been altered. 🤔 I didn't manually merge this PR. Maybe this is our bot's strategy.

You can open a new PR to submit the changes. Then I will review it. Thanks. :)

@moqimoqidea
Copy link
Contributor Author

I resubmitted the PR once: #4151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants